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

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



                 64     CHAPTER 3  ■  MOTION



                            // pivot on axis left
                            public void pivotLeft() throws Exception {
                                if (motorsInverted) {
                                    setMotors(leftHigh, rightHigh);
                                } else {
                                    setMotors(leftHigh, rightLow);
                                }
                                move();
                            }
                            // stop the motion
                            public void stop() throws Exception {
                                // set both motors to same value
                                setMotors(SSCProtocol.NEUTRAL, SSCProtocol.NEUTRAL);
                                move();
                            }

                            // accessor
                            public boolean isMotorsInverted() {
                                return motorsInverted;
                            }
                            // setter
                            public void setMotorsInverted(boolean motorsInverted) {
                                this.motorsInverted = motorsInverted;
                            }

                            // accessor
                            public int getLeftHigh() {
                                return leftHigh;
                            }


                            // setter
                            public void setLeftHigh(int leftHigh) {
                                this.leftHigh = leftHigh;
                            }

                            // accessor
                            public int getLeftLow() {
                                return leftLow;
                            }
                            // setter
                            public void setLeftLow(int leftLow) {
                                this.leftLow = leftLow;
                            }
   78   79   80   81   82   83   84   85   86   87   88