public int getEncodedMotorPosition(int motor)
        {
                if (!isConnected())
                {
                        error("Robot is not connected!", "RXTXRobot", "getEncodedMotorPosition");
                        return -1;
                }
                if (!getOverrideValidation() && (motor < RXTXRobot.MOTOR1 || motor > RXTXRobot.MOTOR2))
                {
                        error("getEncodedMotorPosition was not given a correct motor argument", "RXTXRobot", "getEncodedMotorPosition");
                        return -1;
                }
                debug("Checking tick position for encoder " + motor);
                this.attemptTryAgain = true;
                String[] split = sendRaw("p " + motor).split("\\s+");
                this.attemptTryAgain = false;
                if (split.length != 3) 
                {
                        error("Incorrect length returned: " + split.length, "RXTXRobot", "getEncodedMotorPosition");
                        return -1;
                }
                return Integer.parseInt(split[2]);
        }