Datasheet
Page 154· Applied Robotics with the SumoBot
Your Turn
Here is a wider variety of maneuver constants along with extra servo pulse width rotation
constants you will need to implement all 10 maneuvers.
' -----[ Constants ]---------------------------------------------------
' SumoBot maneuver constants
Forward CON 0 ' Forward
Backward CON 1 ' Backward
RotateLeft CON 2 ' Rotate in place turning left
RotateRight CON 3 ' Rotate in place turning right
PivotLeft CON 4 ' Pivot on 1 wheel turning left
PivotRight CON 5 ' Pivot on 1 wheel turning right
CurveLeft CON 6 ' Curve to the left
CurveRight CON 7 ' Curve to the right
PivotLeftBack CON 8 ' Pivot backward-left
pivotRightBack CON 9 ' Pivot backward-right
' Servo pulse width rotation constants
FS_CCW CON 850 ' Full speed counterclockwise
FS_CW CON 650 ' Full speed clockwise
NO_ROT CON 750 ' No rotation
LS_CCW CON 770 ' Low speed counterclockwise
LS_CW CON 730 ' Low speed clockwise
√ Save ServoControlWithLookup.bs2 as ServoControlWithLookupYourTurn.bs2.
√ Update the constants section with all the new declarations.
Here is the
Pulse_Servos subroutine with its LOOKUP commands modified to
accommodate the
PivotLeft and PivotRight maneuvers:
Pulse_Servos:
' Pulse to left servo
LOOKUP maneuver, [ FS_CCW, FS_CW, FS_CW, FS_CCW,
NO_ROT, FS_CCW ], temp
PULSOUT ServoLeft, temp
' Pulse to right servo
LOOKUP maneuver, [ FS_CW, FS_CCW, FS_CW, FS_CCW,
FS_CW, NO_ROT ], temp
PULSOUT ServoRight, temp
' Pause between pulses (remove when using IR object detectors + QTIs)
PAUSE 20
RETURN