|s1||-||The speed for motor 1.|
|s2||-||The speed for motor 2.|
|s3||-||The speed for motor 3.|
|r||-||A rotational offset speed to be added to all speeds.|
This routine sets the speeds of three servos modified for continuous rotation. It does not enable or disable the servos based on the input values. This routine is intended for use with a Palm Pilot Robot Kit (PPRK) which uses three omni-directional wheels connected to three servos for locomotion. When the s1, s2, s3 parameters are set to 0, and the r parameter is non-zero, the robot will rotate. The r parameter may also be used as a steering offset when the robot is traveling in a particular direction. When the s1, s2, s3 parameters are non-zero, the robot will do something other than rotate. Trial and error may be required to get a desired motion.
For this routine to work, servo 1 must be connected to servo output 0, servo 2 must be connected to servo output 1, and servo 3 must be connected to servo output 2 on the GP 1.0 board. Prior to using this routine, the servos must be tuned with the GP 1.0 application so that a position setting of 128 will stop each servo and a position setting of 255 on all servos will make the robot spin clockwise. (A servo may also be tuned by adjusting its centering pot to make the servo stop at position 128.)
Speeds are char values in the range -128 to 127. Use caution when doing calculations with char variables. A result that exceeds these bounds may cause a sign flip in a char value and unintentionally reverse the direction of a wheel. Caution is recommended when calculating a new r parameter since it is added to the other 3 speeds.
This would make a PPRK controlled by a BrainStem® spin clockwise for one second, then spin counterclockwise for one second, then stop.
This would make a PPRK controlled by a BrainStem turn on 2 of its motors for one second then stop. The small magnitudes of the s1 and s2 parameters correspond to a low speed.