|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecticommand.navigation.Pilot
icommand.navigation.CompassPilot
public class CompassPilot
The iCommand CompassPilot is simpler than the NXJ CompassPilot. This version rotates using the compass but does not move forward/backward with compass assistance.
| Field Summary | |
|---|---|
protected CompassSensor |
compass
|
| Fields inherited from class icommand.navigation.Pilot |
|---|
_degPerDistance, _left, _right, _speed, _trackWidth, _wheelDiameter |
| Constructor Summary | |
|---|---|
CompassPilot(CompassSensor compass,
double wheelDiameter,
double trackWidth,
Motor leftMotor,
Motor rightMotor)
Allocates a CompasPilot object, and sets the physical parameters of the NXT robot. |
|
CompassPilot(CompassSensor compass,
double wheelDiameter,
double trackWidth,
Motor leftMotor,
Motor rightMotor,
boolean reverse)
Allocates a CompasPilot object, and sets the physical parameters of the NXT robot. |
|
CompassPilot(SensorPort compassPort,
double wheelDiameter,
double trackWidth,
Motor leftMotor,
Motor rightMotor)
Allocates a CompasPilot object, and sets the physical parameters of the NXT robot. |
|
CompassPilot(SensorPort compassPort,
double wheelDiameter,
double trackWidth,
Motor leftMotor,
Motor rightMotor,
boolean reverse)
Allocates a CompasPilot object, and sets the physical parameters of the NXT robot. |
|
| Method Summary | |
|---|---|
void |
calibrate()
Slowly rotates twice while in calibration mode. |
int |
getAngle()
returns the angle of rotation of the robot since last call to reset of tacho count; |
void |
rotate(int angle,
boolean immediateReturn)
The rotate method takes a current reading from the compass then rotates the desired number of degrees. |
void |
rotateTo(int heading)
robot rotates to the specified compass heading; |
void |
rotateTo(int angle,
boolean immediateReturn)
robot rotates to the specified compass heading; |
| Methods inherited from class icommand.navigation.Pilot |
|---|
backward, forward, getLeftCount, getRightCount, getSpeed, getTravelDistance, getTurnRatio, isMoving, resetTachoCount, rotate, setSpeed, steer, steer, steer, stop, travel, travel |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected CompassSensor compass
| Constructor Detail |
|---|
public CompassPilot(SensorPort compassPort,
double wheelDiameter,
double 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 wheelDiameter
public CompassPilot(SensorPort compassPort,
double wheelDiameter,
double 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 backwards
public CompassPilot(CompassSensor compass,
double wheelDiameter,
double 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,
double wheelDiameter,
double 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 backwards| Method Detail |
|---|
public void calibrate()
public void rotateTo(int angle,
boolean immediateReturn)
angle - Desired compass headingimmediateReturn - if TRUE, method returns immediately; robot stops facing in specified directionpublic void rotateTo(int heading)
heading - Desired compass headingpublic int getAngle()
Pilot
getAngle in class Pilot
public void rotate(int angle,
boolean immediateReturn)
rotate in class Pilotangle - degrees. Positive angle rotates to the left; negative to the right. immediateReturn - if true this method returns immediately
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||