public class OdometryPoseProvider extends java.lang.Object implements PoseProvider, MoveListener
A PoseProvider keeps track of the robot Pose.
It does this using odometry (dead reckoning)
data contained in a Move, which is supplied by a MoveProvider. When the PoseProivder is constructed, it registers
as listener with its MoveProvider,
| Modifier and Type | Field and Description |
|---|---|
private float |
angle0 |
(package private) boolean |
current |
private float |
distance0 |
private float |
heading |
(package private) MoveProvider |
mp |
private float |
x |
private float |
y |
| Constructor and Description |
|---|
OdometryPoseProvider(MoveProvider mp)
Allocates a new OdometryPoseProivder and registers it with the MovePovider as a listener.
|
| Modifier and Type | Method and Description |
|---|---|
void |
fetchSample(float[] sample,
int offset) |
Pose |
getPose()
returns a new pose that represents the current location and heading of the robot.
|
void |
moveStarted(Move move,
MoveProvider mp)
called by a MoveProvider when movement starts
|
void |
moveStopped(Move move,
MoveProvider mp)
called by a MoveProvider when movement ends
|
private float |
normalize(float angle) |
int |
sampleSize() |
private void |
setHeading(float heading) |
void |
setPose(Pose aPose) |
private void |
setPosition(Point p) |
private void |
updatePose(Move event) |
private float x
private float y
private float heading
private float angle0
private float distance0
MoveProvider mp
boolean current
public OdometryPoseProvider(MoveProvider mp)
public Pose getPose()
getPose in interface PoseProviderpublic void moveStarted(Move move, MoveProvider mp)
moveStarted in interface MoveListenermove - - the event that just startedmp - the MoveProvider that called this methodpublic void setPose(Pose aPose)
setPose in interface PoseProviderpublic void moveStopped(Move move, MoveProvider mp)
moveStopped in interface MoveListenermove - - the event that just startedmp - private void updatePose(Move event)
private float normalize(float angle)
private void setPosition(Point p)
private void setHeading(float heading)
public int sampleSize()
public void fetchSample(float[] sample,
int offset)