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

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



                 76     CHAPTER 3  ■  MOTION



                            public void moveLeft(int size) throws Exception{
                                horz(horzPos-size);
                            }
                            public void moveLeft()throws Exception {
                                moveLeft(stepSize);
                            }

                            public void moveUp(int size) throws Exception{
                                vert(vertPos+size);
                            }
                            public void moveUp()throws Exception {
                                moveUp(stepSize);
                            }
                            public void moveDown(int size) throws Exception{
                                vert(vertPos-size);
                            }
                            public void moveDown()throws Exception {
                                moveDown(stepSize);
                            }

                            // accessor
                            public int getHorzPos() {
                                return horzPos;
                            }
                            // setter
                            public void setHorzPos(int horzPos) {
                                this.horzPos = horzPos;
                            }
                            // accessor
                            public int getVertPos() {
                                return vertPos;
                            }
                            // setter
                            public void setVertPos(int vertPos) {
                                this.vertPos = vertPos;
                            }
                            // accessor
                            public int getSpeed() {
                                return speed;
                            }
                            // setter
                            public void setSpeed(int speed) {
                                this.speed = speed;
                            }
                            // servo timing setter
                            // stepSize = size of the step as long as it's not minimum step size
                            // moveDelay = timing delay between steps
   90   91   92   93   94   95   96   97   98   99   100