Tekkotsu Homepage | Demos | Overview | Downloads | Dev. Resources | Reference | Credits |
HolonomicMotionModel< ParticleT > Class Template Reference#include <HolonomicMotionModel.h>
Inheritance diagram for HolonomicMotionModel< ParticleT >:
![]() Detailed Descriptiontemplate<typename ParticleT>
This class can model the path of a holonomic robot in two dimensions (x and y).
|
![]() 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 ![]() ![]() ![]() ![]() |
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...
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 |
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.
HolonomicMotionModel< ParticleT >::HolonomicMotionModel | ( | ) | [inline] |
constructor, with default noise parameters (xvar=yvar=50, avar=0.15f)
Definition at line 59 of file HolonomicMotionModel.h.
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.
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.
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().
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.
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.
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.
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.
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().
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.
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.
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.
float HolonomicMotionModel< ParticleT >::getXVariance | ( | ) | const [inline] |
float HolonomicMotionModel< ParticleT >::getYVariance | ( | ) | const [inline] |
float HolonomicMotionModel< ParticleT >::getAVariance | ( | ) | const [inline] |
float HolonomicMotionModel< ParticleT >::getAxisCrossVariance | ( | ) | const [inline] |
float HolonomicMotionModel< ParticleT >::getAngleCrossVariance | ( | ) | const [inline] |
float HolonomicMotionModel< ParticleT >::xvel [protected] |
current x velocity
Definition at line 191 of file HolonomicMotionModel.h.
Referenced by HolonomicMotionModel< ParticleT >::getPosition(), HolonomicMotionModel< ParticleT >::getVelocity(), HolonomicMotionModel< ParticleT >::setVelocity(), and HolonomicMotionModel< ParticleT >::updateMotion().
float HolonomicMotionModel< ParticleT >::yvel [protected] |
current y velocity
Definition at line 192 of file HolonomicMotionModel.h.
Referenced by HolonomicMotionModel< ParticleT >::getPosition(), HolonomicMotionModel< ParticleT >::getVelocity(), HolonomicMotionModel< ParticleT >::setVelocity(), and HolonomicMotionModel< ParticleT >::updateMotion().
float HolonomicMotionModel< ParticleT >::avel [protected] |
current angular velocity
Definition at line 193 of file HolonomicMotionModel.h.
Referenced by HolonomicMotionModel< ParticleT >::getPosition(), HolonomicMotionModel< ParticleT >::getVelocity(), HolonomicMotionModel< ParticleT >::setVelocity(), and HolonomicMotionModel< ParticleT >::updateMotion().
unsigned int HolonomicMotionModel< ParticleT >::prevtime [protected] |
time (in milliseconds) that the position was last set
Definition at line 194 of file HolonomicMotionModel.h.
Referenced by HolonomicMotionModel< ParticleT >::getPosition(), HolonomicMotionModel< ParticleT >::setPosition(), HolonomicMotionModel< ParticleT >::setVelocity(), and HolonomicMotionModel< ParticleT >::updateMotion().
float HolonomicMotionModel< ParticleT >::posx [protected] |
x position at which prevtime was set
Definition at line 196 of file HolonomicMotionModel.h.
Referenced by HolonomicMotionModel< ParticleT >::getPosition(), HolonomicMotionModel< ParticleT >::setPosition(), HolonomicMotionModel< ParticleT >::setVelocity(), and HolonomicMotionModel< ParticleT >::updateMotion().
float HolonomicMotionModel< ParticleT >::posy [protected] |
y position at which prevtime was set
Definition at line 197 of file HolonomicMotionModel.h.
Referenced by HolonomicMotionModel< ParticleT >::getPosition(), HolonomicMotionModel< ParticleT >::setPosition(), HolonomicMotionModel< ParticleT >::setVelocity(), and HolonomicMotionModel< ParticleT >::updateMotion().
float HolonomicMotionModel< ParticleT >::posa [protected] |
orientation at which prevtime was set
Definition at line 198 of file HolonomicMotionModel.h.
Referenced by HolonomicMotionModel< ParticleT >::getPosition(), HolonomicMotionModel< ParticleT >::setPosition(), HolonomicMotionModel< ParticleT >::setVelocity(), and HolonomicMotionModel< ParticleT >::updateMotion().
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().
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().
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().
float HolonomicMotionModel< ParticleT >::crossAxis [protected] |
cross variance of x speed on y speed and vice versa
Definition at line 203 of file HolonomicMotionModel.h.
Referenced by HolonomicMotionModel< ParticleT >::getAxisCrossVariance(), HolonomicMotionModel< ParticleT >::setCrossVariance(), and HolonomicMotionModel< ParticleT >::updateMotion().
float HolonomicMotionModel< ParticleT >::crossAngle [protected] |
cross variance of x,y speed on angular speed
Definition at line 204 of file HolonomicMotionModel.h.
Referenced by HolonomicMotionModel< ParticleT >::getAngleCrossVariance(), HolonomicMotionModel< ParticleT >::setCrossVariance(), and HolonomicMotionModel< ParticleT >::updateMotion().
Tekkotsu v4.0 |
Generated Thu Nov 22 00:58:26 2007 by Doxygen 1.5.4 |