|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object lejos.robotics.navigation.LegacyPilot
@Deprecated public class LegacyPilot
The LegacyPilot class is a renamed version the TachoPilot class in the 0.85 release.
It is a software abstraction of a NXT robot with two
independently controlled wheels, on opposite sides of the robot, with colinear axles.
This design permits the robot to rotate within its own footprint (i.e. turn on
one spot without changing its location).
It contains methods to control basic robot movements: travel forward or
backward in a straight line or a circular path or rotate to a new direction.
It can be used with robots that have reversed motor design: the robot moves
in the direction opposite to the the direction of motor rotation.
About angles: LegacyPilot uses the Navigation package standard mathematical convention for angles in
the plane. The direction of the X axis is 0 degrees, the direction of
the Y axis is 90 degrees. Therefore, a positive angle is a counter clockwise change of direction,
and a negative angle is clockwise.
Some methods optionally return immediately so the thread that called the
method can monitor sensors and call stop() if necessary.
Example:
LegacyPilot pilot = new LegacyPilot(2.1f, 4.4f, Motor.A, Motor.C, true); // parameters in inches
pilot.setTravelSpeed(10); // inches per second
pilot.travel(12); // inches
pilot.rotate(-90); // degree clockwise
pilot.travel(-12,true);
while(pilot.isMoving())Thread.yield();
pilot.steer(-50,180,true);
while(pilot.isMoving())Thread.yield();
pilot.steer(100);
Delay.msDelay(1000);
pilot.stop();
MoveController
Field Summary | |
---|---|
protected RegulatedMotor |
_inside
Deprecated. The motor at the inside of the turn. |
protected RegulatedMotor |
_left
Deprecated. Left motor. |
protected float |
_leftDegPerDistance
Deprecated. Left motor degrees per unit of travel. |
protected float |
_leftTurnRatio
Deprecated. Left motor revolutions for 360 degree rotation of robot (motors running in opposite directions). |
protected float |
_leftWheelDiameter
Deprecated. Diameter of left wheel. |
protected int |
_motorSpeed
Deprecated. Motor speed degrees per second. |
protected RegulatedMotor |
_outside
Deprecated. The motor at the outside of the turn. |
protected RegulatedMotor |
_right
Deprecated. Right motor. |
protected float |
_rightDegPerDistance
Deprecated. Right motor degrees per unit of travel. |
protected float |
_rightTurnRatio
Deprecated. Right motor revolutions for 360 degree rotation of robot (motors running in opposite directions). |
protected float |
_rightWheelDiameter
Deprecated. Diameter of right wheel. |
protected float |
_robotRotateSpeed
Deprecated. Speed of robot for turning in degree per seconds. |
protected float |
_robotTravelSpeed
Deprecated. Speed of robot for moving in wheel diameter units per seconds. |
protected float |
_steerRatio
Deprecated. ratio of inside/outside motor speeds set by steer(turnRate) used by other steer methods; |
protected float |
_trackWidth
Deprecated. Distance between wheels. |
Constructor Summary | |
---|---|
LegacyPilot(float leftWheelDiameter,
float rightWheelDiameter,
float trackWidth,
RegulatedMotor leftMotor,
RegulatedMotor rightMotor,
boolean reverse)
Deprecated. Allocates a LegacyPilot object, and sets the physical parameters of the NXT robot. |
|
LegacyPilot(float wheelDiameter,
float trackWidth,
RegulatedMotor leftMotor,
RegulatedMotor rightMotor)
Deprecated. Allocates a LegacyPilot object, and sets the physical parameters of the NXT robot. Assumes Motor.forward() causes the robot to move forward. |
|
LegacyPilot(float wheelDiameter,
float trackWidth,
RegulatedMotor leftMotor,
RegulatedMotor rightMotor,
boolean reverse)
Deprecated. Allocates a LegacyPilot object, and sets the physical parameters of the NXT robot. |
Method Summary | |
---|---|
void |
arc(float radius)
Deprecated. |
void |
arc(float radius,
float angle)
Deprecated. |
void |
arc(float radius,
float angle,
boolean immediateReturn)
Deprecated. |
void |
backward()
Deprecated. |
void |
forward()
Deprecated. |
float |
getAngle()
Deprecated. |
RegulatedMotor |
getLeft()
Deprecated. Returns the left motor. |
int |
getLeftCount()
Deprecated. Returns the tachoCount of the left motor |
float |
getMaxRotateSpeed()
Deprecated. |
float |
getMaxTravelSpeed()
Deprecated. |
float |
getMoveMaxSpeed()
Deprecated. |
float |
getMoveSpeed()
Deprecated. |
RegulatedMotor |
getRight()
Deprecated. returns the right motor. |
int |
getRightCount()
Deprecated. Returns the tachoCount of the right motor |
float |
getRotateSpeed()
Deprecated. |
float |
getTravelDistance()
Deprecated. |
float |
getTravelSpeed()
Deprecated. |
float |
getTurnRatio()
Deprecated. Returns the ratio of motor revolutions per 360 degree rotation of the robot |
float |
getTurnSpeed()
Deprecated. |
boolean |
isMoving()
Deprecated. |
void |
reset()
Deprecated. Resets tacho count for both motors. |
void |
rotate(float angle)
Deprecated. |
void |
rotate(float angle,
boolean immediateReturn)
Deprecated. |
void |
setMoveSpeed(float speed)
Deprecated. |
void |
setRotateSpeed(float rotateSpeed)
Deprecated. |
void |
setSpeed(int speed)
Deprecated. in 0.8, use setRotateSpeed() and setTravelSpeed(). The method was deprecated, as this it requires knowledge of the robots physical construction, which this interface should hide! |
void |
setTravelSpeed(float travelSpeed)
Deprecated. also sets _motorSpeed |
void |
setTurnSpeed(float speed)
Deprecated. |
boolean |
stalled()
Deprecated. |
void |
steer(float turnRate)
Deprecated. |
void |
steer(float turnRate,
float angle)
Deprecated. |
void |
steer(float turnRate,
float angle,
boolean immediateReturn)
Deprecated. |
protected void |
steerPrep(float turnRate)
Deprecated. helper method used by steer(float) and steer(float,float,boolean) |
void |
stop()
Deprecated. Stops the NXT robot. |
void |
travel(float distance)
Deprecated. Moves the NXT robot a specific distance in an (hopefully) straight line. A positive distance causes forward motion, a negative distance moves backward. |
void |
travel(float distance,
boolean immediateReturn)
Deprecated. Moves the NXT robot a specific distance in an (hopefully) straight line. A positive distance causes forward motion, a negative distance moves backward. |
void |
travelArc(float radius,
float distance)
Deprecated. |
void |
travelArc(float radius,
float distance,
boolean immediateReturn)
Deprecated. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final RegulatedMotor _left
protected final RegulatedMotor _right
protected RegulatedMotor _inside
protected RegulatedMotor _outside
protected float _steerRatio
protected final float _leftDegPerDistance
protected final float _rightDegPerDistance
protected final float _leftTurnRatio
protected final float _rightTurnRatio
protected float _robotTravelSpeed
protected float _robotRotateSpeed
protected int _motorSpeed
protected final float _trackWidth
protected final float _leftWheelDiameter
protected final float _rightWheelDiameter
Constructor Detail |
---|
public LegacyPilot(float wheelDiameter, float trackWidth, RegulatedMotor leftMotor, RegulatedMotor rightMotor)
wheelDiameter
- Diameter of the tire, in any convenient units (diameter in mm
is usually printed on the tire).trackWidth
- Distance between center of right tire and center of left tire,
in same units as wheelDiameter.leftMotor
- The left Motor (e.g., Motor.C).rightMotor
- The right Motor (e.g., Motor.A).public LegacyPilot(float wheelDiameter, float trackWidth, RegulatedMotor leftMotor, RegulatedMotor rightMotor, boolean reverse)
wheelDiameter
- Diameter of the tire, in any convenient units (diameter in mm
is usually printed on the tire).trackWidth
- Distance between center of right tire and center of left tire,
in same units as wheelDiameter.leftMotor
- The left Motor (e.g., Motor.C).rightMotor
- The right Motor (e.g., Motor.A).reverse
- If true, the NXT robot moves forward when the motors are
running backward.public LegacyPilot(float leftWheelDiameter, float rightWheelDiameter, float trackWidth, RegulatedMotor leftMotor, RegulatedMotor rightMotor, boolean reverse)
leftWheelDiameter
- Diameter of the left wheel, in any convenient units (diameter
in mm is usually printed on the tire).rightWheelDiameter
- Diameter of the right wheel. You can actually fit
intentionally wheels with different size to your robot. If you
fitted wheels with the same size, but your robot is not going
straight, try swapping the wheels and see if it deviates into
the other direction. That would indicate a small difference in
wheel size. Adjust wheel size accordingly. The minimum change
in wheel size which will actually have an effect is given by
minChange = A*wheelDiameter*wheelDiameter/(1-(A*wheelDiameter)
where A = PI/(TravelSpeed*360). Thus for a TravelSpeed of 25
cm/second and a wheelDiameter of 5,5 cm the minChange is about
0,01058 cm. The reason for this is, that different while sizes
will result in different motor speed. And that is given as an
integer in degree per second.trackWidth
- Distance between center of right tire and center of left tire,
in same units as wheelDiameter.leftMotor
- The left Motor (e.g., Motor.C).rightMotor
- The right Motor (e.g., Motor.A).reverse
- If true, the NXT robot moves forward when the motors are
running backward.Method Detail |
---|
public RegulatedMotor getLeft()
public RegulatedMotor getRight()
public int getLeftCount()
public int getRightCount()
public float getTurnRatio()
@Deprecated public void setSpeed(int speed)
speed
- The speed of the drive motor(s) in degree per second.@Deprecated public void setMoveSpeed(float speed)
public void setTravelSpeed(float travelSpeed)
public float getTravelSpeed()
@Deprecated public float getMoveSpeed()
public float getMaxTravelSpeed()
@Deprecated public float getMoveMaxSpeed()
public void setRotateSpeed(float rotateSpeed)
@Deprecated public void setTurnSpeed(float speed)
@Deprecated public float getTurnSpeed()
public float getRotateSpeed()
public float getMaxRotateSpeed()
public void forward()
public void backward()
public void rotate(float angle)
public void rotate(float angle, boolean immediateReturn)
public float getAngle()
public void stop()
public boolean isMoving()
public void reset()
public float getTravelDistance()
public void travel(float distance)
distance
- The distance to move. Unit of measure for distance must be
same as wheelDiameter and trackWidth.public void travel(float distance, boolean immediateReturn)
distance
- The distance to move. Unit of measure for distance must be
same as wheelDiameter and trackWidth.immediateReturn
- If true this method returns immediately.protected void steerPrep(float turnRate)
turnRate
- public void steer(float turnRate)
public void steer(float turnRate, float angle)
public void steer(float turnRate, float angle, boolean immediateReturn)
public boolean stalled()
public void arc(float radius)
public void arc(float radius, float angle)
public void arc(float radius, float angle, boolean immediateReturn)
public void travelArc(float radius, float distance)
public void travelArc(float radius, float distance, boolean immediateReturn)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |