lejos.localization
Class Particle

java.lang.Object
  extended by lejos.localization.Particle

public class Particle
extends Object

Represents 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

WARNING: THIS CLASS IS SHARED BETWEEN THE classes AND pccomms PROJECTS. DO NOT EDIT THE VERSION IN pccomms AS IT WILL BE OVERWRITTEN WHEN THE PROJECT IS BUILT.

Field Summary
static Random rand
           
 
Constructor Summary
Particle(Pose pose)
          Create a particle with a specific pose
 
Method Summary
 void applyMove(Move move)
          Apply the robot's move to the particle with a bit of random noise
 void calculateWeight(RangeReadings rr, Map map)
          Calculate the weight for this particle by comparing its readings with the robot's readings
 Pose getPose()
          Return the pose of this particle
 float getReading(int i)
          Get a specific reading
 float getWeight()
          Return the weight of this particle
 void setWeight(float weight)
          Set the weight for this particle
 void takeReadings(Map map)
          Calculate the theoretical readings
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rand

public static Random rand
Constructor Detail

Particle

public Particle(Pose pose)
Create a particle with a specific pose

Parameters:
pose - the pose
Method Detail

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,
                            Map map)
Calculate the weight for this particle by comparing its readings with the robot's readings

Parameters:
rr - Robot readings

takeReadings

public void takeReadings(Map map)
Calculate the theoretical readings

Parameters:
map - the map of the environment

getReading

public float getReading(int i)
Get a specific reading

Parameters:
i - the index of the reading
Returns:
the reading

applyMove

public void applyMove(Move move)
Apply the robot's move to the particle with a bit of random noise

Parameters:
move - the robot's move