Class DifferentialPilot
- java.lang.Object
-
- lejos.robotics.navigation.DifferentialPilot
-
- All Implemented Interfaces:
ArcMoveController,ArcRotateMoveController,LineFollowingMoveController,MoveController,MoveProvider,RotateMoveController
- Direct Known Subclasses:
CompassPilot
@Deprecated public class DifferentialPilot extends java.lang.Object implements LineFollowingMoveController
Deprecated.useMovePilotinstead.The DifferentialPilot class is a software abstraction of the Pilot mechanism of a NXT robot. It contains methods to control robot movements: travel forward or backward in a straight line or a circular path or rotate to a new direction.
This class will only work with two independently controlled motors to steer differentially, so it can rotate within its own footprint (i.e. turn on one spot). It registers as aRegulatedMotorListenerwith each of its motors. An object of this class assumes that it has exclusive control of its motors. If any other object makes calls to its motors, the results are unpredictable.
This class can be used with robots that have reversed motor design: the robot moves in the direction opposite to the the direction of motor rotation. .
It automatically updates aOdometryPoseProviderwhich has called theaddMoveListenermethod on this object.
Some methods optionally return immediately so the thread that called it can do things while the robot is moving, such as monitor sensors and callstop().
Handling stalls: If a stall is detected,isStalled()returnstrue,isMoving()returnsfalse,moveStopped()is called, and, if a blocking method is executing, that method exits. The units of measure for travel distance, speed and acceleration are the units used in specifying the wheel diameter and track width in the constructor.
In all the methods that cause the robot to change its heading (the angle relative to the X axis in which the robot is facing) the angle parameter specifies the change in heading. A positive angle causes a turn to the left (anti-clockwise) to increase the heading, and a negative angle causes a turn to the right (clockwise).
Example of use of come common methods:DifferentialPilot pilot = new DifferentialPilot(2.1f, 4.4f, Motor.A, Motor.C, true); // parameters in inches pilot.setRobotSpeed(30); // cm per second pilot.travel(50); // cm pilot.rotate(-90); // degree clockwise pilot.travel(-50,true); // move backward for 50 cm while(pilot.isMoving())Thread.yield(); pilot.rotate(-90); pilot.rotateTo(270); pilot.steer(-50,180,true); // turn 180 degrees to the right waitComplete(); // returns when previous method is complete pilot.steer(100); // turns with left wheel stationary Delay.msDelay(1000; pilot.stop();
Note: A DifferentialPilot robot can simulate a SteeringPilot robot by calling DifferentialPilot.setMinRadius() and setting the value to something greater than zero (perhaps 15 cm).
-
-
Field Summary
Fields Modifier and Type Field Description protected RegulatedMotor_leftDeprecated.Left motor..protected float_leftDegPerDistanceDeprecated.Left motor degrees per unit of travel.protected RegulatedMotor_outsideDeprecated.The motor at the outside of the turn.protected RegulatedMotor_rightDeprecated.Right motor.protected float_rightDegPerDistanceDeprecated.Right motor degrees per unit of travel.protected Move.MoveType_typeDeprecated.-
Fields inherited from interface lejos.robotics.navigation.MoveController
WHEEL_SIZE_EV3, WHEEL_SIZE_NXT1, WHEEL_SIZE_NXT2, WHEEL_SIZE_RCX
-
-
Constructor Summary
Constructors Constructor Description DifferentialPilot(double leftWheelDiameter, double rightWheelDiameter, double trackWidth, RegulatedMotor leftMotor, RegulatedMotor rightMotor, boolean reverse)Deprecated.Allocates a DifferentialPilot object, and sets the physical parameters of the NXT robot.DifferentialPilot(double wheelDiameter, double trackWidth, RegulatedMotor leftMotor, RegulatedMotor rightMotor)Deprecated.Allocates a DifferentialPilot object, and sets the physical parameters of the NXT robot.
Assumes Motor.forward() causes the robot to move forward.DifferentialPilot(double wheelDiameter, double trackWidth, RegulatedMotor leftMotor, RegulatedMotor rightMotor, boolean reverse)Deprecated.Allocates a DifferentialPilot object, and sets the physical parameters of the NXT robot.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddMoveListener(MoveListener m)Deprecated.Adds a MoveListener that will be notified of all movement events.voidarc(double radius, double angle)Deprecated.Moves the NXT robot along an arc with a specified radius and angle, after which the robot stops moving.voidarc(double radius, double angle, boolean immediateReturn)Deprecated.Moves the NXT robot along an arc with a specified radius and angle, after which the robot stops moving.voidarcBackward(double radius)Deprecated.Starts the NXT robot moving backward along an arc with a specified radius.voidarcForward(double radius)Deprecated.Starts the NXT robot moving forward along an arc with a specified radius.voidbackward()Deprecated.Starts the NXT robot moving backward.voidforward()Deprecated.Starts the NXT robot moving forward.floatgetAngleIncrement()Deprecated.doublegetAngularAcceleration()Deprecated.Returns the acceleration at which the robot accelerates at the start of a move and decelerates at the end of a move.doublegetAngularSpeed()Deprecated.Returns the value of the rotation speeddoublegetLinearAcceleration()Deprecated.Returns the acceleration at which the robot accelerates at the start of a move and decelerates at the end of a move.doublegetLinearSpeed()Deprecated.Returns the speed at which the robot will travel forward and backward (and to some extent arcs, although actual arc speed is slightly less).doublegetMaxAngularSpeed()Deprecated.returns the maximum value of the rotation speed;doublegetMaxLinearSpeed()Deprecated.Returns the maximum speed at which this robot is capable of traveling forward and backward.floatgetMaxRotateSpeed()Deprecated.doublegetMinRadius()Deprecated.The minimum steering radius this vehicle is capable of when traveling in an arc.MovegetMovement()Deprecated.Returns the move made since the move started, but before it has completed.floatgetMovementIncrement()Deprecated.doublegetTurnRate()Deprecated.Get the turn rate for arc and steer commandsbooleanisMoving()Deprecated.true if the robot is movingbooleanisStalled()Deprecated.protected voidmovementActive()Deprecated.Called to indicate that the motors are now running and should be monitored for movement.protected voidmovementStart()Deprecated.called at start of a movement to inform the listeners that a movement has started.voidquickStop()Deprecated.Stops the robot almost immediately.voidreset()Deprecated.Resets tacho count for both motors.voidrotate(double angle)Deprecated.Rotates the NXT robot through a specific angle.voidrotate(double angle, boolean immediateReturn)Deprecated.Rotates the NXT robot through a specific angle.voidrotateLeft()Deprecated.voidrotateRight()Deprecated.voidsetAngularAcceleration(double acceleration)Deprecated.Sets the acceleration at which the robot will accelerate at the start of a move and decelerate at the end of a move.voidsetAngularSpeed(double rotateSpeed)Deprecated.sets the rotation speed of the vehicle, degrees per secondvoidsetLinearAcceleration(double acceleration)Deprecated.Sets the acceleration at which the robot will accelerate at the start of a move and decelerate at the end of a move.voidsetLinearSpeed(double travelSpeed)Deprecated.set travel speed in wheel diameter units per secondvoidsetMinRadius(double radius)Deprecated.Set the radius of the minimum turning circle.voidsteer(double turnRate)Deprecated.Starts the robot moving forward along a curved path.voidsteer(double turnRate, double angle)Deprecated.Moves the robot along a curved path through a specified turn angle.voidsteer(double turnRate, double angle, boolean immediateReturn)Deprecated.Moves the robot along a curved path for a specified angle of rotation.voidsteerBackward(double turnRate)Deprecated.Starts the robot moving backward along a curved path.voidstop()Deprecated.Stops the NXT robot.voidtravel(double 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.voidtravel(double 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.voidtravelArc(double radius, double distance)Deprecated.Moves the NXT robot a specified distance along an arc of specified radius, after which the robot stops moving.voidtravelArc(double radius, double distance, boolean immediateReturn)Deprecated.Moves the NXT robot a specified distance along an arc of specified radius, after which the robot stops moving.
-
-
-
Field Detail
-
_left
protected final RegulatedMotor _left
Deprecated.Left motor..
-
_right
protected final RegulatedMotor _right
Deprecated.Right motor.
-
_outside
protected RegulatedMotor _outside
Deprecated.The motor at the outside of the turn. set by steer(turnRate) used by other steer methodsl
-
_leftDegPerDistance
protected final float _leftDegPerDistance
Deprecated.Left motor degrees per unit of travel.
-
_rightDegPerDistance
protected final float _rightDegPerDistance
Deprecated.Right motor degrees per unit of travel.
-
_type
protected Move.MoveType _type
Deprecated.
-
-
Constructor Detail
-
DifferentialPilot
public DifferentialPilot(double wheelDiameter, double trackWidth, RegulatedMotor leftMotor, RegulatedMotor rightMotor)Deprecated.Allocates a DifferentialPilot object, and sets the physical parameters of the NXT robot.
Assumes Motor.forward() causes the robot to move forward.- Parameters:
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).
-
DifferentialPilot
public DifferentialPilot(double wheelDiameter, double trackWidth, RegulatedMotor leftMotor, RegulatedMotor rightMotor, boolean reverse)Deprecated.Allocates a DifferentialPilot object, and sets the physical parameters of the NXT robot.- Parameters:
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.
-
DifferentialPilot
public DifferentialPilot(double leftWheelDiameter, double rightWheelDiameter, double trackWidth, RegulatedMotor leftMotor, RegulatedMotor rightMotor, boolean reverse)Deprecated.Allocates a DifferentialPilot object, and sets the physical parameters of the NXT robot.- Parameters:
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/(moveSpeed*360). Thus for a moveSpeed 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
-
setLinearSpeed
public void setLinearSpeed(double travelSpeed)
Deprecated.set travel speed in wheel diameter units per second- Specified by:
setLinearSpeedin interfaceMoveController- Parameters:
travelSpeed- : speed in distance (wheel diameter)units/sec
-
getLinearSpeed
public double getLinearSpeed()
Deprecated.Description copied from interface:MoveControllerReturns 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:
getLinearSpeedin interfaceMoveController- Returns:
- Speed in chosen units per second (e.g. cm/sec)
-
setLinearAcceleration
public void setLinearAcceleration(double acceleration)
Deprecated.Description copied from interface:MoveControllerSets 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:
setLinearAccelerationin interfaceMoveController- Parameters:
acceleration- in chosen units/second^2
-
getLinearAcceleration
public double getLinearAcceleration()
Deprecated.Description copied from interface:MoveControllerReturns the acceleration at which the robot accelerates at the start of a move and decelerates at the end of a move.- Specified by:
getLinearAccelerationin interfaceMoveController- Returns:
- acceleration in chosen units/second^2
-
getMaxLinearSpeed
public double getMaxLinearSpeed()
Deprecated.Description copied from interface:MoveControllerReturns 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:
getMaxLinearSpeedin interfaceMoveController- Returns:
- Speed in chosen units per second (e.g. cm/sec)
-
setAngularSpeed
public void setAngularSpeed(double rotateSpeed)
Deprecated.sets the rotation speed of the vehicle, degrees per second- Specified by:
setAngularSpeedin interfaceRotateMoveController- Parameters:
rotateSpeed-
-
getAngularSpeed
public double getAngularSpeed()
Deprecated.Description copied from interface:RotateMoveControllerReturns the value of the rotation speed- Specified by:
getAngularSpeedin interfaceRotateMoveController- Returns:
- the rotate speed in degrees per second
-
getMaxRotateSpeed
public float getMaxRotateSpeed()
Deprecated.
-
getMaxAngularSpeed
public double getMaxAngularSpeed()
Deprecated.Description copied from interface:RotateMoveControllerreturns the maximum value of the rotation speed;- Specified by:
getMaxAngularSpeedin interfaceRotateMoveController- Returns:
- max rotation speed
-
forward
public void forward()
Deprecated.Starts the NXT robot moving forward.- Specified by:
forwardin interfaceMoveController
-
backward
public void backward()
Deprecated.Starts the NXT robot moving backward.- Specified by:
backwardin interfaceMoveController
-
rotateLeft
public void rotateLeft()
Deprecated.- Specified by:
rotateLeftin interfaceRotateMoveController
-
rotateRight
public void rotateRight()
Deprecated.- Specified by:
rotateRightin interfaceRotateMoveController
-
rotate
public void rotate(double angle)
Deprecated.Rotates the NXT robot through a specific angle. Returns when angle is reached. Wheels turn in opposite directions producing a zero radius turn.
Note: Requires correct values for wheel diameter and track width. calls rotate(angle,false)- Specified by:
rotatein interfaceRotateMoveController- Parameters:
angle- The wanted angle of rotation in degrees. Positive angle rotate left (anti-clockwise), negative right.
-
rotate
public void rotate(double angle, boolean immediateReturn)Deprecated.Rotates the NXT robot through a specific angle. Returns when angle is reached. Wheels turn in opposite directions producing a zero radius turn.
Note: Requires correct values for wheel diameter and track width. Side effect: inform listeners- Specified by:
rotatein interfaceRotateMoveController- Parameters:
angle- The wanted angle of rotation in degrees. Positive angle rotate left (anti-clockwise), negative right.immediateReturn- If true this method returns immediately.
-
stop
public void stop()
Deprecated.Stops the NXT robot. side effect: inform listeners of end of movement- Specified by:
stopin interfaceMoveController
-
quickStop
public void quickStop()
Deprecated.Stops the robot almost immediately. Use this method if the normalstop()is too slow;
-
travel
public void travel(double 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. If a drift correction has been specified in the constructor it will be applied to the left motor. calls travel(distance, false)- Specified by:
travelin interfaceMoveController- Parameters:
distance- The distance to move. Unit of measure for distance must be same as wheelDiameter and trackWidth.
-
travel
public void travel(double 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. If a drift correction has been specified in the constructor it will be applied to the left motor.- Specified by:
travelin interfaceMoveController- Parameters:
distance- The distance to move. Unit of measure for distance must be same as wheelDiameter and trackWidth.immediateReturn- If true this method returns immediately.
-
arcForward
public void arcForward(double radius)
Deprecated.Description copied from interface:ArcMoveControllerStarts the NXT robot moving forward along an arc with a specified radius.If
radiusis positive, the robot arcs left, and the center of the turning circle is on the left side of the robot.
Ifradiusis negative, the robot arcs right, and the center of the turning circle is on the right side of the robot.
Ifradiusis 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:
arcForwardin interfaceArcMoveController- 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)
Deprecated.Description copied from interface:ArcMoveControllerStarts the NXT robot moving backward along an arc with a specified radius.If
radiusis positive, the robot arcs left, and the center of the turning circle is on the left side of the robot.
Ifradiusis negative, the robot arcs right, and the center of the turning circle is on the right side of the robot.
Ifradiusis 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:
arcBackwardin interfaceArcMoveController- 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)Deprecated.Description copied from interface:ArcMoveControllerMoves 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 movingangledegrees along the arc.If
radiusis positive, the robot arcs left, and the center of the turning circle is on the left side of the robot.
Ifradiusis negative, the robot arcs right, and the center of the turning circle is on the right side of the robot.
Ifradiusis zero, is zero, the robot rotates in place.Robot will stop when the degrees it has moved along the arc equals
angle.
Ifangleis positive, the robot will turn to the left (anti-clockwise).
Ifangleis negative, the robot will turn to the right (clockwise). Ifangleis 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:
arcin interfaceArcMoveController- 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)
-
arc
public void arc(double radius, double angle, boolean immediateReturn)Deprecated.Description copied from interface:ArcMoveControllerMoves 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 theimmediateReturnparameter.If
radiusis positive, the robot arcs left, and the center of the turning circle is on the left side of the robot.
Ifradiusis negative, the robot arcs right, and the center of the turning circle is on the right side of the robot.
Ifradiusis zero, is zero, the robot rotates in place.The robot will stop when the degrees it has moved along the arc equals
angle.
Ifangleis positive, the robot will turn to the left (anti-clockwise).
Ifangleis negative, the robot will turn to the right (clockwise). Ifangleis 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:
arcin interfaceArcMoveController- 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)Deprecated.Description copied from interface:ArcMoveControllerMoves 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 movingdistancealong the arc. The units (inches, cm) fordistancemust be the same as the units used forradius.If
radiusis positive, the robot arcs left, and the center of the turning circle is on the left side of the robot.
Ifradiusis negative, the robot arcs right, and the center of the turning circle is on the right side of the robot.
Ifradiusis zero, the robot rotates in placeThe robot will stop when it has moved along the arc
distanceunits.
Ifdistanceis positive, the robot will move travel forwards.
Ifdistanceis negative, the robot will move travel backwards.
Ifdistanceis zero, the robot will not move and the method returns immediately.Postcondition: Motor speeds are unpredictable.
- Specified by:
travelArcin interfaceArcMoveController- 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 asradius. 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)
-
travelArc
public void travelArc(double radius, double distance, boolean immediateReturn)Deprecated.Description copied from interface:ArcMoveControllerMoves 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 theimmediateReturnparameter. The units (inches, cm) fordistanceshould be the same as the units used forradius.If
radiusis positive, the robot arcs left, and the center of the turning circle is on the left side of the robot.
Ifradiusis negative, the robot arcs right, and the center of the turning circle is on the right side of the robot.
Ifradiusis zero, the robot rotates in place.The robot will stop when it has moved along the arc
distanceunits.
Ifdistanceis positive, the robot will move travel forwards.
Ifdistanceis negative, the robot will move travel backwards.
Ifdistanceis zero, the robot will not move and the method returns immediately.Postcondition: Motor speeds are unpredictable.
- Specified by:
travelArcin interfaceArcMoveController- 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 asradius. 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)
-
steer
public void steer(double turnRate)
Deprecated.Starts the robot moving forward along a curved path. This method is similar to thearcForward(double radius )method except it uses theturnRateparameter do determine the curvature of the path and therefore has the ability to drive straight. This makes it useful for line following applications.The
turnRatespecifies the sharpness of the turn. Use values between -200 and +200.
A positive value means that center of the turn is on the left. If the robot is traveling toward the top of the page the arc looks like this: ).
A negative value means that center of the turn is on the right so the arc looks this: (.
. In this class, this parameter 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 of how the formula works:steer(0)-> inner and outer wheels turn at the same speed, travel straightsteer(25)-> the inner wheel turns at 75% of the speed of the outer wheel, turn leftsteer(100)-> the inner wheel stops and the outer wheel is at 100 percent, turn leftsteer(200)-> the inner wheel turns at the same speed as the outer wheel - a zero radius turn.
Note: If you have specified a drift correction in the constructor it will not be applied in this method.
- Specified by:
steerin interfaceLineFollowingMoveController- Parameters:
turnRate- If positive, the left side of the robot is on the inside of the turn. If negative, the left side is on the outside.
-
steerBackward
public void steerBackward(double turnRate)
Deprecated.Starts the robot moving backward along a curved path. This method is essentially the same assteer(double)except that the robot moves backward instead of forward.- Specified by:
steerBackwardin interfaceLineFollowingMoveController- Parameters:
turnRate-
-
steer
public void steer(double turnRate, double angle)Deprecated.Moves the robot along a curved path through a specified turn angle. This method is similar to thearc(double radius , double angle)method except it uses a ratio of motor speeds to determine the curvature of the path and therefore has the ability to drive straight. This makes it useful for line following applications. This method does not return until the robot has completed movingangledegrees along the arc.
TheturnRatespecifies the sharpness of the turn. Use values between -200 and +200.
For details about how this parameter works.Seesteer(double turnRate)The robot will stop when its heading has changed by the amount of the
angleparameter.
Ifangleis positive, the robot will move in the direction that increases its heading (it turns left).
Ifangleis negative, the robot will move in the directin that decreases its heading (turns right).
Ifangleis zero, the robot will not move and the method returns immediately.The sign of the turn rate and the sign of the angle together determine if the robot will move forward or backward. Assuming the robot is heading toward the top of the page. Then a positive turn rate means the arc looks like this: ) . If the angle is positive, the robot moves forward to increase its heading angle. If negative, it moves backward to decrease the heading.
But if the turn rate is negative, the arc looks like this: ( .So a positive angle (increase in heading) means the robot moves backwards, while a negative angle means the robot moves forward to decrease its heading.Note: If you have specified a drift correction in the constructor it will not be applied in this method.
- Parameters:
turnRate- If positive, the left side of the robot is on the inside of the turn. If negative, the left side is on the outside.angle- The angle through which the robot will rotate. If negative, the robot will move in the directin that decreases its heading.
-
steer
public void steer(double turnRate, double angle, boolean immediateReturn)Deprecated.Moves the robot along a curved path for a specified angle of rotation. This method is similar to thearc(double radius, double angle, boolean immediateReturn)method except it uses theturnRate()parameter to determine the curvature of the path and therefore has the ability to drive straight. This makes it useful for line following applications. This method has the ability to return immediately by using theimmediateReturnparameter set to true.The
turnRatespecifies the sharpness of the turn. Use values between -200 and +200.
For details about how this parameter works, seesteer(double turnRate)The robot will stop when its heading has changed by the amount of the
angleparameter.
Ifangleis positive, the robot will move in the direction that increases its heading (it turns left).
Ifangleis negative, the robot will move in the direction that decreases its heading (turns right).
Ifangleis zero, the robot will not move and the method returns immediately.
For more details about this parameter, seesteer(double turnRate, double angle)Note: If you have specified a drift correction in the constructor it will not be applied in this method.
- Parameters:
turnRate- If positive, the left side of the robot is on the inside of the turn. If negative, the left side 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.
-
movementStart
protected void movementStart()
Deprecated.called at start of a movement to inform the listeners that a movement has started. Must be called before the motors start to move to capture the correct positional information
-
movementActive
protected void movementActive()
Deprecated.Called to indicate that the motors are now running and should be monitored for movement. Must be called after the motors are started.
-
isMoving
public boolean isMoving()
Deprecated.Description copied from interface:MoveControllertrue if the robot is moving- Specified by:
isMovingin interfaceMoveController- Returns:
- true if the NXT robot is moving.
-
isStalled
public boolean isStalled()
Deprecated.
-
reset
public void reset()
Deprecated.Resets tacho count for both motors.
-
setMinRadius
public void setMinRadius(double radius)
Deprecated.Set the radius of the minimum turning circle. Note: A DifferentialPilot robot can simulate a SteeringPilot robot by calling DifferentialPilot.setMinRadius() and setting the value to something greater than zero (example: 15 cm).- Specified by:
setMinRadiusin interfaceArcMoveController- Parameters:
radius- in degrees
-
getMinRadius
public double getMinRadius()
Deprecated.Description copied from interface:ArcMoveControllerThe 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:
getMinRadiusin interfaceArcMoveController- Returns:
- the radius in degrees
-
getMovementIncrement
public float getMovementIncrement()
Deprecated.- Returns:
- The move distance since it last started moving
-
getAngleIncrement
public float getAngleIncrement()
Deprecated.- Returns:
- The angle rotated since rotation began.
-
addMoveListener
public void addMoveListener(MoveListener m)
Deprecated.Description copied from interface:MoveProviderAdds a MoveListener that will be notified of all movement events.- Specified by:
addMoveListenerin interfaceMoveProvider- Parameters:
m- the move listener
-
getMovement
public Move getMovement()
Deprecated.Description copied from interface:MoveProviderReturns 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:
getMovementin interfaceMoveProvider- Returns:
- The move made since the move started.
-
getTurnRate
public double getTurnRate()
Deprecated.Get the turn rate for arc and steer commands- Returns:
- the turn rate
-
setAngularAcceleration
public void setAngularAcceleration(double acceleration)
Deprecated.Description copied from interface:RotateMoveControllerSets 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:
setAngularAccelerationin interfaceRotateMoveController- Parameters:
acceleration- in chosen units/second^2
-
getAngularAcceleration
public double getAngularAcceleration()
Deprecated.Description copied from interface:RotateMoveControllerReturns the acceleration at which the robot accelerates at the start of a move and decelerates at the end of a move.- Specified by:
getAngularAccelerationin interfaceRotateMoveController- Returns:
- acceleration in chosen units/second^2
-
-