| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectrcx.josx.robotics.TimingNavigator
public class TimingNavigator
The Navigator class contains methods for performing basic navigational movements. Normally the Navigator class is instantiated as an object and methods are called on that object. It can also be extended by your robot code, but the constructor method will need to be overwritten if you do this. Note: This class will only work for robots using two motors to steer differentially that can rotate within its footprint (i.e. turn on one spot).
| Constructor Summary | |
|---|---|
| TimingNavigator(Motor right,
                Motor left,
                float timeOneMeter,
                float timeRotate)Allocates a Navigator object and initializes if with the left and right wheels. | |
| Method Summary | |
|---|---|
|  void | backward()Moves the RCX robot backward until stop() is called. | 
|  void | forward()Moves the RCX robot forward until stop() is called. | 
|  float | getAngle()Returns the current angle the RCX robot is facing. | 
|  float | getX()Returns the current x coordinate of the RCX. | 
|  float | getY()Returns the current y coordinate of the RCX. | 
|  void | gotoAngle(float angle)Rotates the RCX robot to point in a certain direction. | 
|  void | gotoPoint(float x,
          float y)Rotates the RCX robot towards the target point and moves the required distance. | 
|  void | rotate(float angle)Rotates the RCX robot a specific number of degrees in a direction (+ or -).This method will return once the rotation is complete. | 
|  void | setMomentumDelay(short delay)A variable that adds extra time to each rotation. | 
|  void | stop()Halts the RCX robot and calculates new x, y coordinates. | 
|  void | travel(int distance)Moves the RCX robot a specific distance. | 
| Methods inherited from class java.lang.Object | 
|---|
| equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
|---|
public TimingNavigator(Motor right,
                       Motor left,
                       float timeOneMeter,
                       float timeRotate)
right - The motor used to drive the right wheel e.g. Motor.C.left - The motor used to drive the left wheel e.g. Motor.A.timeOneMeter - The number of seconds it takes your robot to drive one meter (e.g. 2.0 seconds is normal for a fast robot, 5 seconds for a slower robot).timeRotate - The number of seconds it takes your robot to rotate 360 degrees. (e.g. 0.646 is normal for a small axle length, 2.2 for a larger axle length)| Method Detail | 
|---|
public void setMomentumDelay(short delay)
public float getX()
getX in interface Navigatorpublic float getY()
getY in interface Navigatorpublic float getAngle()
getAngle in interface Navigatorpublic void rotate(float angle)
rotate in interface Navigatorangle - Angle to rotate in degrees. A positive value rotates left, a negative value right.public void gotoAngle(float angle)
gotoAngle in interface Navigatorangle - The angle to rotate to, in degrees.
public void gotoPoint(float x,
                      float y)
gotoPoint in interface Navigatorx - The x coordinate to move to.y - The y coordinate to move to.public void travel(int distance)
travel in interface Navigatorcentimeters - The positive or negative distance to move the robot (in centimeters).public void forward()
forward in interface NavigatorNavigator.stop().public void backward()
backward in interface NavigatorNavigator.stop().public void stop()
stop in interface NavigatorNavigator.forward().| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||