lejos.robotics.proposal
Class SteeringPilot

java.lang.Object
  extended by lejos.robotics.proposal.SteeringPilot
All Implemented Interfaces:
MovementProvider, ArcPilot, BasicPilot

public class SteeringPilot
extends Object
implements ArcPilot

The SteeringPilot uses a similar steering mechanism to a car.


Constructor Summary
SteeringPilot(float wheelDiameter, float trackWidth, TachoMotor driveMotor, TachoMotor steeringMotor, float steerRatio, boolean reverse)
          Create a steering pilot
 
Method Summary
 void addMoveListener(MoveListener p)
          Adds a MoveListener that will be notified of all movement events.
 void arc(float radius)
          Starts the NXT robot moving along an arc with a specified radius.
 Movement arc(float radius, float angle)
          Moves the NXT robot along an arc with a specified radius and angle, after which the robot stops moving.
 Movement arc(float radius, float angle, boolean immediateReturn)
          Moves the NXT robot along an arc with a specified radius and angle, after which the robot stops moving.
 void backward()
          Starts the NXT robot moving backwards.
 void forward()
          Starts the NXT robot moving forward.
 float getMinRadius()
          The minimum steering radius this vehicle is capable of when traveling in an arc.
 float getMoveMaxSpeed()
           
 Movement getMovement()
           
 float getMovementIncrement()
           
 float getMoveSpeed()
           
 float getTurnMaxSpeed()
           
 float getTurnSpeed()
           
 boolean isMoving()
          true if the robot is moving
 void setMinRadius(float radius)
          Set the radius of the minimum turning circle
 void setMoveSpeed(float speed)
           
 void setTurnSpeed(float speed)
           
 Movement stop()
          Halts the NXT robot
 Movement travel(float distance)
          Moves the NXT robot a specific distance.
 Movement travel(float distance, boolean immediateReturn)
          Moves the NXT robot a specific distance.
 Movement travelArc(float radius, float distance)
          Moves the NXT robot a specified distance along an arc mof specified radius, after which the robot stops moving.
 Movement travelArc(float radius, float 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

SteeringPilot

public SteeringPilot(float wheelDiameter,
                     float trackWidth,
                     TachoMotor driveMotor,
                     TachoMotor steeringMotor,
                     float steerRatio,
                     boolean reverse)
Create a steering pilot

Parameters:
wheelDiameter -
trackWidth -
driveMotor -
steeringMotor -
steerRatio -
reverse -
Method Detail

addMoveListener

public void addMoveListener(MoveListener p)
Description copied from interface: MovementProvider
Adds a MoveListener that will be notified of all movement events.

Specified by:
addMoveListener in interface MovementProvider
Parameters:
p - the move listener

arc

public void arc(float radius)
Description copied from interface: ArcPilot
Starts the NXT robot moving 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:
arc in interface ArcPilot
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 Movement arc(float radius,
                    float angle)
Description copied from interface: ArcPilot
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 move travel forwards.
If angle is negative, the robot will move travel backwards. 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 ArcPilot
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 robot motion. Positive drives the robot forward, negative drives it backward.
See Also:
ArcPilot.travelArc(float, float)

arc

public Movement arc(float radius,
                    float angle,
                    boolean immediateReturn)
Description copied from interface: ArcPilot
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 move travel forwards.
If angle is negative, the robot will move travel backwards. 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 ArcPilot
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 robot motion. Positive drives the robot forward, negative drives it backward.
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.
See Also:
ArcPilot.travelArc(float, float, boolean)

forward

public void forward()
Description copied from interface: BasicPilot
Starts the NXT robot moving forward.

Specified by:
forward in interface BasicPilot

getMoveMaxSpeed

public float getMoveMaxSpeed()
Specified by:
getMoveMaxSpeed in interface BasicPilot

getMoveSpeed

public float getMoveSpeed()
Specified by:
getMoveSpeed in interface BasicPilot

getTurnMaxSpeed

public float getTurnMaxSpeed()

getTurnSpeed

public float getTurnSpeed()

isMoving

public boolean isMoving()
Description copied from interface: BasicPilot
true if the robot is moving

Specified by:
isMoving in interface BasicPilot
Returns:
true if the robot is moving under power.

setMoveSpeed

public void setMoveSpeed(float speed)
Specified by:
setMoveSpeed in interface BasicPilot

setTurnSpeed

public void setTurnSpeed(float speed)

stop

public Movement stop()
Description copied from interface: BasicPilot
Halts the NXT robot

Specified by:
stop in interface BasicPilot
Returns:
The movement it just achieved?

travel

public Movement travel(float distance)
Description copied from interface: BasicPilot
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 BasicPilot
Parameters:
distance - The positive or negative distance to move the robot.

travel

public Movement travel(float distance,
                       boolean immediateReturn)
Description copied from interface: BasicPilot
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 BasicPilot
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.

travelArc

public Movement travelArc(float radius,
                          float distance)
Description copied from interface: ArcPilot
Moves the NXT robot a specified distance along an arc mof 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.

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

Specified by:
travelArc in interface ArcPilot
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:
ArcPilot.arc(float, float)

travelArc

public Movement travelArc(float radius,
                          float distance,
                          boolean immediateReturn)
Description copied from interface: ArcPilot
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. Warning: Your code must call updatePostion() when the robot has stopped, otherwise, the robot position is lost.

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 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.

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

Specified by:
travelArc in interface ArcPilot
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 and your code MUST call updatePostion() when the robot has stopped. Otherwise, the robot position is lost.
See Also:
ArcPilot.arc(float, float, boolean)

setMinRadius

public void setMinRadius(float radius)
Description copied from interface: ArcPilot
Set the radius of the minimum turning circle

Specified by:
setMinRadius in interface ArcPilot
Parameters:
radius - the radius in degrees

backward

public void backward()
Description copied from interface: BasicPilot
Starts the NXT robot moving backwards.

Specified by:
backward in interface BasicPilot

getMinRadius

public float getMinRadius()
Description copied from interface: ArcPilot
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 ArcPilot
Returns:
the radius in degrees

getMovement

public Movement getMovement()
Specified by:
getMovement in interface MovementProvider

getMovementIncrement

public float getMovementIncrement()
Specified by:
getMovementIncrement in interface BasicPilot