icommand.navigation
Interface Navigator

All Known Implementing Classes:
CompassNavigator, TachoNavigator

public interface Navigator

The Navigator interface contains methods for performing basic navigational movements. Normally the Navigator class is instantiated as an object and methods are called on that object. 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).

Version:
0.1 22-October-2006
Author:
Brian Bagnall

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.
 double getX()
          Returns the current x coordinate of the NXT.
 double getY()
          Returns the current y coordinate of the NXT.
 void goTo(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 rotateTo(double angle)
          Rotates the NXT robot to point in a certain direction.
 void stop()
          Halts the NXT robot and calculates new x, y coordinates.
 void travel(double distance)
          Moves the NXT robot a specific distance.
 

Method Detail

getX

double getX()
Returns the current x coordinate of the NXT. Note: At present it will only give an updated reading when the NXT is stopped.

Returns:
double Present x coordinate.

getY

double getY()
Returns the current y coordinate of the NXT. Note: At present it will only give an updated reading when the NXT is stopped.

Returns:
double Present y coordinate.

getAngle

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

Returns:
double Angle in degrees.

rotate

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.

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

rotateTo

void rotateTo(double angle)
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.

Parameters:
angle - The angle to rotate to, in degrees.

goTo

void goTo(double x,
          double y)
Rotates the NXT robot towards the target point and moves the required distance.

Parameters:
x - The x coordinate to move to.
y - The y coordinate to move to.

travel

void travel(double distance)
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.

Parameters:
distance - The positive or negative distance to move the robot.

forward

void forward()
Moves the NXT robot forward until stop() is called.

See Also:
stop().

backward

void backward()
Moves the NXT robot backward until stop() is called.

See Also:
stop().

stop

void stop()
Halts the NXT robot and calculates new x, y coordinates.

See Also:
forward().


Copyright © 2006. All Rights Reserved.