Class RemoteRequestPilot

    • Constructor Summary

      Constructors 
      Constructor Description
      RemoteRequestPilot​(java.io.ObjectInputStream is, java.io.ObjectOutputStream os, java.lang.String leftMotor, java.lang.String rightMotor, double wheelDiameter, double trackWidth)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addMoveListener​(MoveListener listener)
      Adds a MoveListener that will be notified of all movement events.
      void arc​(double radius, double angle)
      Moves the NXT robot along an arc with a specified radius and angle, after which the robot stops moving.
      void arc​(double radius, double angle, boolean immediateReturn)
      Moves the NXT robot along an arc with a specified radius and angle, after which the robot stops moving.
      void arcBackward​(double radius)
      Starts the NXT robot moving backward along an arc with a specified radius.
      void arcForward​(double radius)
      Starts the NXT robot moving forward along an arc with a specified radius.
      void backward()
      Starts the NXT robot moving backwards.
      void close()  
      void forward()
      Starts the NXT robot moving forward.
      double getAngularAcceleration()
      Returns the acceleration at which the robot accelerates at the start of a move and decelerates at the end of a move.
      double getAngularSpeed()
      Returns the value of the rotation speed
      double getLinearAcceleration()
      Returns the acceleration at which the robot accelerates at the start of a move and decelerates at the end of a move.
      double getLinearSpeed()
      Returns the speed at which the robot will travel forward and backward (and to some extent arcs, although actual arc speed is slightly less).
      double getMaxAngularSpeed()
      returns the maximum value of the rotation speed;
      double getMaxLinearSpeed()
      Returns the maximum speed at which this robot is capable of traveling forward and backward.
      double getMinRadius()
      The minimum steering radius this vehicle is capable of when traveling in an arc.
      Move getMovement()
      Returns the move made since the move started, but before it has completed.
      boolean isMoving()
      true if the robot is moving
      void rotate​(double angle)
      Rotates the NXT robot the specified number of degrees; direction determined by the sign of the parameter.
      void rotate​(double angle, boolean immediateReturn)
      Rotates the NXT robot the specified number of degrees; direction determined by the sign of the parameter.
      void rotateLeft()  
      void rotateRight()  
      void setAngularAcceleration​(double acceleration)
      Sets the acceleration at which the robot will accelerate at the start of a move and decelerate at the end of a move.
      void setAngularSpeed​(double speed)
      sets the rotation speed of the robot (the angular velocity of the rotate() methods)
      void setLinearAcceleration​(double acceleration)
      Sets the acceleration at which the robot will accelerate at the start of a move and decelerate at the end of a move.
      void setLinearSpeed​(double speed)
      Sets the speed at which the robot will travel forward and backward (and to some extent arcs, although actual arc speed is slightly less).
      void setMinRadius​(double radius)
      Set the radius of the minimum turning circle.
      void steer​(double turnRate)  
      void stop()
      Halts the NXT robot
      void travel​(double distance)
      Moves the NXT robot a specific distance.
      void travel​(double distance, boolean immediateReturn)
      Moves the NXT robot a specific distance.
      void travelArc​(double radius, double distance)
      Moves the NXT robot a specified distance along an arc of specified radius, after which the robot stops moving.
      void travelArc​(double radius, double distance, boolean immediateReturn)
      Moves the NXT robot a specified distance along an arc of specified radius, after which the robot stops moving.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RemoteRequestPilot

        public RemoteRequestPilot​(java.io.ObjectInputStream is,
                                  java.io.ObjectOutputStream os,
                                  java.lang.String leftMotor,
                                  java.lang.String rightMotor,
                                  double wheelDiameter,
                                  double trackWidth)
    • Method Detail

      • getMinRadius

        public double getMinRadius()
        Description copied from interface: ArcMoveController
        The minimum steering radius this vehicle is capable of when traveling in an arc. Theoretically this should be identical for both forward and reverse travel. In practice?
        Specified by:
        getMinRadius in interface ArcMoveController
        Returns:
        the radius in degrees
      • setMinRadius

        public void setMinRadius​(double radius)
        Description copied from interface: ArcMoveController
        Set the radius of the minimum turning circle.
        Specified by:
        setMinRadius in interface ArcMoveController
        Parameters:
        radius - the radius in degrees
      • arcForward

        public void arcForward​(double radius)
        Description copied from interface: ArcMoveController
        Starts the NXT robot moving forward along an arc with a specified radius.

        If radius is positive, the robot arcs left, and the center of the turning circle is on the left side of the robot.
        If radius is negative, the robot arcs right, and the center of the turning circle is on the right side of the robot.
        If radius is zero, the robot rotates in place.

        Postcondition: Motor speeds are unpredictable.

        Note: If you have specified a drift correction in the constructor it will not be applied in this method.

        Specified by:
        arcForward in interface ArcMoveController
        Parameters:
        radius - of the arc path. If positive, the left side of the robot is on the inside of the turn. If negative, the left side of the robot is on the outside of the turn.
      • arcBackward

        public void arcBackward​(double radius)
        Description copied from interface: ArcMoveController
        Starts the NXT robot moving backward along an arc with a specified radius.

        If radius is positive, the robot arcs left, and the center of the turning circle is on the left side of the robot.
        If radius is negative, the robot arcs right, and the center of the turning circle is on the right side of the robot.
        If radius is zero, the robot rotates in place.

        Postcondition: Motor speeds are unpredictable.

        Note: If you have specified a drift correction in the constructor it will not be applied in this method.

        Specified by:
        arcBackward in interface ArcMoveController
        Parameters:
        radius - of the arc path. If positive, the left side of the robot is on the inside of the turn. If negative, the left side of the robot is on the outside of the turn.
      • arc

        public void arc​(double radius,
                        double angle,
                        boolean immediateReturn)
        Description copied from interface: ArcMoveController
        Moves the NXT robot along an arc with a specified radius and angle, after which the robot stops moving. This method has the ability to return immediately by using the immediateReturn parameter.

        If radius is positive, the robot arcs left, and the center of the turning circle is on the left side of the robot.
        If radius is negative, the robot arcs right, and the center of the turning circle is on the right side of the robot.
        If radius is zero, is zero, the robot rotates in place.

        The robot will stop when the degrees it has moved along the arc equals angle.
        If angle is positive, the robot will turn to the left (anti-clockwise).
        If angle is negative, the robot will turn to the right (clockwise). If angle is zero, the robot will not move and the method returns immediately.

        Postcondition: Motor speeds are unpredictable.

        Note: If you have specified a drift correction in the constructor it will not be applied in this method.

        Specified by:
        arc in interface ArcMoveController
        Parameters:
        radius - of the arc path. If positive, the left side of the robot is on the inside of the turn. If negative, the left side of the robot is on the outside of the turn.
        angle - The sign of the angle determines the direction of the robot turns: Positive is anti-clockwise, negative is clockwise.
        immediateReturn - If immediateReturn is true then the method returns immediately.
        See Also:
        ArcMoveController.travelArc(double, double, boolean)
      • travelArc

        public void travelArc​(double radius,
                              double distance,
                              boolean immediateReturn)
        Description copied from interface: ArcMoveController
        Moves the NXT robot a specified distance along an arc of specified radius, after which the robot stops moving. This method has the ability to return immediately by using the immediateReturn parameter. The units (inches, cm) for distance should be the same as the units used for radius.

        If radius is positive, the robot arcs left, and the center of the turning circle is on the left side of the robot.
        If radius is negative, the robot arcs right, and the center of the turning circle is on the right side of the robot.
        If radius is zero, the robot rotates in place.

        The robot will stop when it has moved along the arc distance units.
        If distance is positive, the robot will move travel forwards.
        If distance is negative, the robot will move travel backwards.
        If distance is zero, the robot will not move and the method returns immediately.

        Postcondition: Motor speeds are unpredictable.

        Specified by:
        travelArc in interface ArcMoveController
        Parameters:
        radius - of the arc path. If positive, the left side of the robot is on the inside of the turn. If negative, the left side of the robot is on the outside of the turn.
        distance - to travel, in same units as radius. The sign of the distance determines the direction of robot motion. Positive drives the robot forward, negative drives it backward.
        immediateReturn - If immediateReturn is true then the method returns immediately.
        See Also:
        ArcMoveController.arc(double, double, boolean)
      • isMoving

        public boolean isMoving()
        Description copied from interface: MoveController
        true if the robot is moving
        Specified by:
        isMoving in interface MoveController
        Returns:
        true if the robot is moving under power.
      • travel

        public void travel​(double distance,
                           boolean immediateReturn)
        Description copied from interface: MoveController
        Moves the NXT robot a specific distance. A positive value moves it forward and a negative value moves it backward.
        Specified by:
        travel in interface MoveController
        Parameters:
        distance - The positive or negative distance to move the robot, in wheel diameter units.
        immediateReturn - If immediateReturn is true then the method returns immediately.
      • setLinearSpeed

        public void setLinearSpeed​(double speed)
        Description copied from interface: MoveController
        Sets the speed at which the robot will travel forward and backward (and to some extent arcs, although actual arc speed is slightly less). Speed is measured in units/second. e.g. If wheel diameter is cm, then speed is cm/sec.
        Specified by:
        setLinearSpeed in interface MoveController
        Parameters:
        speed - In chosen units per second (e.g. cm/sec)
      • getLinearSpeed

        public double getLinearSpeed()
        Description copied from interface: MoveController
        Returns the speed at which the robot will travel forward and backward (and to some extent arcs, although actual arc speed is slightly less). Speed is measured in units/second. e.g. If wheel diameter is cm, then speed is cm/sec.
        Specified by:
        getLinearSpeed in interface MoveController
        Returns:
        Speed in chosen units per second (e.g. cm/sec)
      • getMaxLinearSpeed

        public double getMaxLinearSpeed()
        Description copied from interface: MoveController
        Returns the maximum speed at which this robot is capable of traveling forward and backward. Speed is measured in units/second. e.g. If wheel diameter is cm, then speed is cm/sec.
        Specified by:
        getMaxLinearSpeed in interface MoveController
        Returns:
        Speed in chosen units per second (e.g. cm/sec)
      • getMovement

        public Move getMovement()
        Description copied from interface: MoveProvider
        Returns the move made since the move started, but before it has completed. This method is used by GUI maps to display the movement of a robot in real time. The robot must be capable of determining the move while it is in motion.
        Specified by:
        getMovement in interface MoveProvider
        Returns:
        The move made since the move started.
      • addMoveListener

        public void addMoveListener​(MoveListener listener)
        Description copied from interface: MoveProvider
        Adds a MoveListener that will be notified of all movement events.
        Specified by:
        addMoveListener in interface MoveProvider
        Parameters:
        listener - the move listener
      • rotate

        public void rotate​(double angle,
                           boolean immediateReturn)
        Description copied from interface: RotateMoveController
        Rotates the NXT robot the specified number of degrees; direction determined by the sign of the parameter. Method returns immediately if immediateReturn flag is true, otherwise returns when rotation is done.
        Specified by:
        rotate in interface RotateMoveController
        Parameters:
        angle - The angle to rotate in degrees. A positive value rotates left, a negative value right (clockwise).
        immediateReturn - If true, method returns immediately, otherwise blocks until rotation is complete.
      • steer

        public void steer​(double turnRate)
      • setAngularSpeed

        public void setAngularSpeed​(double speed)
        Description copied from interface: RotateMoveController
        sets the rotation speed of the robot (the angular velocity of the rotate() methods)
        Specified by:
        setAngularSpeed in interface RotateMoveController
        Parameters:
        speed - in degrees per second
      • close

        public void close()
      • arc

        public void arc​(double radius,
                        double angle)
        Description copied from interface: ArcMoveController
        Moves the NXT robot along an arc with a specified radius and angle, after which the robot stops moving. This method does not return until the robot has completed moving angle degrees along the arc.

        If radius is positive, the robot arcs left, and the center of the turning circle is on the left side of the robot.
        If radius is negative, the robot arcs right, and the center of the turning circle is on the right side of the robot.
        If radius is zero, is zero, the robot rotates in place.

        Robot will stop when the degrees it has moved along the arc equals angle.
        If angle is positive, the robot will turn to the left (anti-clockwise).
        If angle is negative, the robot will turn to the right (clockwise). If angle is zero, the robot will not move and the method returns immediately.

        Postcondition: Motor speeds are unpredictable.

        Note: If you have specified a drift correction in the constructor it will not be applied in this method.

        Specified by:
        arc in interface ArcMoveController
        Parameters:
        radius - of the arc path. If positive, the left side of the robot is on the inside of the turn. If negative, the left side of the robot is on the outside of the turn.
        angle - The sign of the angle determines the direction of the robot turns: Positive is anti-clockwise, negative is clockwise.
        See Also:
        ArcMoveController.travelArc(double, double)
      • travel

        public void travel​(double distance)
        Description copied from interface: MoveController
        Moves the NXT robot a specific distance. A positive value moves it forward and a negative value moves it backward. Method returns when movement is done.
        Specified by:
        travel in interface MoveController
        Parameters:
        distance - The positive or negative distance to move the robot.
      • travelArc

        public void travelArc​(double radius,
                              double distance)
        Description copied from interface: ArcMoveController
        Moves the NXT robot a specified distance along an arc of specified radius, after which the robot stops moving. This method does not return until the robot has completed moving distance along the arc. The units (inches, cm) for distance must be the same as the units used for radius.

        If radius is positive, the robot arcs left, and the center of the turning circle is on the left side of the robot.
        If radius is negative, the robot arcs right, and the center of the turning circle is on the right side of the robot.
        If radius is zero, the robot rotates in place

        The robot will stop when it has moved along the arc distance units.
        If distance is positive, the robot will move travel forwards.
        If distance is negative, the robot will move travel backwards.
        If distance is zero, the robot will not move and the method returns immediately.

        Postcondition: Motor speeds are unpredictable.

        Specified by:
        travelArc in interface ArcMoveController
        Parameters:
        radius - of the arc path. If positive, the left side of the robot is on the inside of the turn. If negative, the left side of the robot is on the outside of the turn.
        distance - to travel, in same units as radius. The sign of the distance determines the direction of robot motion. Positive drives the robot forward, negative drives it backward.
        See Also:
        ArcMoveController.arc(double, double)
      • rotate

        public void rotate​(double angle)
        Description copied from interface: RotateMoveController
        Rotates the NXT robot the specified number of degrees; direction determined by the sign of the parameter. Method returns when rotation is done.
        Specified by:
        rotate in interface RotateMoveController
        Parameters:
        angle - The angle to rotate in degrees. A positive value rotates left, a negative value right (clockwise).
      • setLinearAcceleration

        public void setLinearAcceleration​(double acceleration)
        Description copied from interface: MoveController
        Sets the acceleration at which the robot will accelerate at the start of a move and decelerate at the end of a move. Acceleration is measured in units/second^2. e.g. If wheel diameter is cm, then acceleration is cm/sec^2.

        If acceleration is set during a move it will not be in used for the current move, it will be in effect with the next move.

        Specified by:
        setLinearAcceleration in interface MoveController
        Parameters:
        acceleration - in chosen units/second^2
      • getLinearAcceleration

        public double getLinearAcceleration()
        Description copied from interface: MoveController
        Returns the acceleration at which the robot accelerates at the start of a move and decelerates at the end of a move.
        Specified by:
        getLinearAcceleration in interface MoveController
        Returns:
        acceleration in chosen units/second^2
      • setAngularAcceleration

        public void setAngularAcceleration​(double acceleration)
        Description copied from interface: RotateMoveController
        Sets the acceleration at which the robot will accelerate at the start of a move and decelerate at the end of a move. Acceleration is measured in units/second^2. e.g. If wheel diameter is cm, then acceleration is cm/sec^2.

        If acceleration is set during a move it will not be in used for the current move, it will be in effect with the next move.

        Specified by:
        setAngularAcceleration in interface RotateMoveController
        Parameters:
        acceleration - in chosen units/second^2
      • getAngularAcceleration

        public double getAngularAcceleration()
        Description copied from interface: RotateMoveController
        Returns the acceleration at which the robot accelerates at the start of a move and decelerates at the end of a move.
        Specified by:
        getAngularAcceleration in interface RotateMoveController
        Returns:
        acceleration in chosen units/second^2