Page 99 - The Definitive Guide to Building Java Robots
P. 99
Preston_5564C03.fm Page 80 Wednesday, October 5, 2005 7:21 AM
80 CHAPTER 3 ■ MOTION
Figure 3-10. A class diagram of the classes in section 3.4
Code Objectives
The objective here is to create an interface for managing the GroupMoveProtocol so it can be
implemented by the MiniSSC and LM32.
Code Discussion
The interface for group moves is different than that for the SSC because we are embedding
timing directly into the command string instead of pausing our program. So the interface
should really just be made to accept commands and store them for a final output.
The field in the interface is a constant for command termination as specified by the LM32.
The first method, sscCmd(), takes the same inputs as a MiniSSC. The cmd() method will take an
additional parameter spd—this will be the speed of the individual move. The final method,
move(), will take a single parameter time. This will be the speed of the total move as opposed
to the move for the specific servo. (See Example 3-11.)
97022d2480fe4a63cfdfa123a6e70098