Tekkotsu Homepage | Demos | Overview | Downloads | Dev. Resources | Reference | Credits |
HolonomicMotionModel< ParticleT > Class Template ReferenceThis class can model the path of a holonomic robot in two dimensions (x and y). More...
Inheritance diagram for HolonomicMotionModel< ParticleT >:
Detailed Descriptiontemplate<typename ParticleT>
|
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 will be along a bearing , where 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 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_type | particle_type |
redefinition here allows reference to the particle type even if the template parameter may be abstracted away due to a typedef | |
typedef ParticleFilter < ParticleT > ::MotionModel::particle_collection | particle_collection |
the collection type we'll be using to store the particles | |
typedef particle_collection::size_type | index_t |
index type for refering to particles within the collection | |
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, particle_type &estimate) |
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 particle_collection::size_type HolonomicMotionModel< ParticleT >::index_t |
index type for refering to particles within the collection
Reimplemented from ParticleFilter< ParticleT >::MotionModel.
Definition at line 58 of file HolonomicMotionModel.h.
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 57 of file HolonomicMotionModel.h.
typedef ParticleFilter<ParticleT>::MotionModel::particle_type HolonomicMotionModel< ParticleT >::particle_type |
redefinition here allows reference to the particle type even if the template parameter may be abstracted away due to a typedef
Reimplemented from ParticleFilter< ParticleT >::MotionModel.
Definition at line 56 of file HolonomicMotionModel.h.
HolonomicMotionModel< ParticleT >::HolonomicMotionModel | ( | ) |
constructor, with default noise parameters (xvar=yvar=50, avar=0.15f)
Definition at line 61 of file HolonomicMotionModel.h.
HolonomicMotionModel< ParticleT >::HolonomicMotionModel | ( | float | xVariance, | |
float | yVariance, | |||
float | aVariance | |||
) |
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 69 of file HolonomicMotionModel.h.
float HolonomicMotionModel< ParticleT >::getAngleCrossVariance | ( | ) | const |
accessor for crossAngle
Definition at line 198 of file HolonomicMotionModel.h.
float HolonomicMotionModel< ParticleT >::getAVariance | ( | ) | const |
accessor for avar
Definition at line 196 of file HolonomicMotionModel.h.
float HolonomicMotionModel< ParticleT >::getAxisCrossVariance | ( | ) | const |
accessor for crossAxis
Definition at line 197 of file HolonomicMotionModel.h.
void HolonomicMotionModel< ParticleT >::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)
Definition at line 134 of file HolonomicMotionModel.h.
void HolonomicMotionModel< ParticleT >::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)
Definition at line 125 of file HolonomicMotionModel.h.
Referenced by DeadReckoningBehavior< ParticleT >::doEvent().
void HolonomicMotionModel< ParticleT >::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())
Definition at line 157 of file HolonomicMotionModel.h.
float HolonomicMotionModel< ParticleT >::getXVariance | ( | ) | const |
accessor for xvar
Definition at line 194 of file HolonomicMotionModel.h.
float HolonomicMotionModel< ParticleT >::getYVariance | ( | ) | const |
accessor for yvar
Definition at line 195 of file HolonomicMotionModel.h.
void HolonomicMotionModel< ParticleT >::setCrossVariance | ( | float | axis, | |
float | angle | |||
) |
allows you to change the cross-variance parameters (crossAxis, crossAngle)
Definition at line 189 of file HolonomicMotionModel.h.
void HolonomicMotionModel< ParticleT >::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
Definition at line 149 of file HolonomicMotionModel.h.
void HolonomicMotionModel< ParticleT >::setPosition | ( | float | x, | |
float | y, | |||
float | angle | |||
) |
sets the current position to the specified values and updates the timestamp to the current time
Definition at line 146 of file HolonomicMotionModel.h.
Referenced by HolonomicMotionModel< ParticleT >::setPosition().
void HolonomicMotionModel< ParticleT >::setVariance | ( | float | xv, | |
float | yv, | |||
float | av | |||
) |
allows you to change the variance parameters (xvar, yvar, avar)
Definition at line 185 of file HolonomicMotionModel.h.
void HolonomicMotionModel< ParticleT >::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
Definition at line 167 of file HolonomicMotionModel.h.
void HolonomicMotionModel< ParticleT >::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
Definition at line 164 of file HolonomicMotionModel.h.
Referenced by DeadReckoningBehavior< ParticleT >::doEvent(), DeadReckoningBehavior< ParticleT >::doStart(), and HolonomicMotionModel< ParticleT >::setVelocity().
virtual void HolonomicMotionModel< ParticleT >::updateMotion | ( | particle_collection & | particles, | |
particle_type & | estimate | |||
) | [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
Definition at line 79 of file HolonomicMotionModel.h.
float HolonomicMotionModel< ParticleT >::avar [protected] |
variance of angular velocities as ratio of angular speed, used when updating particle list (updateMotion())
Definition at line 212 of file HolonomicMotionModel.h.
Referenced by HolonomicMotionModel< ParticleT >::getAVariance(), HolonomicMotionModel< ParticleT >::setVariance(), and HolonomicMotionModel< ParticleT >::updateMotion().
float HolonomicMotionModel< ParticleT >::avel [protected] |
current angular velocity
Definition at line 203 of file HolonomicMotionModel.h.
Referenced by HolonomicMotionModel< ParticleT >::getPosition(), HolonomicMotionModel< ParticleT >::getVelocity(), HolonomicMotionModel< ParticleT >::setVelocity(), and HolonomicMotionModel< ParticleT >::updateMotion().
float HolonomicMotionModel< ParticleT >::crossAngle [protected] |
cross variance of x,y speed on angular speed
Definition at line 214 of file HolonomicMotionModel.h.
Referenced by HolonomicMotionModel< ParticleT >::getAngleCrossVariance(), HolonomicMotionModel< ParticleT >::setCrossVariance(), and HolonomicMotionModel< ParticleT >::updateMotion().
float HolonomicMotionModel< ParticleT >::crossAxis [protected] |
cross variance of x speed on y speed and vice versa
Definition at line 213 of file HolonomicMotionModel.h.
Referenced by HolonomicMotionModel< ParticleT >::getAxisCrossVariance(), HolonomicMotionModel< ParticleT >::setCrossVariance(), and HolonomicMotionModel< ParticleT >::updateMotion().
float HolonomicMotionModel< ParticleT >::posa [protected] |
orientation at which prevtime was set
Definition at line 208 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 206 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 207 of file HolonomicMotionModel.h.
Referenced by HolonomicMotionModel< ParticleT >::getPosition(), HolonomicMotionModel< ParticleT >::setPosition(), 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 204 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 210 of file HolonomicMotionModel.h.
Referenced by HolonomicMotionModel< ParticleT >::getXVariance(), HolonomicMotionModel< ParticleT >::setVariance(), and HolonomicMotionModel< ParticleT >::updateMotion().
float HolonomicMotionModel< ParticleT >::xvel [protected] |
current x velocity
Definition at line 201 of file HolonomicMotionModel.h.
Referenced by HolonomicMotionModel< ParticleT >::getPosition(), HolonomicMotionModel< ParticleT >::getVelocity(), HolonomicMotionModel< ParticleT >::setVelocity(), 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 211 of file HolonomicMotionModel.h.
Referenced by HolonomicMotionModel< ParticleT >::getYVariance(), HolonomicMotionModel< ParticleT >::setVariance(), and HolonomicMotionModel< ParticleT >::updateMotion().
float HolonomicMotionModel< ParticleT >::yvel [protected] |
current y velocity
Definition at line 202 of file HolonomicMotionModel.h.
Referenced by HolonomicMotionModel< ParticleT >::getPosition(), HolonomicMotionModel< ParticleT >::getVelocity(), HolonomicMotionModel< ParticleT >::setVelocity(), and HolonomicMotionModel< ParticleT >::updateMotion().
Tekkotsu v5.1CVS |
Generated Mon May 9 04:59:09 2016 by Doxygen 1.6.3 |