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

Preston_5564C07.fm  Page 238  Monday, September 26, 2005  5:38 AM



                 238    CHAPTER 7  ■  NAVIGATION



                        identical rotation characteristics, you should be fine with setting them at the same speed.
                        However, make sure you take some measurements of how fast your robot moves for a given
                        speed in a given unit of time. Since I am not using encoders, I had to calibrate Feynman5 on
                        two surfaces—cement and carpet—for specific speeds.

                        Code Objective

                        The code objective here is to create a navigation class that gives the robot the ability to dead
                        reckon.

                        Code Discussion

                        Figure 7-8 shows the three classes that will handle basic navigation.










































                        Figure 7-8. The three classes that handle basic navigation: Navigation, MotionVector, and
                        DistanceVector


                            Of the two classes required to get our robot to perform dead reckoning, the first one we are
                        going to discuss is MotionVector. MotionVector represents the heading and time of any movement
   252   253   254   255   256   257   258   259   260   261   262