|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object lejos.robotics.navigation.TachoPilot lejos.robotics.navigation.CompassPilot
public class CompassPilot
A Pilot that keeps track of direction using a CompassSensor.
Field Summary | |
---|---|
int |
_angle0
|
protected DirectionFinder |
compass
|
Fields inherited from class lejos.robotics.navigation.TachoPilot |
---|
_left, _leftDegPerDistance, _leftTurnRatio, _leftWheelDiameter, _motorSpeed, _right, _rightDegPerDistance, _rightTurnRatio, _rightWheelDiameter, _robotMoveSpeed, _robotTurnSpeed, _trackWidth |
Constructor Summary | |
---|---|
CompassPilot(DirectionFinder compass,
float wheelDiameter,
float trackWidth,
TachoMotor leftMotor,
TachoMotor rightMotor)
Allocates a CompasPilot object, and sets the physical parameters of the NXT robot. |
|
CompassPilot(DirectionFinder compass,
float wheelDiameter,
float trackWidth,
TachoMotor leftMotor,
TachoMotor 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. |
DirectionFinder |
getCompass()
Return the compass |
int |
getCompassHeading()
Method returns the 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 |
stop()
Stops the robot soon after the method is executed. |
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.robotics.navigation.TachoPilot |
---|
arc, arc, arc, backward, forward, getLeft, getLeftActualSpeed, getLeftCount, getMoveMaxSpeed, getMoveSpeed, getRight, getRightActualSpeed, getRightCount, getTravelDistance, getTurnMaxSpeed, getTurnRatio, getTurnSpeed, regulateSpeed, setMoveSpeed, setSpeed, setTurnSpeed, stalled, steer, steer, steer, travelArc, travelArc |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected DirectionFinder compass
public int _angle0
Constructor Detail |
---|
public CompassPilot(DirectionFinder compass, float wheelDiameter, float trackWidth, TachoMotor leftMotor, TachoMotor 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(DirectionFinder compass, float wheelDiameter, float trackWidth, TachoMotor leftMotor, TachoMotor 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 DirectionFinder 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;
Unfortunately, if you issue the stop(() command, the motion will run to
completion.robot stops facing in specified directionpublic void rotateTo(float angle)
angle
- Desired compass headingpublic void rotate(float angle, boolean immediateReturn)
rotate
in interface Pilot
rotate
in class TachoPilot
immediateReturn
- - if true, method returns immediately.
Unfortunately, if you issue the stop(() command, the motion will run to
completion. 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
public void stop()
stop
in interface Pilot
stop
in class TachoPilot
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |