|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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 |
---|
void forward()
Navigator.stop()
void backward()
Navigator.stop()
void stop()
Navigator.forward()
boolean isMoving()
void setMoveSpeed(float speed)
speed
- The speed in wheel diameter units per second.float getMoveSpeed()
float getMoveMaxSpeed()
void setTurnSpeed(float speed)
speed
- The speed in degree per second.float getTurnSpeed()
float getTurnMaxSpeed()
void setSpeed(int speed)
speed
- The speed of the drive motor(s) in degree per second.void travel(float distance)
distance
- The positive or negative distance to move the robot.void travel(float distance, boolean immediateReturn)
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.void rotate(float angle)
angle
- The angle to rotate in degrees. A positive value rotates left, a negative value right (clockwise).void rotate(float angle, boolean immediateReturn)
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.float getAngle()
float getTravelDistance()
void steer(int turnRate)
turnRate
- If positive, the left wheel is on the inside of the turn. If negative, the left wheel is on the
outside.void steer(int turnRate, int angle)
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.void steer(int turnRate, int angle, boolean immediateReturn)
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.void turn(float radius)
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.void turn(float radius, int angle)
radius
- The radius of the turning circle.angle
- The sign of the angle determines the direction of robot motion.void turn(float radius, int angle, boolean immediateReturn)
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.void reset()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |