Page 91 - The Definitive Guide to Building Java Robots
P. 91

Preston_5564C03.fm  Page 72  Wednesday, October 5, 2005  7:21 AM



                 72     CHAPTER 3  ■  MOTION
























































                        Figure 3-8. A class diagram of classes in section 3.3

                        Code Objectives
                        The objective in this section is to create a class to control a pan and tilt mechanism from a servo
                        controller.

                        Code Discussion

                        The most important part of this class is the preconfigured constants—for example, what pins
                        connect the servos? How far can the servos move? What are the rest positions? These are things
                        you’ll have to experiment with to set. The remaining fields are stepSize (how many bytes the
   86   87   88   89   90   91   92   93   94   95   96