|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object lejos.navigation.TachoPilot lejos.navigation.CompassPilot
public class CompassPilot
A Pilot that keeps track of direction using a CompassSensor.
Field Summary | |
---|---|
int |
_angle0
|
protected CompassSensor |
compass
|
Fields inherited from class lejos.navigation.TachoPilot |
---|
_left, _leftDegPerDistance, _leftTurnRatio, _leftWheelDiameter, _motorSpeed, _right, _rightDegPerDistance, _rightTurnRatio, _rightWheelDiameter, _robotMoveSpeed, _robotTurnSpeed, _trackWidth |
Constructor Summary | |
---|---|
CompassPilot(CompassSensor compass,
float wheelDiameter,
float trackWidth,
Motor leftMotor,
Motor rightMotor)
Allocates a CompasPilot object, and sets the physical parameters of the NXT robot. |
|
CompassPilot(CompassSensor compass,
float wheelDiameter,
float trackWidth,
Motor leftMotor,
Motor rightMotor,
boolean reverse)
Allocates a CompasPilot object, and sets the physical parameters of the NXT robot. |
|
CompassPilot(SensorPort compassPort,
float wheelDiameter,
float trackWidth,
Motor leftMotor,
Motor rightMotor)
Allocates a CompasPilot object, and sets the physical parameters of the NXT robot. |
|
CompassPilot(SensorPort compassPort,
float wheelDiameter,
float trackWidth,
Motor leftMotor,
Motor rightMotor,
boolean reverse)
Allocates a CompasPilot object, and sets the physical parameters of the NXT robot. |
Method Summary | |
---|---|
void |
calibrate()
Rotates the robot 360 degrees while calibrating the compass resets compass zero to heading at end of calibration |
float |
getAngle()
Returns the compass angle in degrees, Cartesian (increasing counter clockwise) i.e. |
CompassSensor |
getCompass()
return the compass |
int |
getCompassHeading()
returns current compass heading |
int |
getHeading()
Returns direction of desired robot facing |
boolean |
isMoving()
returns TRUE if robot is moving |
boolean |
isRotating()
returns true if robot is rotating to a specific direction |
boolean |
isTraveling()
returns returns true if the robot is travelling for a specific distance; |
void |
reset()
Resets tacho count for both motors. |
void |
resetCartesianZero()
|
void |
rotate(float angle)
Rotates the NXT robot through a specific angle; Rotates left if angle is positive, right if negative, Returns when angle is reached. |
void |
rotate(float angle,
boolean immediateReturn)
robot rotates to the specified compass heading; |
void |
rotateTo(float angle)
robot rotates to the specified compass heading; |
void |
rotateTo(float angle,
boolean immediateReturn)
robot rotates to the specified compass heading; |
void |
setHeading(int angle)
sets direction of desired robot facing in degrees |
void |
travel(float distance)
Moves the NXT robot a specific distance; A positive distance causes forward motion; negative distance moves backward. |
void |
travel(float distance,
boolean immediateReturn)
Moves the NXT robot a specific distance. |
Methods inherited from class lejos.navigation.TachoPilot |
---|
backward, forward, getLeft, getLeftActualSpeed, getLeftCount, getMoveMaxSpeed, getMoveSpeed, getRight, getRightActualSpeed, getRightCount, getTravelDistance, getTurnMaxSpeed, getTurnRatio, getTurnSpeed, regulateSpeed, setMoveSpeed, setSpeed, setTurnSpeed, stalled, steer, steer, steer, stop, turn, turn, turn |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected CompassSensor compass
public int _angle0
Constructor Detail |
---|
public CompassPilot(SensorPort compassPort, float wheelDiameter, float trackWidth, Motor leftMotor, Motor rightMotor)
compassPort
- the sensor port connected to the CompassSensor e.g. SensorPort.S1wheelDiameter
- Diameter of the tire, in any convenient units. (The 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 wheelDiameterleftMotor
- rightMotor
- public CompassPilot(SensorPort compassPort, float wheelDiameter, float trackWidth, Motor leftMotor, Motor rightMotor, boolean reverse)
compassPort
- : the compass sensor is connected to this port;wheelDiameter
- Diameter of the tire, in any convenient units. (The 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 wheelDiameterleftMotor
- rightMotor
- reverse
- if true of motor.forward() drives the robot backwardspublic CompassPilot(CompassSensor compass, float wheelDiameter, float trackWidth, Motor leftMotor, Motor rightMotor)
compass
- : a compass sensor;wheelDiameter
- Diameter of the tire, in any convenient units. (The 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 wheelDiameterleftMotor
- rightMotor
- public CompassPilot(CompassSensor compass, float wheelDiameter, float trackWidth, Motor leftMotor, Motor rightMotor, boolean reverse)
compass
- : a compass sensor;wheelDiameter
- Diameter of the tire, in any convenient units. (The 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 wheelDiameterleftMotor
- rightMotor
- reverse
- if true of motor.forward() drives the robot backwardsMethod Detail |
---|
public boolean isRotating()
public boolean isTraveling()
public CompassSensor getCompass()
public float getAngle()
getAngle
in interface Pilot
getAngle
in class TachoPilot
public int getHeading()
public int getCompassHeading()
public void setHeading(int angle)
public void calibrate()
public void resetCartesianZero()
public void travel(float distance, boolean immediateReturn)
travel
in interface Pilot
travel
in class TachoPilot
distance
- The positive or negative distance to move the robot, same units as _wheelDiameterimmediateReturn
- iff true, the method returns immediately.public void travel(float distance)
travel
in interface Pilot
travel
in class TachoPilot
distance
- of robot movement. Unit of measure for distance must be same as wheelDiameter and trackWidthpublic void rotateTo(float angle, boolean immediateReturn)
angle
- Desired compass headingimmediateReturn
- if TRUE, method returns immediately; robot stops facing in specified directionpublic void rotateTo(float angle)
heading
- Desired compass headingpublic void rotate(float angle, boolean immediateReturn)
rotate
in interface Pilot
rotate
in class TachoPilot
immediateReturn
- - if true, method returns immediately. angle
- The wanted angle of rotation in degrees. Positive angle rotate left (clockwise), negative right.public void rotate(float angle)
rotate
in interface Pilot
rotate
in class TachoPilot
angle
- degrees. Positive angle rotates to the left (clockwise); negative to the right. public void reset()
TachoPilot
reset
in interface Pilot
reset
in class TachoPilot
public boolean isMoving()
isMoving
in interface Pilot
isMoving
in class TachoPilot
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |