|
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
|