lejos.navigation
Interface Pilot

All Known Implementing Classes:
CompassPilot, TachoPilot

public interface Pilot

The Pilot interface forms a common set of functions an implementation must offer in order to be used by higher level navigation classes. The Pilot hides the details of the robots physical construction and the required control algorithms from the rest of this package.


Method Summary
 void backward()
          Moves the NXT robot backward until stop() is called.
 void forward()
          Moves the NXT robot forward until stop() is called.
 float getAngle()
           
 float getMoveMaxSpeed()
           
 float getMoveSpeed()
           
 float getTravelDistance()
           
 float getTurnMaxSpeed()
           
 float getTurnSpeed()
           
 boolean isMoving()
           
 void reset()
          Reset traveled distance and rotated angle.
 void rotate(float angle)
          Rotates the NXT robot a specific number of degrees in a direction.
 void rotate(float angle, boolean immediateReturn)
          Rotates the NXT robot a specific number of degrees in a direction.
 void setMoveSpeed(float speed)
          Sets the movement speed of the robot.
 void setSpeed(int speed)
          Deprecated. in 0.8, use setTurnSpeed() and setMoveSpeed(). The method was deprecated, as this it requires knowledge of the robots physical construction, which this interface should hide!
 void setTurnSpeed(float speed)
          Sets the turning speed of the robot.
 void steer(int turnRate)
          Moves the NXT robot in a circular path at a specific turn rate.
 void steer(int turnRate, int angle)
          Moves the NXT robot in a circular path at a specific turn rate.
 void steer(int turnRate, int angle, boolean immediateReturn)
          Moves the NXT robot in a circular path at a specific turn rate.
 void stop()
          Halts the NXT robot and calculates new x, y coordinates.
 void travel(float distance)
          Moves the NXT robot a specific distance.
 void travel(float distance, boolean immediateReturn)
          Moves the NXT robot a specific distance.
 void turn(float radius)
          Moves the NXT robot in a circular path with a specified radius.
The center of the turning circle is on the right side of the robot if parameter radius is negative.
Postcondition: Motor speeds are unpredictable.
 void turn(float radius, int angle)
          Moves the NXT robot in a circular path with a specified radius.
The center of the turning circle is on the right side of the robot if parameter radius is negative.
Robot will stop when total rotation equals angle.
 void turn(float radius, int angle, boolean immediateReturn)
          Moves the NXT robot in a circular path with a specified radius.
The center of the turning circle is on the right side of the robot if parameter radius is negative.
Robot will stop when total rotation equals angle.
 

Method Detail

forward

void forward()
Moves the NXT robot forward until stop() is called.

See Also:
Navigator.stop()

backward

void backward()
Moves the NXT robot backward until stop() is called.

See Also:
Navigator.stop()

stop

void stop()
Halts the NXT robot and calculates new x, y coordinates.

See Also:
Navigator.forward()

isMoving

boolean isMoving()
Returns:
true if the robot is moving under power.

setMoveSpeed

void setMoveSpeed(float speed)
Sets the movement speed of the robot.

Parameters:
speed - The speed in wheel diameter units per second.

getMoveSpeed

float getMoveSpeed()
Returns:
the movement speed of the robot in wheel diameter units per second.

getMoveMaxSpeed

float getMoveMaxSpeed()
Returns:
the maximal movement speed of the robot in wheel diameter units per second which can be maintained accurately. Will change with time, as it is normally dependent on the battery voltage.

setTurnSpeed

void setTurnSpeed(float speed)
Sets the turning speed of the robot.

Parameters:
speed - The speed in degree per second.

getTurnSpeed

float getTurnSpeed()
Returns:
the turning speed of the robot in degree per second.

getTurnMaxSpeed

float getTurnMaxSpeed()
Returns:
the maximal turning speed of the robot in degree per second which can be maintained accurately. Will change with time, as it is normally dependent on the battery voltage.

setSpeed

void setSpeed(int speed)
Deprecated. in 0.8, use setTurnSpeed() and setMoveSpeed(). The method was deprecated, as this it requires knowledge of the robots physical construction, which this interface should hide!

Sets drive motor speed.

Parameters:
speed - The speed of the drive motor(s) in degree per second.

travel

void travel(float distance)
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.

Parameters:
distance - The positive or negative distance to move the robot.

travel

void travel(float distance,
            boolean immediateReturn)
Moves the NXT robot a specific distance. A positive value moves it forward and a negative value moves it backward.

Parameters:
distance - The positive or negative distance to move the robot.
immediateReturn - If immediateReturn is true then the method returns immediately and your code MUST call updatePostion() when the robot has stopped. Otherwise, the robot position is lost.

rotate

void rotate(float angle)
Rotates the NXT robot a specific number of degrees in a direction. Method returns when rotation is done.

Parameters:
angle - The angle to rotate in degrees. A positive value rotates left, a negative value right (clockwise).

rotate

void rotate(float angle,
            boolean immediateReturn)
Rotates the NXT robot a specific number of degrees in a direction. Method returns when rotation is done.

Parameters:
angle - The angle to rotate in degrees. A positive value rotates left, a negative value right (clockwise).
immediateReturn - If immediateReturn is true then the method returns immediately and your code MUST call updatePostion() when the robot has stopped. Otherwise, the robot position is lost.

getAngle

float getAngle()
Returns:
the angle of rotation of the robot since last call to reset.

getTravelDistance

float getTravelDistance()
Returns:
distance traveled by the robot since last call to reset.

steer

void steer(int turnRate)
Moves the NXT robot in a circular path at a specific turn rate. The center of the turning circle is on the right side of the robot if parameter turnRate is negative. Values for turnRate are between -200 and +200. The turnRate determines the ratio of inner wheel speed to outer wheel speed (as a percent).
Formula: ratio = 100 - abs(turnRate). When the ratio is negative, the outer and inner wheels rotate in opposite directions.
Examples: Note: Even if you have specified a drift correction in the constructor it will not be applied in this method.

Parameters:
turnRate - If positive, the left wheel is on the inside of the turn. If negative, the left wheel is on the outside.

steer

void steer(int turnRate,
           int angle)
Moves the NXT robot in a circular path at a specific turn rate. The center of the turning circle is on the right side of the robot if parameter turnRate is negative. Values for turnRate are between -200 and +200. The turnRate determines the ratio of inner wheel speed to outer wheel speed (as a percent).
Formula: ratio = 100 - abs(turnRate). When the ratio is negative, the outer and inner wheels rotate in opposite directions.
Examples: Note: Even if you have specified a drift correction in the constructor it will not be applied in this method.

Parameters:
turnRate - If positive, the left wheel is on the inside of the turn. If negative, the left wheel is on the outside.
angle - The angle through which the robot will rotate. If negative, robot traces the turning circle backwards.

steer

void steer(int turnRate,
           int angle,
           boolean immediateReturn)
Moves the NXT robot in a circular path at a specific turn rate. The center of the turning circle is on the right side of the robot if parameter turnRate is negative. Values for turnRate are between -200 and +200. The turnRate determines the ratio of inner wheel speed to outer wheel speed (as a percent).
Formula: ratio = 100 - abs(turnRate). When the ratio is negative, the outer and inner wheels rotate in opposite directions.
Examples: Note: Even if you have specified a drift correction in the constructor it will not be applied in this method.

Parameters:
turnRate - If positive, the left wheel is on the inside of the turn. If negative, the left wheel is on the outside.
angle - The angle through which the robot will rotate. If negative, robot traces the turning circle backwards.
immediateReturn - If immediateReturn is true then the method returns immediately and your code MUST call updatePostion() when the robot has stopped. Otherwise, the robot position is lost.

turn

void turn(float radius)
Moves the NXT robot in a circular path with a specified radius.
The center of the turning circle is on the right side of the robot if parameter radius is negative.
Postcondition: Motor speeds are unpredictable.

Parameters:
radius - of the circular path. If positive, the left wheel is on the inside of the turn. If negative, the left wheel is on the outside.

turn

void turn(float radius,
          int angle)
Moves the NXT robot in a circular path with a specified radius.
The center of the turning circle is on the right side of the robot if parameter radius is negative.
Robot will stop when total rotation equals angle. If angle is negative, robot will move travel backwards.

Parameters:
radius - The radius of the turning circle.
angle - The sign of the angle determines the direction of robot motion.

turn

void turn(float radius,
          int angle,
          boolean immediateReturn)
Moves the NXT robot in a circular path with a specified radius.
The center of the turning circle is on the right side of the robot if parameter radius is negative.
Robot will stop when total rotation equals angle. If angle is negative, robot will move travel backwards.

Parameters:
radius - The radius of the turning circle.
angle - The sign of the angle determines the direction of robot motion.
immediateReturn - If immediateReturn is true then the method returns immediately and your code MUST call updatePostion() when the robot has stopped. Otherwise, the robot position is lost.

reset

void reset()
Reset traveled distance and rotated angle.