MovePilot
instead.@Deprecated public class OmniPilot extends java.lang.Object implements ArcRotateMoveController, RegulatedMotorListener
Use the OmniPilot class to control holonomic vehicles with three omnidirectional wheels that allow the robot to move in any direction without changing heading. The robot can also spin while driving straight, and perform any kind of maneuvre the other steering and differential drive vehicles can do. The odometry is computed by this class directly. For the class to work properly, take care to design the robot symmetrically, so that the three wheel axes meet in the center of the robot.
WHEEL_SIZE_EV3, WHEEL_SIZE_NXT1, WHEEL_SIZE_NXT2, WHEEL_SIZE_RCX
Constructor and Description |
---|
OmniPilot(float wheelDistanceFromCenter,
float wheelDiameter,
RegulatedMotor centralMotor,
RegulatedMotor CW120degMotor,
RegulatedMotor CCW120degMotor,
boolean centralWheelFrontal,
boolean motorReverse,
Power battery)
Deprecated.
Instantiates a new omnidirectional pilot.
|
OmniPilot(float wheelDistanceFromCenter,
float wheelDiameter,
RegulatedMotor centralMotor,
RegulatedMotor CW120degMotor,
RegulatedMotor CCW120degMotor,
boolean centralWheelFrontal,
boolean motorReverse,
Power battery,
Gyroscope gyro)
Deprecated.
Instantiates a new omnidirectional pilot.
|
Modifier and Type | Method and Description |
---|---|
void |
addMoveListener(MoveListener listener)
Deprecated.
Adds a MoveListener that will be notified of all movement events.
|
void |
arc(double radius,
double angle)
Deprecated.
Moves the NXT robot along an arc with a specified radius and angle,
after which the robot stops moving.
|
void |
arc(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.
|
void |
arc(double radius,
double angle,
double direction)
Deprecated.
This method moves the robot in an arc, similar to the other
arc(double, double) methods,
except you can choose any of the 360 degree directions relative to the current heading (0) of the robot, while keeping
the heading of the robot pointed in the same direction during the move. |
void |
arc(double radius,
double angle,
double direction,
boolean immediateReturn)
Deprecated.
This method moves the robot in an arc, similar to the other
arc(double, double) methods,
except you can choose any of the 360 degree directions relative to the current heading (0) of the robot, while keeping
the heading of the robot pointed in the same direction during the move. |
void |
arcBackward(double radius)
Deprecated.
Starts the NXT robot moving backward along an arc with a specified radius.
|
void |
arcForward(double radius)
Deprecated.
Starts the NXT robot moving forward along an arc with a specified radius.
|
void |
backward()
Deprecated.
Starts the NXT robot moving backwards.
|
void |
forward()
Deprecated.
Starts the NXT robot moving forward.
|
double |
getAngularAcceleration()
Deprecated.
Returns the acceleration at which the robot accelerates at the start of a move and decelerates at the end of a move.
|
double |
getAngularSpeed()
Deprecated.
Returns the value of the rotation speed
|
double |
getLinearAcceleration()
Deprecated.
Returns the acceleration at which the robot accelerates at the start of a move and decelerates at the end of a move.
|
double |
getLinearSpeed()
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).
|
double |
getMaxAngularSpeed()
Deprecated.
returns the maximum value of the rotation speed;
|
double |
getMaxLinearSpeed()
Deprecated.
Returns the maximum speed at which this robot is capable of traveling forward and backward.
|
double |
getMinRadius()
Deprecated.
The minimum steering radius this vehicle is capable of when traveling in an arc.
|
float |
getMoveDirection()
Deprecated.
Gets the move direction.
|
Move |
getMovement()
Deprecated.
Returns the move made since the move started, but before it has completed.
|
boolean |
isMoving()
Deprecated.
true if the robot is moving
|
void |
moveStraight(float linSpeed,
int direction)
Deprecated.
This method causes the robot to move in a direction while keeping the front of the robot pointed in the current direction it is facing.
|
void |
reset()
Deprecated.
Reset all tacho counts.
|
void |
rotate(double angle)
Deprecated.
Rotates the NXT robot the specified number of degrees; direction determined by the sign of the parameter.
|
void |
rotate(double angle,
boolean immediateReturn)
Deprecated.
Rotates the NXT robot the specified number of degrees; direction determined by the sign of the parameter.
|
void |
rotateLeft()
Deprecated.
|
void |
rotateRight()
Deprecated.
|
void |
rotationStarted(RegulatedMotor motor,
int tachoCount,
boolean stalled,
long timeStamp)
Deprecated.
Called when the motor starts rotating.
|
void |
rotationStopped(RegulatedMotor motor,
int tachoCount,
boolean stalled,
long timeStamp)
Deprecated.
Notify the MoveListeners when a move is completed.
|
void |
setAngularAcceleration(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.
|
void |
setAngularSpeed(double speed)
Deprecated.
sets the rotation speed of the robot (the angular velocity of the rotate()
methods)
|
void |
setLinearAcceleration(double accel)
Deprecated.
Sets the acceleration at which the robot will accelerate at the start of a move and decelerate at the end of a move.
|
void |
setLinearSpeed(double speed)
Deprecated.
Sets the speed at which the robot will travel forward and backward (and to some extent arcs, although actual arc speed
is slightly less).
|
void |
setMinRadius(double radius)
Deprecated.
Set the radius of the minimum turning circle.
|
void |
setMoveDirection(int dir)
Deprecated.
Sets the move direction.
|
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 |
spinningMove(float linSpeed,
int angSpeed,
int direction)
Deprecated.
Causes the robot to spin while moving along a linear path.
|
void |
steer(float turnRate)
Deprecated.
Steer.
|
void |
steer(float linSpeed,
float angSpeed)
Deprecated.
Steer.
|
void |
steer(float turnRate,
float angle,
boolean immediateReturn)
Deprecated.
Steer.
|
void |
stop()
Deprecated.
Halts the NXT robot
|
void |
travel(double distance)
Deprecated.
Moves the NXT robot a specific distance.
|
void |
travel(double distance,
boolean immediateReturn)
Deprecated.
Moves the NXT robot a specific distance.
|
void |
travel(double distance,
double direction)
Deprecated.
This method causes the robot to travel in a linear path, similar to other travel() methods, except you can specify
which direction to move (relative to the current robot heading).
|
void |
travel(double distance,
double direction,
boolean immediateReturn)
Deprecated.
This method causes the robot to travel in a linear path, similar to other travel() methods, except you can specify
which direction to move (relative to the current robot heading).
|
void |
travelArc(double radius,
double distance)
Deprecated.
Moves the NXT robot a specified distance along an arc of specified radius,
after which the robot stops moving.
|
void |
travelArc(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.
|
void |
travelArc(double radius,
double distance,
float direction)
Deprecated.
This method moves the robot in an arc, similar to the other
travelArc(double, double) methods,
except you can choose any of the 360 degree directions relative to the current heading (0) of the robot, while keeping
the heading of the robot pointed in the same direction during the move. |
void |
travelArc(double radius,
double distance,
float direction,
boolean immediateReturn)
Deprecated.
This method moves the robot in an arc, similar to the other
travelArc(double, double) methods,
except you can choose any of the 360 degree directions relative to the current heading (0) of the robot, while keeping
the heading of the robot pointed in the same direction during the move. |
public OmniPilot(float wheelDistanceFromCenter, float wheelDiameter, RegulatedMotor centralMotor, RegulatedMotor CW120degMotor, RegulatedMotor CCW120degMotor, boolean centralWheelFrontal, boolean motorReverse, Power battery)
wheelDistanceFromCenter
- the wheel distance from centerwheelDiameter
- the wheel diametercentralMotor
- the central motorCW120degMotor
- the motor at 120 degrees clockwise from frontCCW120degMotor
- the motor at 120 degrees counter-clockwise from frontcentralWheelFrontal
- if true, the central wheel frontal else it is facing backmotorReverse
- if motors are mounted reversedpublic OmniPilot(float wheelDistanceFromCenter, float wheelDiameter, RegulatedMotor centralMotor, RegulatedMotor CW120degMotor, RegulatedMotor CCW120degMotor, boolean centralWheelFrontal, boolean motorReverse, Power battery, Gyroscope gyro)
wheelDistanceFromCenter
- the wheel distance from centerwheelDiameter
- the wheel diametercentralMotor
- the central motorCW120degMotor
- the motor at 120 degrees clockwise from frontCCW120degMotor
- the motor at 120 degrees counter-clockwise from frontcentralWheelFrontal
- if true, the central wheel frontal else it is facing backmotorReverse
- if motors are mounted reversedgyro
- the gyroscopepublic void setLinearAcceleration(double accel)
MoveController
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.
setLinearAcceleration
in interface MoveController
accel
- in chosen units/second^2public double getLinearAcceleration()
MoveController
getLinearAcceleration
in interface MoveController
public void forward()
MoveController
forward
in interface MoveController
public void backward()
MoveController
backward
in interface MoveController
public void moveStraight(float linSpeed, int direction)
linSpeed
- the lin speeddirection
- the direction relative to the current direction the robot is facingpublic void spinningMove(float linSpeed, int angSpeed, int direction)
moveStraight(float, int)
except the robot will spin instead of holding the robot in the current direction.linSpeed
- the linear speed [units/s]angSpeed
- the angular speed [deg/s]direction
- the direction [deg]public void stop()
MoveController
stop
in interface MoveController
public boolean isMoving()
MoveController
isMoving
in interface MoveController
public void setLinearSpeed(double speed)
MoveController
setLinearSpeed
in interface MoveController
speed
- In chosen units per second (e.g. cm/sec)public double getLinearSpeed()
MoveController
getLinearSpeed
in interface MoveController
public void setMoveDirection(int dir)
steer(float)
(all three overloaded methods).dir
- the new move directionpublic float getMoveDirection()
public double getMaxLinearSpeed()
MoveController
getMaxLinearSpeed
in interface MoveController
public void setAngularSpeed(double speed)
RotateMoveController
setAngularSpeed
in interface RotateMoveController
speed
- in degrees per secondpublic double getAngularSpeed()
RotateMoveController
getAngularSpeed
in interface RotateMoveController
public double getMaxAngularSpeed()
RotateMoveController
getMaxAngularSpeed
in interface RotateMoveController
public void travel(double distance)
MoveController
travel
in interface MoveController
distance
- The positive or negative distance to move the robot.public void travel(double distance, double direction)
distance
- direction
- public void travel(double distance, boolean immediateReturn)
MoveController
travel
in interface MoveController
distance
- The positive or negative distance to move the robot, in wheel diameter units.immediateReturn
- If immediateReturn is true then the method returns immediately.public void travel(double distance, double direction, boolean immediateReturn)
distance
- direction
- immediateReturn
- public void rotate(double angle)
RotateMoveController
rotate
in interface RotateMoveController
angle
- The angle to rotate in degrees. A positive value rotates left, a negative value right (clockwise).public void rotate(double angle, boolean immediateReturn)
RotateMoveController
rotate
in interface RotateMoveController
angle
- The angle to rotate in degrees. A positive value rotates left, a negative value right (clockwise).immediateReturn
- If true, method returns immediately, otherwise blocks until rotation is complete.public void steer(float turnRate)
turnRate
- the turn ratepublic void steer(float linSpeed, float angSpeed)
linSpeed
- the lin speedangSpeed
- the ang speedpublic void steer(float turnRate, float angle, boolean immediateReturn)
turnRate
- the turn rateangle
- the angleimmediateReturn
- the immediate returnpublic void travelArc(double radius, double distance)
ArcMoveController
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.
travelArc
in interface ArcMoveController
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.ArcMoveController.arc(double, double)
public void travelArc(double radius, double distance, boolean immediateReturn)
ArcMoveController
immediateReturn
parameter.
The units (inches, cm) for distance
should 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.
travelArc
in interface ArcMoveController
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.ArcMoveController.arc(double, double, boolean)
public void travelArc(double radius, double distance, float direction)
travelArc(double, double)
methods,
except you can choose any of the 360 degree directions relative to the current heading (0) of the robot, while keeping
the heading of the robot pointed in the same direction during the move.
NOTE: This method is not part of the MoveController interface.radius
- distance
- direction
- public void travelArc(double radius, double distance, float direction, boolean immediateReturn)
travelArc(double, double)
methods,
except you can choose any of the 360 degree directions relative to the current heading (0) of the robot, while keeping
the heading of the robot pointed in the same direction during the move.
NOTE: This method is not part of the MoveController interface.radius
- distance
- direction
- immediateReturn
- public void arc(double radius, double angle)
ArcMoveController
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 turn to the left (anti-clockwise).
If angle
is negative, the robot will turn to the right (clockwise).
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.
arc
in interface ArcMoveController
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.ArcMoveController.travelArc(double, double)
public void arc(double radius, double angle, double direction)
arc(double, double)
methods,
except you can choose any of the 360 degree directions relative to the current heading (0) of the robot, while keeping
the heading of the robot pointed in the same direction during the move.
NOTE: This method is not part of the MoveController interface.radius
- angle
- direction
- public void arc(double radius, double angle, boolean immediateReturn)
ArcMoveController
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 turn to the left (anti-clockwise).
If angle
is negative, the robot will turn to the right (clockwise).
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.
arc
in interface ArcMoveController
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.ArcMoveController.travelArc(double, double, boolean)
public void arc(double radius, double angle, double direction, boolean immediateReturn)
arc(double, double)
methods,
except you can choose any of the 360 degree directions relative to the current heading (0) of the robot, while keeping
the heading of the robot pointed in the same direction during the move.
NOTE: This method is not part of the MoveController interface.radius
- angle
- direction
- immediateReturn
- public void reset()
@Deprecated public void setSpeed(int speed)
speed
- the new speedpublic void arcBackward(double radius)
ArcMoveController
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.
arcBackward
in interface ArcMoveController
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.public void arcForward(double radius)
ArcMoveController
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.
arcForward
in interface ArcMoveController
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.public double getMinRadius()
ArcMoveController
getMinRadius
in interface ArcMoveController
public void setMinRadius(double radius)
ArcMoveController
setMinRadius
in interface ArcMoveController
radius
- the radius in degreespublic void addMoveListener(MoveListener listener)
MoveProvider
addMoveListener
in interface MoveProvider
listener
- the move listenerpublic Move getMovement()
MoveProvider
getMovement
in interface MoveProvider
public void rotationStarted(RegulatedMotor motor, int tachoCount, boolean stalled, long timeStamp)
RegulatedMotorListener
rotationStarted
in interface RegulatedMotorListener
public void rotationStopped(RegulatedMotor motor, int tachoCount, boolean stalled, long timeStamp)
rotationStopped
in interface RegulatedMotorListener
public void rotateRight()
rotateRight
in interface RotateMoveController
public void rotateLeft()
rotateLeft
in interface RotateMoveController
public void setAngularAcceleration(double acceleration)
RotateMoveController
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.
setAngularAcceleration
in interface RotateMoveController
acceleration
- in chosen units/second^2public double getAngularAcceleration()
RotateMoveController
getAngularAcceleration
in interface RotateMoveController