josx.robotics
Interface Navigator

All Known Implementing Classes:
RotationNavigator, TimingNavigator

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).


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 stop()
          Halts the RCX robot and calculates new x, y coordinates.
 void travel(int distance)
          Moves the RCX robot a specific distance.
 

Method Detail

getX

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

Returns:
float Present x coordinate.

getY

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

Returns:
float Present y coordinate.

getAngle

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

Returns:
float Angle in degrees.

rotate

public 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.

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

gotoAngle

public void gotoAngle(float angle)
Rotates the RCX 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.

gotoPoint

public void gotoPoint(float x,
                      float y)
Rotates the RCX 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

public void travel(int distance)
Moves the RCX 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

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

See Also:
stop().

backward

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

See Also:
stop().

stop

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

See Also:
forward().