lejos.robotics.proposal
Class UpdateablePose

java.lang.Object
  extended by lejos.robotics.Pose
      extended by lejos.robotics.proposal.UpdateablePose
All Implemented Interfaces:
MoveListener

public class UpdateablePose
extends Pose
implements MoveListener

Experimental Pose Represents the location and heading(direction angle) of a robot.
This class includes methods for updating the UpdateablePose to track common robot movements. It will updates itself for every move of a Pilot if it registers as a MoveListener. The Pilot must implement the MovementProvider interface. It can report the current pose at any time, even while a move is in progress.

Author:
Roger Glassey

Field Summary
protected  float _angle0
           
protected  boolean _current
           
protected  float _distance0
           
protected  MovementProvider pilot
           
 
Fields inherited from class lejos.robotics.Pose
_heading, _location
 
Constructor Summary
UpdateablePose()
          allocate a new UpdateablePose at the origin, heading = 0:the direction the positive X axis
UpdateablePose(float x, float y, float heading)
          Allocate a new pose at location (x,y) with specified heading in degrees.
 
Method Summary
 float getHeading()
          returns the heading (direction angle) of the UpdateablePose
 Point getLocation()
          return the location as a Point
 float getX()
          return X coordinate
 float getY()
          return Y coordinate
 boolean isCurrent()
           
 void movementStarted(Movement move, MovementProvider p)
          Called when a Movement Provider starts a move
 void movementStopped(Movement move, MovementProvider p)
          Called by the movementr provider when a move stops
 void setHeading(float heading)
           
 void setLocation(Point p)
          Set the location of the pose
 void setPilot(MovementProvider aPilot)
           
protected  void update(Movement move)
          Updates can occur while the robot is moving.
 
Methods inherited from class lejos.robotics.Pose
angleTo, arcUpdate, distanceTo, moveUpdate, rotateUpdate, translate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_current

protected boolean _current

pilot

protected MovementProvider pilot

_angle0

protected float _angle0

_distance0

protected float _distance0
Constructor Detail

UpdateablePose

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


UpdateablePose

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

Parameters:
x -
y -
heading -
Method Detail

movementStarted

public void movementStarted(Movement move,
                            MovementProvider p)
Description copied from interface: MoveListener
Called when a Movement Provider starts a move

Specified by:
movementStarted in interface MoveListener
Parameters:
move - the movement
p - the movement provider

movementStopped

public void movementStopped(Movement move,
                            MovementProvider p)
Description copied from interface: MoveListener
Called by the movementr provider when a move stops

Specified by:
movementStopped in interface MoveListener
Parameters:
move - the movement
p - movement provider

update

protected void update(Movement move)
Updates can occur while the robot is moving. Update of pose required the change in angle and distance since last update. Pilot returns angle and distance since the start of movement. UpdateablePose uses angle0 and distance0 to calculate the change since last update.


getHeading

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

Overrides:
getHeading in class Pose
Returns:

getX

public float getX()
return X coordinate

Overrides:
getX in class Pose
Returns:

getY

public float getY()
return Y coordinate

Overrides:
getY in class Pose
Returns:

getLocation

public Point getLocation()
return the location as a Point

Overrides:
getLocation in class Pose
Returns:

setLocation

public void setLocation(Point p)
Description copied from class: Pose
Set the location of the pose

Overrides:
setLocation in class Pose
Parameters:
p - the new location

setHeading

public void setHeading(float heading)
Overrides:
setHeading in class Pose

setPilot

public void setPilot(MovementProvider aPilot)

isCurrent

public boolean isCurrent()