Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

HolonomicMotionModel< ParticleT > Class Template Reference

#include <HolonomicMotionModel.h>

Inheritance diagram for HolonomicMotionModel< ParticleT >:

List of all members.


Detailed Description

template<typename ParticleT>
class HolonomicMotionModel< ParticleT >

This class can model the path of a holonomic robot in two dimensions (x and y).

This class can also model a non-holonomic robot, just don't use the y parameter!

The static function computeMotion() does the main computational grunt work.
MotionModel.png
Illustration of the equations used. Constant angular and linear velocities result in a circular arc as shown. The radius of the arc is directly determined by the ratio of the linear speed to the angular speed. The final position after time $ \Delta t $ will be $ \delta $ along a bearing $ \theta/2 $, where $ \theta $ is the angle which has been turned during the interval of interest.

You can call setPosition() to initialize the starting location or if the robot has been moved by some external means. You should call setVelocity() whenever the robot's velocity changes. The class will internally store the position and time at which the velocity change happened so that later calls to getPosition() will return points along the new path.

This class can be used as a motion model in the ParticleFilter class, or independently if desired for general purpose motion estimation. (see the standalone computeHolonomicMotion())

However, if you are looking for a motion model for ParticleFiltering, it may be more convenient to use DeadReckoningBehavior (found in Behaviors/Services) because you can start the behavior and it will subscribe to automatically receive LocomotionEvents from then on. If using HolonomicMotionModel directly with the particle filter, you would need to call setVelocity() yourself anytime the robot changes direction.

Variance parameters only come into play with updateMotion(), which is called on collections of particles. The other functions all return "ideal" motion calculations. Be aware that when using in a particle filter, the position is reset on particle updates (updateMotion()). In other words, the position returned by motion model is the offset achieved since the last particle update, not the position relative to world's origin, nor any other fixed point.

Caveat: acceleration is not handled by this model. That would be a nice addition...

See also:
computeHolonomicMotion()

Definition at line 54 of file HolonomicMotionModel.h.


Public Types

typedef ParticleFilter
< ParticleT >
::MotionModel::particle_collection 
particle_collection
 the collection type we'll be using to store the particles

Public Member Functions

 HolonomicMotionModel ()
 constructor, with default noise parameters (xvar=yvar=50, avar=0.15f)
 HolonomicMotionModel (float xVariance, float yVariance, float aVariance)
 constructor, with noise parameters (pass 0's to make it an "ideal" motion model)
virtual void updateMotion (particle_collection &particles)
 called by the particle filter when the current position of each particle should be updated
void getPosition (float &outx, float &outy, float &outa) const
 stores the current position into the arguments (based on get_time() vs the time the position was last set)
void getPosition (float &outx, float &outy, float &outa, unsigned int curtime) const
 stores the current position into the arguments (based on curtime vs the time the position was last set)
void setPosition (float x, float y, float angle)
 sets the current position to the specified values and updates the timestamp to the current time
void setPosition (float x, float y, float angle, unsigned int curtime)
 sets the current position to the specified values and updates the timestamp to the specified time
void getVelocity (float &outxv, float &outyv, float &outav) const
 stores the current velocity into the arguments (no noise is added, this just echos the values passed to setVelocity())
void setVelocity (float xv, float yv, float av)
 sets the current velocity to the specified values and updates the position and timestamp to the current time
void setVelocity (float xv, float yv, float av, unsigned int curtime)
 sets the current velocity to the specified values and updates the position and timestamp to the specified time
void setVariance (float xv, float yv, float av)
 allows you to change the variance parameters (xvar, yvar, avar)
void setCrossVariance (float axis, float angle)
 allows you to change the cross-variance parameters (crossAxis, crossAngle)
float getXVariance () const
 accessor for xvar
float getYVariance () const
 accessor for yvar
float getAVariance () const
 accessor for avar
float getAxisCrossVariance () const
 accessor for crossAxis
float getAngleCrossVariance () const
 accessor for crossAngle

Protected Attributes

float xvel
 current x velocity
float yvel
 current y velocity
float avel
 current angular velocity
unsigned int prevtime
 time (in milliseconds) that the position was last set
float posx
 x position at which prevtime was set
float posy
 y position at which prevtime was set
float posa
 orientation at which prevtime was set
float xvar
 variance of x velocities as ratio of x speed, used when updating particle list (updateMotion())
float yvar
 variance of y velocities as ratio of y speed, used when updating particle list (updateMotion())
float avar
 variance of angular velocities as ratio of angular speed, used when updating particle list (updateMotion())
float crossAxis
 cross variance of x speed on y speed and vice versa
float crossAngle
 cross variance of x,y speed on angular speed

Member Typedef Documentation

template<typename ParticleT>
typedef ParticleFilter<ParticleT>::MotionModel::particle_collection HolonomicMotionModel< ParticleT >::particle_collection

the collection type we'll be using to store the particles

Reimplemented from ParticleFilter< ParticleT >::MotionModel.

Definition at line 56 of file HolonomicMotionModel.h.


Constructor & Destructor Documentation

template<typename ParticleT>
HolonomicMotionModel< ParticleT >::HolonomicMotionModel (  )  [inline]

constructor, with default noise parameters (xvar=yvar=50, avar=0.15f)

Definition at line 59 of file HolonomicMotionModel.h.

template<typename ParticleT>
HolonomicMotionModel< ParticleT >::HolonomicMotionModel ( float  xVariance,
float  yVariance,
float  aVariance 
) [inline]

constructor, with noise parameters (pass 0's to make it an "ideal" motion model)

Variance parameters only come into play with updateMotion(), which is called on collections of particles. The other functions all return "ideal" motion calculations.

Definition at line 67 of file HolonomicMotionModel.h.


Member Function Documentation

template<typename ParticleT>
virtual void HolonomicMotionModel< ParticleT >::updateMotion ( particle_collection particles  )  [inline, virtual]

called by the particle filter when the current position of each particle should be updated

This will reset the motion model to set the origin at the current location after the particles are updated, so that the next call to updateMotion() will supply the particles with the displacement which occurred since the last update

Implements ParticleFilter< ParticleT >::MotionModel.

Definition at line 77 of file HolonomicMotionModel.h.

template<typename ParticleT>
void HolonomicMotionModel< ParticleT >::getPosition ( float &  outx,
float &  outy,
float &  outa 
) const [inline]

stores the current position into the arguments (based on get_time() vs the time the position was last set)

Definition at line 115 of file HolonomicMotionModel.h.

Referenced by DeadReckoningBehavior< ParticleT >::processEvent().

template<typename ParticleT>
void HolonomicMotionModel< ParticleT >::getPosition ( float &  outx,
float &  outy,
float &  outa,
unsigned int  curtime 
) const [inline]

stores the current position into the arguments (based on curtime vs the time the position was last set)

Definition at line 124 of file HolonomicMotionModel.h.

template<typename ParticleT>
void HolonomicMotionModel< ParticleT >::setPosition ( float  x,
float  y,
float  angle 
) [inline]

sets the current position to the specified values and updates the timestamp to the current time

Definition at line 136 of file HolonomicMotionModel.h.

template<typename ParticleT>
void HolonomicMotionModel< ParticleT >::setPosition ( float  x,
float  y,
float  angle,
unsigned int  curtime 
) [inline]

sets the current position to the specified values and updates the timestamp to the specified time

Definition at line 139 of file HolonomicMotionModel.h.

template<typename ParticleT>
void HolonomicMotionModel< ParticleT >::getVelocity ( float &  outxv,
float &  outyv,
float &  outav 
) const [inline]

stores the current velocity into the arguments (no noise is added, this just echos the values passed to setVelocity())

Definition at line 147 of file HolonomicMotionModel.h.

template<typename ParticleT>
void HolonomicMotionModel< ParticleT >::setVelocity ( float  xv,
float  yv,
float  av 
) [inline]

sets the current velocity to the specified values and updates the position and timestamp to the current time

Definition at line 154 of file HolonomicMotionModel.h.

Referenced by DeadReckoningBehavior< ParticleT >::DoStart(), and DeadReckoningBehavior< ParticleT >::processEvent().

template<typename ParticleT>
void HolonomicMotionModel< ParticleT >::setVelocity ( float  xv,
float  yv,
float  av,
unsigned int  curtime 
) [inline]

sets the current velocity to the specified values and updates the position and timestamp to the specified time

Definition at line 157 of file HolonomicMotionModel.h.

template<typename ParticleT>
void HolonomicMotionModel< ParticleT >::setVariance ( float  xv,
float  yv,
float  av 
) [inline]

allows you to change the variance parameters (xvar, yvar, avar)

Definition at line 175 of file HolonomicMotionModel.h.

template<typename ParticleT>
void HolonomicMotionModel< ParticleT >::setCrossVariance ( float  axis,
float  angle 
) [inline]

allows you to change the cross-variance parameters (crossAxis, crossAngle)

Definition at line 179 of file HolonomicMotionModel.h.

template<typename ParticleT>
float HolonomicMotionModel< ParticleT >::getXVariance (  )  const [inline]

accessor for xvar

Definition at line 184 of file HolonomicMotionModel.h.

template<typename ParticleT>
float HolonomicMotionModel< ParticleT >::getYVariance (  )  const [inline]

accessor for yvar

Definition at line 185 of file HolonomicMotionModel.h.

template<typename ParticleT>
float HolonomicMotionModel< ParticleT >::getAVariance (  )  const [inline]

accessor for avar

Definition at line 186 of file HolonomicMotionModel.h.

template<typename ParticleT>
float HolonomicMotionModel< ParticleT >::getAxisCrossVariance (  )  const [inline]

accessor for crossAxis

Definition at line 187 of file HolonomicMotionModel.h.

template<typename ParticleT>
float HolonomicMotionModel< ParticleT >::getAngleCrossVariance (  )  const [inline]

accessor for crossAngle

Definition at line 188 of file HolonomicMotionModel.h.


Member Data Documentation

template<typename ParticleT>
unsigned int HolonomicMotionModel< ParticleT >::prevtime [protected]

template<typename ParticleT>
float HolonomicMotionModel< ParticleT >::xvar [protected]

variance of x velocities as ratio of x speed, used when updating particle list (updateMotion())

Definition at line 200 of file HolonomicMotionModel.h.

Referenced by HolonomicMotionModel< ParticleT >::getXVariance(), HolonomicMotionModel< ParticleT >::setVariance(), and HolonomicMotionModel< ParticleT >::updateMotion().

template<typename ParticleT>
float HolonomicMotionModel< ParticleT >::yvar [protected]

variance of y velocities as ratio of y speed, used when updating particle list (updateMotion())

Definition at line 201 of file HolonomicMotionModel.h.

Referenced by HolonomicMotionModel< ParticleT >::getYVariance(), HolonomicMotionModel< ParticleT >::setVariance(), and HolonomicMotionModel< ParticleT >::updateMotion().

template<typename ParticleT>
float HolonomicMotionModel< ParticleT >::avar [protected]

variance of angular velocities as ratio of angular speed, used when updating particle list (updateMotion())

Definition at line 202 of file HolonomicMotionModel.h.

Referenced by HolonomicMotionModel< ParticleT >::getAVariance(), HolonomicMotionModel< ParticleT >::setVariance(), and HolonomicMotionModel< ParticleT >::updateMotion().

template<typename ParticleT>
float HolonomicMotionModel< ParticleT >::crossAxis [protected]

template<typename ParticleT>
float HolonomicMotionModel< ParticleT >::crossAngle [protected]


The documentation for this class was generated from the following file:

Tekkotsu v4.0
Generated Thu Nov 22 00:58:26 2007 by Doxygen 1.5.4