|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object lejos.robotics.Pose lejos.robotics.proposal.UpdateablePose
public class UpdateablePose
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.
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 |
---|
protected boolean _current
protected MovementProvider pilot
protected float _angle0
protected float _distance0
Constructor Detail |
---|
public UpdateablePose()
public UpdateablePose(float x, float y, float heading)
x
- y
- heading
- Method Detail |
---|
public void movementStarted(Movement move, MovementProvider p)
MoveListener
movementStarted
in interface MoveListener
move
- the movementp
- the movement providerpublic void movementStopped(Movement move, MovementProvider p)
MoveListener
movementStopped
in interface MoveListener
move
- the movementp
- movement providerprotected void update(Movement move)
public float getHeading()
getHeading
in class Pose
public float getX()
getX
in class Pose
public float getY()
getY
in class Pose
public Point getLocation()
getLocation
in class Pose
public void setLocation(Point p)
Pose
setLocation
in class Pose
p
- the new locationpublic void setHeading(float heading)
setHeading
in class Pose
public void setPilot(MovementProvider aPilot)
public boolean isCurrent()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |