Package lejos.robotics.localization
Class MCLParticle
- java.lang.Object
-
- lejos.robotics.localization.MCLParticle
-
public class MCLParticle extends java.lang.ObjectRepresents a particle for the particle filtering algorithm. The state of the particle is the pose, which represents a possible pose of the robot. The weight for a particle is set by taking a set of theoretical range readings using a map of the environment, and comparing these ranges with those taken by the robot. The weight represents the relative probability that the robot has this pose. Weights are from 0 to 1.- Author:
- Lawrie Griffiths
-
-
Constructor Summary
Constructors Constructor Description MCLParticle(Pose pose)Create a particle with a specific pose
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidapplyMove(Move move, float distanceNoiseFactor, float angleNoiseFactor)Apply the robot's move to the particle with a bit of random noise.voidcalculateWeight(RangeReadings rr, RangeMap map, float divisor)Calculate the weight for this particle by comparing its readings with the robot's readingsPosegetPose()Return the pose of this particlefloatgetReading(int i, RangeReadings rr, RangeMap map)Get a specific readingRangeReadingsgetReadings(RangeReadings rr, RangeMap map)floatgetWeight()Return the weight of this particlestatic voidsetDebug(boolean yes)voidsetWeight(float weight)Set the weight for this particle
-
-
-
Constructor Detail
-
MCLParticle
public MCLParticle(Pose pose)
Create a particle with a specific pose- Parameters:
pose- the pose
-
-
Method Detail
-
setDebug
public static void setDebug(boolean yes)
-
setWeight
public void setWeight(float weight)
Set the weight for this particle- Parameters:
weight- the weight of this particle
-
getWeight
public float getWeight()
Return the weight of this particle- Returns:
- the weight
-
getPose
public Pose getPose()
Return the pose of this particle- Returns:
- the pose
-
calculateWeight
public void calculateWeight(RangeReadings rr, RangeMap map, float divisor)
Calculate the weight for this particle by comparing its readings with the robot's readings- Parameters:
rr- Robot readings
-
getReading
public float getReading(int i, RangeReadings rr, RangeMap map)Get a specific reading- Parameters:
i- the index of the reading- Returns:
- the reading
-
getReadings
public RangeReadings getReadings(RangeReadings rr, RangeMap map)
-
applyMove
public void applyMove(Move move, float distanceNoiseFactor, float angleNoiseFactor)
Apply the robot's move to the particle with a bit of random noise. Only works for rotate or travel movements.- Parameters:
move- the robot's move
-
-