icommand.robotics
Class CompassNavigator

java.lang.Object
  extended by icommand.robotics.CompassNavigator
All Implemented Interfaces:
Navigator

public class CompassNavigator
extends java.lang.Object
implements Navigator

Not currently implemented. None of these methods will work yet!

Author:
BB

Constructor Summary
CompassNavigator(Compass compass, double wheelDiameter, double driveLength, Motor left, Motor right)
           
 
Method Summary
 void backward()
          Moves the NXT robot backward until stop() is called.
 void forward()
          Moves the NXT robot forward until stop() is called.
 double getAngle()
          Returns the current angle the NXT robot is facing.
 float getX()
          Returns the current x coordinate of the NXT.
 float getY()
          Returns the current y coordinate of the NXT.
 void gotoAngle(double angle)
          Rotates the NXT robot to point in a certain direction.
 void gotoPoint(double x, double y)
          Rotates the NXT robot towards the target point and moves the required distance.
 void rotate(double angle)
          Rotates the NXT robot a specific number of degrees in a direction (+ or -).This method will return once the rotation is complete.
 void stop()
          Halts the NXT robot and calculates new x, y coordinates.
 void travel(long distance)
          Moves the NXT robot a specific distance.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompassNavigator

public CompassNavigator(Compass compass,
                        double wheelDiameter,
                        double driveLength,
                        Motor left,
                        Motor right)
Method Detail

backward

public void backward()
Description copied from interface: Navigator
Moves the NXT robot backward until stop() is called.

Specified by:
backward in interface Navigator
See Also:
Navigator.stop().

forward

public void forward()
Description copied from interface: Navigator
Moves the NXT robot forward until stop() is called.

Specified by:
forward in interface Navigator
See Also:
Navigator.stop().

getAngle

public double getAngle()
Description copied from interface: Navigator
Returns the current angle the NXT robot is facing. Note: At present it will only give an updated reading when the NXT is stopped.

Specified by:
getAngle in interface Navigator
Returns:
float Angle in degrees.

getX

public float getX()
Description copied from interface: Navigator
Returns the current x coordinate of the NXT. Note: At present it will only give an updated reading when the NXT is stopped.

Specified by:
getX in interface Navigator
Returns:
float Present x coordinate.

getY

public float getY()
Description copied from interface: Navigator
Returns the current y coordinate of the NXT. Note: At present it will only give an updated reading when the NXT is stopped.

Specified by:
getY in interface Navigator
Returns:
float Present y coordinate.

gotoAngle

public void gotoAngle(double angle)
Description copied from interface: Navigator
Rotates the NXT robot to point in a certain direction. It will take the shortest path necessary to point to the desired angle. Method returns once rotation is complete.

Specified by:
gotoAngle in interface Navigator
Parameters:
angle - The angle to rotate to, in degrees.

gotoPoint

public void gotoPoint(double x,
                      double y)
Description copied from interface: Navigator
Rotates the NXT robot towards the target point and moves the required distance.

Specified by:
gotoPoint in interface Navigator
Parameters:
x - The x coordinate to move to.
y - The y coordinate to move to.

stop

public void stop()
Description copied from interface: Navigator
Halts the NXT robot and calculates new x, y coordinates.

Specified by:
stop in interface Navigator
See Also:
Navigator.forward().

rotate

public void rotate(double angle)
Description copied from interface: Navigator
Rotates the NXT robot a specific number of degrees in a direction (+ or -).This method will return once the rotation is complete.

Specified by:
rotate in interface Navigator
Parameters:
angle - Angle to rotate in degrees. A positive value rotates left, a negative value right.

travel

public void travel(long distance)
Description copied from interface: Navigator
Moves the NXT robot a specific distance. A positive value moves it forward and a negative value moves it backward. Method returns when movement is done.

Specified by:
travel in interface Navigator
Parameters:
distance - The positive or negative distance to move the robot.