lejos.robotics.localization
Class TachoLocalizer

java.lang.Object
  extended by lejos.robotics.navigation.SimpleNavigator
      extended by lejos.robotics.localization.TachoLocalizer

public abstract class TachoLocalizer
extends SimpleNavigator

An abstract extension to TachoNavigator that uses a map and a set of particles to implement the Monte Carlo Localization algorithm to estimate the pose of the robot as it moves about. Note that the navigator uses its own local coordinates relative to the robot's starting position, whereas the estimated pose is in global coordinates, as used by the map. This class must be extended and the takeReadings method implemented. Note that only travel and rotate methods update the particle set.

Author:
Lawrie Griffiths

Field Summary
protected  float angle
           
protected  float distance
           
protected  boolean isMoving
           
protected  RangeMap map
           
protected  Movement mv
           
protected  int numParticles
           
protected  int numReadings
           
protected  MCLParticleSet particles
           
protected  float projection
           
protected  RangeReadings readings
           
 
Constructor Summary
TachoLocalizer(RangeMap map, int numParticles, int numReadings, float wheelDiameter, float trackWidth, Motor leftMotor, Motor rightMotor, float projection, boolean reverse)
           
 
Method Summary
 Pose getEstimatedPose()
          Get the estimated position and angle of the robot.
 RangeMap getMap()
          Get the map
 MCLParticleSet getParticles()
          Get the particle set
 float getProjection()
          Get the forward projection of the robot
 RangeReadings getReadings()
          Return readings
 int numParticles()
          Get the number of particles
 void rotate(float angle, boolean immediateReturn)
          Rotates the NXT robot through a specific number of degrees in a direction (+ or -).
abstract  void takeReadings()
           
 void travel(float distance, boolean immediateReturn)
          Moves the NXT robot a specific distance.
 void updatePosition()
          Update the robot position and apply it to all the particles.
 
Methods inherited from class lejos.robotics.navigation.SimpleNavigator
angleTo, arc, arc, arc, backward, distanceTo, forward, getAngle, getHeading, getPose, getX, getY, goTo, goTo, isMoving, rotate, rotateLeft, rotateRight, rotateTo, rotateTo, setMoveSpeed, setPose, setPose, setPosition, setTurnSpeed, steer, steer, steer, stop, travel, travelArc, travelArc, updatePose
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

readings

protected RangeReadings readings

projection

protected float projection

map

protected RangeMap map

numParticles

protected int numParticles

particles

protected MCLParticleSet particles

angle

protected float angle

distance

protected float distance

mv

protected Movement mv

numReadings

protected int numReadings

isMoving

protected boolean isMoving
Constructor Detail

TachoLocalizer

public TachoLocalizer(RangeMap map,
                      int numParticles,
                      int numReadings,
                      float wheelDiameter,
                      float trackWidth,
                      Motor leftMotor,
                      Motor rightMotor,
                      float projection,
                      boolean reverse)
Method Detail

takeReadings

public abstract void takeReadings()

rotate

public void rotate(float angle,
                   boolean immediateReturn)
Description copied from class: SimpleNavigator
Rotates the NXT robot through a specific number of degrees in a direction (+ or -). If immediateReturn is true, method returns immidiately.

Overrides:
rotate in class SimpleNavigator
Parameters:
angle - Angle to rotate in degrees. A positive value rotates left, a negative value right.
immediateReturn - if true, the method returns immediately

travel

public void travel(float distance,
                   boolean immediateReturn)
Description copied from class: SimpleNavigator
Moves the NXT robot a specific distance. A positive value moves it forwards and a negative value moves it backwards.

Overrides:
travel in class SimpleNavigator
Parameters:
distance - The positive or negative distance to move the robot, same units as _wheelDiameter
immediateReturn - if true, the method returns immediately

updatePosition

public void updatePosition()
Update the robot position and apply it to all the particles. Note that only travel and rotate methods update the particle set.

Overrides:
updatePosition in class SimpleNavigator

getProjection

public float getProjection()
Get the forward projection of the robot

Returns:
the distance from the range sensor to the front of the robot

numParticles

public int numParticles()
Get the number of particles

Returns:
the number of particles

getParticles

public MCLParticleSet getParticles()
Get the particle set

Returns:
the particle set

getMap

public RangeMap getMap()
Get the map

Returns:
the map

getEstimatedPose

public Pose getEstimatedPose()
Get the estimated position and angle of the robot.

Returns:
the estimated pose

getReadings

public RangeReadings getReadings()
Return readings

Returns:
the range readings