particle
index
/home/home5/gvtaylor/cps089s_code/snarfableSlam/particle.py

particle.py
Skeleton by Mac Mason <mac@cs.duke.edu>
 
Since we're doing particle-filter localization, we need a Particle class.
Particles represent a single, deterministic, hypothesis about the robot's
pose, and also store a map. (For localization, this map is assumed to be
determistic as well, but we relax this later).

 
Modules
       
copy
map
math
sys

 
Classes
       
Particle

 
class Particle
    Represent a single, deterministic, hypothesis about the robot's pose, plus a
map. 
 
In the filtering model, each Particle also has a weight; this is also
stored.
 
See also draw_particle, in drawstuff.py.
 
  Methods defined here:
__init__(self, x, y, theta, initial_map)
Construct a particle at (x, y, theta). The initial weight is set to 1.0,
and the initial map to whatever you set it to.
calcJacobian(self, botObs)
Internal method.  There's no reason to call this.
calcLxLy(self, obs)
Internal method.  There's no reason to call this.
initialize_covariance(self, obs, sModel)
Compute the covariance matrix of a new landmark.
Takes in the observation and your sensor model.
Returns the covariance matrix.
initialize_mean(self, obs)
Compute the mean of an observation of a new landmark.
Takes in the observation as an argument.
Returns the list [mu's X, mu's Y]
measurement_covariance(self, botObs, sModel)
Calculate the covariance of your measurement.  Takes in the observation
and your SensorModel.
Returns a Matrix, which represents the covariance.
move(self, dx, dy, dt)
Move the particle by the given delta-x, delta-y, and delta-theta values.
As written, this is a deterministic function. WATCH OUT for coordinate
frames; make sure you know what your coordinates mean.
sense(self)
Perform a (noise-free!) measurement of this particle's map, at this pose.
This returns a list of observations.
update_covariance(self, botObs, predObs, mCov)
If you're seeing a landmark again, you need to update the covariance to
reflect the new information.  This takes in the Bot's observation of the
landmark, the predicted observation of the landmark, and your measurement
covariance.
Returns the covariance.
update_mean(self, botObs, predObs, mCov)
If you're seeing a landmark again, you need to update the mean to include
the new information.  This takes in the Bot's observation of the landmark,
the predicted observation of the landmark, and your measurement
covariance.
Returns
update_weight(self, Q, botObs, pObs)
Given your measurement covariance, robot observation, and expected
observation, what is the weight of this particle?
Returns the weight.