Main MRPT website > C++ reference for MRPT 1.9.9
CActionRobotMovement2D.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 #ifndef CActionRobotMovement2D_H
10 #define CActionRobotMovement2D_H
11 
12 #include <mrpt/obs/CAction.h>
13 #include <mrpt/poses/CPose2D.h>
14 #include <mrpt/poses/CPosePDF.h>
17 
18 namespace mrpt
19 {
20 namespace obs
21 {
22 /** Represents a probabilistic 2D movement of the robot mobile base
23  *
24  * See the tutorial on <a
25  * href="http://www.mrpt.org/Probabilistic_Motion_Models" >probabilistic motion
26  * models</a>.
27  *
28  * \note [New in MRPT 1.5.0] Velocity is now encoded as mrpt::math::TTwist2D as
29  * a more general version of the old (linVel, angVel).
30  * \sa CAction
31  * \ingroup mrpt_obs_grp
32  */
34 {
36 
37  public:
38  /** A list of posible ways for estimating the content of a
39  * CActionRobotMovement2D object.
40  */
42  {
45  };
46 
47  /** Constructor */
49 
50  /** The 2D pose change probabilistic estimation. */
52  /** This is the raw odometry reading, and only is used when
53  * "estimationMethod" is "TEstimationMethod::emOdometry" */
55  /** This fields indicates the way in which this estimation was obtained. */
57 
58  /** If "true" means that "encoderLeftTicks" and "encoderRightTicks" contain
59  * valid values. */
61  /** For odometry only: the ticks count for each wheel FROM the last reading
62  * (positive means FORWARD, for both wheels);
63  * \sa hasEncodersInfo
64  */
66 
67  /** If "true" means that "velocityLin" and "velocityAng" contain valid
68  * values. */
70  /** If "hasVelocities"=true, the robot velocity in local (robot frame, +X
71  * forward) coordinates. */
73 
74  double velocityLin() const { return velocityLocal.vx; }
75  double velocityAng() const { return velocityLocal.omega; }
77  {
80  };
81  /** The parameter to be passed to "computeFromOdometry". */
83  {
84  /** Default values loader. */
86 
87  /** The model to be used. */
89 
90  /** Options for the gaussian model, which generates a CPosePDFGaussian
91  * object in poseChange
92  * See docs in :
93  * http://www.mrpt.org/tutorials/programming/odometry-and-motion-models/probabilistic_motion_models/
94  */
96  {
97  float a1, a2, a3, a4, minStdXY, minStdPHI;
98  } gaussianModel;
99 
100  /** Options for the Thrun's model, which generates a CPosePDFParticles
101  * object in poseChange
102  * See docs in :
103  * http://www.mrpt.org/tutorials/programming/odometry-and-motion-models/probabilistic_motion_models/
104  */
106  {
107  /** The default number of particles to generate in a internal
108  * representation (anyway you can draw as many samples as you want
109  * through CActionRobotMovement2D::drawSingleSample) */
115 
116  /** An additional noise added to the thrun model (std. dev. in
117  * meters and radians). */
119  } thrunModel;
120 
122 
123  /** Computes the PDF of the pose increment from an odometry reading and
124  * according to the given motion model (speed and encoder ticks information
125  * is not modified).
126  * According to the parameters in the passed struct, it will be called one
127  * the private sampling functions (see "see also" next).
128  * \sa computeFromOdometry_modelGaussian, computeFromOdometry_modelThrun
129  */
130  void computeFromOdometry(
131  const mrpt::poses::CPose2D& odometryIncrement,
132  const TMotionModelOptions& options);
133 
134  /** If "hasEncodersInfo"=true, this method updates the pose estimation
135  * according to the ticks from both encoders and the passed parameters,
136  * which is passed internally to the method "computeFromOdometry" with the
137  * last used PDF options (or the defualt ones if not explicitly called by
138  * the user).
139  *
140  * \param K_left The meters / tick ratio for the left encoder.
141  * \param K_right The meters / tick ratio for the right encoder.
142  * \param D The distance between both wheels, in meters.
143  */
144  void computeFromEncoders(double K_left, double K_right, double D);
145 
146  /** Using this method instead of "poseChange->drawSingleSample()" may be
147  * more efficient in most situations.
148  * \sa CPosePDF::drawSingleSample
149  */
150  void drawSingleSample(mrpt::poses::CPose2D& outSample) const;
151 
152  /** Call this before calling a high number of times "fastDrawSingleSample",
153  * which is much faster than "drawSingleSample"
154  */
155  void prepareFastDrawSingleSamples() const;
156 
157  /** Faster version than "drawSingleSample", but requires a previous call to
158  * "prepareFastDrawSingleSamples"
159  */
160  void fastDrawSingleSample(mrpt::poses::CPose2D& outSample) const;
161 
162  protected:
163  /** Computes the PDF of the pose increment from an odometry reading, using a
164  * Gaussian approximation as the motion model.
165  * \sa computeFromOdometry
166  */
168  const mrpt::poses::CPose2D& odometryIncrement,
169  const TMotionModelOptions& o);
170 
171  /** Computes the PDF of the pose increment from an odometry reading, using
172  * the motion model from Thrun's book.
173  * This model is discussed in "Probabilistic Robotics", Thrun, Burgard, and
174  * Fox, 2006, pp.136.
175  * \sa computeFromOdometry
176  */
178  const mrpt::poses::CPose2D& odometryIncrement,
179  const TMotionModelOptions& o);
180 
181  /** The sample generator for the model "computeFromOdometry_modelGaussian",
182  * internally called when the user invokes "drawSingleSample".
183  */
185 
186  /** The sample generator for the model "computeFromOdometry_modelThrun",
187  * internally called when the user invokes "drawSingleSample".
188  */
189  void drawSingleSample_modelThrun(mrpt::poses::CPose2D& outSample) const;
190 
191  /** Internal use
192  */
194 
195  /** Internal use
196  */
198 
199  /** Internal use
200  */
202  mrpt::poses::CPose2D& outSample) const;
203 
204  /** Internal use
205  */
207 
208  /** Auxiliary matrix
209  */
212 
213 }; // End of class def.
214 
215 } // End of namespace
216 } // End of namespace
217 
218 #endif
Options for the gaussian model, which generates a CPosePDFGaussian object in poseChange See docs in :...
TEstimationMethod estimationMethod
This fields indicates the way in which this estimation was obtained.
void drawSingleSample(mrpt::poses::CPose2D &outSample) const
Using this method instead of "poseChange->drawSingleSample()" may be more efficient in most situation...
void drawSingleSample_modelThrun(mrpt::poses::CPose2D &outSample) const
The sample generator for the model "computeFromOdometry_modelThrun", internally called when the user ...
void computeFromOdometry(const mrpt::poses::CPose2D &odometryIncrement, const TMotionModelOptions &options)
Computes the PDF of the pose increment from an odometry reading and according to the given motion mod...
The parameter to be passed to "computeFromOdometry".
void computeFromOdometry_modelGaussian(const mrpt::poses::CPose2D &odometryIncrement, const TMotionModelOptions &o)
Computes the PDF of the pose increment from an odometry reading, using a Gaussian approximation as th...
void drawSingleSample_modelGaussian(mrpt::poses::CPose2D &outSample) const
The sample generator for the model "computeFromOdometry_modelGaussian", internally called when the us...
2D twist: 2D velocity vector (vx,vy) + planar angular velocity (omega)
Represents a probabilistic 2D movement of the robot mobile base.
mrpt::math::CMatrixDouble33 m_fastDrawGauss_Z
Auxiliary matrix.
void fastDrawSingleSample(mrpt::poses::CPose2D &outSample) const
Faster version than "drawSingleSample", but requires a previous call to "prepareFastDrawSingleSamples...
mrpt::utils::poly_ptr_ptr< mrpt::poses::CPosePDF::Ptr > poseChange
The 2D pose change probabilistic estimation.
double vx
Velocity components: X,Y (m/s)
float additional_std_XY
An additional noise added to the thrun model (std.
mrpt::math::TTwist2D velocityLocal
If "hasVelocities"=true, the robot velocity in local (robot frame, +X forward) coordinates.
void computeFromOdometry_modelThrun(const mrpt::poses::CPose2D &odometryIncrement, const TMotionModelOptions &o)
Computes the PDF of the pose increment from an odometry reading, using the motion model from Thrun&#39;s ...
void fastDrawSingleSample_modelThrun(mrpt::poses::CPose2D &outSample) const
Internal use.
int32_t encoderLeftTicks
For odometry only: the ticks count for each wheel FROM the last reading (positive means FORWARD...
void computeFromEncoders(double K_left, double K_right, double D)
If "hasEncodersInfo"=true, this method updates the pose estimation according to the ticks from both e...
TEstimationMethod
A list of posible ways for estimating the content of a CActionRobotMovement2D object.
bool hasEncodersInfo
If "true" means that "encoderLeftTicks" and "encoderRightTicks" contain valid values.
TDrawSampleMotionModel modelSelection
The model to be used.
Options for the Thrun&#39;s model, which generates a CPosePDFParticles object in poseChange See docs in :...
void fastDrawSingleSample_modelGaussian(mrpt::poses::CPose2D &outSample) const
Internal use.
struct mrpt::obs::CActionRobotMovement2D::TMotionModelOptions::TOptions_GaussianModel gaussianModel
Declares a class for storing a robot action.
Definition: CAction.h:28
void prepareFastDrawSingleSamples() const
Call this before calling a high number of times "fastDrawSingleSample", which is much faster than "dr...
__int32 int32_t
Definition: rptypes.h:46
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
void prepareFastDrawSingleSample_modelGaussian() const
Internal use.
struct mrpt::obs::CActionRobotMovement2D::TMotionModelOptions::TOptions_ThrunModel thrunModel
void prepareFastDrawSingleSample_modelThrun() const
Internal use.
A class used to store a 2D pose, including the 2D coordinate point and a heading (phi) angle...
Definition: CPose2D.h:40
uint32_t nParticlesCount
The default number of particles to generate in a internal representation (anyway you can draw as many...
unsigned __int32 uint32_t
Definition: rptypes.h:47
struct mrpt::obs::CActionRobotMovement2D::TMotionModelOptions motionModelConfiguration
double omega
Angular velocity (rad/s)
mrpt::poses::CPose2D rawOdometryIncrementReading
This is the raw odometry reading, and only is used when "estimationMethod" is "TEstimationMethod::emO...
bool hasVelocities
If "true" means that "velocityLin" and "velocityAng" contain valid values.



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019