lejos.robotics
Class Pose

java.lang.Object
  extended by lejos.robotics.Pose
Direct Known Subclasses:
UpdateablePose

public class Pose
extends Object

Represents the location and heading(direction angle) of a robot.
This class includes methods for updating the Pose to track common robot movements

Author:
Roger Glassey

Field Summary
protected  float _heading
           
protected  Point _location
           
 
Constructor Summary
Pose()
          allocate a new Pose at the origin, heading = 0:the direction the positive X axis
Pose(float x, float y, float heading)
          Allocate a new pose at location (x,y) with specified heading in degrees.
 
Method Summary
 float angleTo(Point destination)
          Calculates the absolute angle to destination from the current location of the pose
 void arcUpdate(float distance, float turnAngle)
          Sets the pose locatin and heading to the currect values resulting from travel in a circular arc.
 float distanceTo(Point destination)
          Get the distance to the destination
 float getHeading()
          returns the heading (direction angle) of the Pose
 Point getLocation()
          Get the location as a Point
 float getX()
          Get the X coordinate
 float getY()
          Get the Y coordinate
 void moveUpdate(float distance)
          Move the specified distance in the direction of current heading.
 void rotateUpdate(float angle)
          Rotate the heading through the specified angle
 void setHeading(float heading)
           
 void setLocation(Point p)
          Set the location of the pose
 void translate(float dx, float dy)
          Change the x and y coordinates of the pose by adding dx and dy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_location

protected Point _location

_heading

protected float _heading
Constructor Detail

Pose

public Pose()
allocate a new Pose at the origin, heading = 0:the direction the positive X axis


Pose

public Pose(float x,
            float y,
            float heading)
Allocate a new pose at location (x,y) with specified heading in degrees.

Parameters:
x - the X coordinate
y - the Y coordinate
heading - the heading
Method Detail

rotateUpdate

public void rotateUpdate(float angle)
Rotate the heading through the specified angle

Parameters:
angle -

moveUpdate

public void moveUpdate(float distance)
Move the specified distance in the direction of current heading.

Parameters:
distance - to move

translate

public void translate(float dx,
                      float dy)
Change the x and y coordinates of the pose by adding dx and dy.

Parameters:
dx - change in x coordinate
dy - change in y coordinate

arcUpdate

public void arcUpdate(float distance,
                      float turnAngle)
Sets the pose locatin and heading to the currect values resulting from travel in a circular arc. The radius is calculated from the distance and turn angle

Parameters:
distance - the dtistance traveled
turnAngle - the angle turned

angleTo

public float angleTo(Point destination)
Calculates the absolute angle to destination from the current location of the pose

Parameters:
destination -
Returns:
angle in degrees

distanceTo

public float distanceTo(Point destination)
Get the distance to the destination

Parameters:
destination -
Returns:
the distance

getHeading

public float getHeading()
returns the heading (direction angle) of the Pose

Returns:
the heading

getX

public float getX()
Get the X coordinate

Returns:
the X coordinate

getY

public float getY()
Get the Y coordinate

Returns:
the Y coordinate

getLocation

public Point getLocation()
Get the location as a Point

Returns:
the location as a point

setLocation

public void setLocation(Point p)
Set the location of the pose

Parameters:
p - the new location

setHeading

public void setHeading(float heading)