View Single Post
  #5   Spotlight this post!  
Unread 06-11-2002, 15:19
Matt Reiland's Avatar
Matt Reiland Matt Reiland is offline
'The' drive behind the drive
None #0226 (TEC CReW Hammerheads)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1999
Location: Troy Michigan
Posts: 712
Matt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond repute
This is the actual code from our Swerve robot using feedback for the steering. Use the Steer_Gain variable to increase the speed that it closes in on the value . temp1 is the value that you are requesting the arm or steering to go to


' The following is for the output to the steering motor
' Some motion planning is being accomplished by slowing the motor
' as the actual steering angle is approaching the desired
' angle. This will lead to less overshoot
'
' currentsteer is the value from the steering pot on the robot

IF NOT(currentsteer > temp1) THEN STEERFWD
steer=127 - (((currentsteer - temp1)*STEER_GAIN) MAX 60)
goto EndSteeringFeedbackControl

:STEERFWD

steer=127 + (((temp1 - currentsteer)*STEER_GAIN) MAX 60)

EndSteeringFeedbackControl

steer=254-steer ' reverse the steering output