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-2018, 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 docs:
25  * https://www.mrpt.org/tutorials/programming/odometry-and-motion-models/probabilistic_motion_models/
26  *
27  * \note [New in MRPT 1.5.0] Velocity is now encoded as mrpt::math::TTwist2D as
28  * a more general version of the old (linVel, angVel).
29  * \sa CAction
30  * \ingroup mrpt_obs_grp
31  */
33 {
35 
36  public:
37  /** A list of posible ways for estimating the content of a
38  * CActionRobotMovement2D object.
39  */
41  {
44  };
45 
47 
48  /** The 2D pose change probabilistic estimation. */
50  /** This is the raw odometry reading, and only is used when
51  * "estimationMethod" is "TEstimationMethod::emOdometry" */
53  /** This fields indicates the way in which this estimation was obtained. */
55 
56  /** If "true" means that "encoderLeftTicks" and "encoderRightTicks" contain
57  * valid values. */
58  bool hasEncodersInfo{false};
59  /** For odometry only: the ticks count for each wheel FROM the last reading
60  * (positive means FORWARD, for both wheels);
61  * \sa hasEncodersInfo
62  */
64 
65  /** If "true" means that "velocityLin" and "velocityAng" contain valid
66  * values. */
67  bool hasVelocities{0};
68  /** If "hasVelocities"=true, the robot velocity in local (robot frame, +X
69  * forward) coordinates. */
71 
72  double velocityLin() const { return velocityLocal.vx; }
73  double velocityAng() const { return velocityLocal.omega; }
75  {
78  };
79  /** The parameter to be passed to "computeFromOdometry". */
81  {
82  /** Default values loader. */
84 
85  /** The model to be used. */
87 
88  /** Options for the gaussian model, which generates a CPosePDFGaussian
89  * object in poseChange
90  * See docs in :
91  * http://www.mrpt.org/tutorials/programming/odometry-and-motion-models/probabilistic_motion_models/
92  */
94  {
95  float a1, a2, a3, a4, minStdXY, minStdPHI;
96  } gaussianModel;
97 
98  /** Options for the Thrun's model, which generates a CPosePDFParticles
99  * object in poseChange
100  * See docs in :
101  * http://www.mrpt.org/tutorials/programming/odometry-and-motion-models/probabilistic_motion_models/
102  */
104  {
105  /** The default number of particles to generate in a internal
106  * representation (anyway you can draw as many samples as you want
107  * through CActionRobotMovement2D::drawSingleSample) */
113 
114  /** An additional noise added to the thrun model (std. dev. in
115  * meters and radians). */
117  } thrunModel;
118 
120 
121  /** Computes the PDF of the pose increment from an odometry reading and
122  * according to the given motion model (speed and encoder ticks information
123  * is not modified).
124  * According to the parameters in the passed struct, it will be called one
125  * the private sampling functions (see "see also" next).
126  * \sa computeFromOdometry_modelGaussian, computeFromOdometry_modelThrun
127  */
128  void computeFromOdometry(
129  const mrpt::poses::CPose2D& odometryIncrement,
130  const TMotionModelOptions& options);
131 
132  /** If "hasEncodersInfo"=true, this method updates the pose estimation
133  * according to the ticks from both encoders and the passed parameters,
134  * which is passed internally to the method "computeFromOdometry" with the
135  * last used PDF options (or the defualt ones if not explicitly called by
136  * the user).
137  *
138  * \param K_left The meters / tick ratio for the left encoder.
139  * \param K_right The meters / tick ratio for the right encoder.
140  * \param D The distance between both wheels, in meters.
141  */
142  void computeFromEncoders(double K_left, double K_right, double D);
143 
144  /** Using this method instead of "poseChange->drawSingleSample()" may be
145  * more efficient in most situations.
146  * \sa CPosePDF::drawSingleSample
147  */
148  void drawSingleSample(mrpt::poses::CPose2D& outSample) const;
149 
150  /** Call this before calling a high number of times "fastDrawSingleSample",
151  * which is much faster than "drawSingleSample"
152  */
153  void prepareFastDrawSingleSamples() const;
154 
155  /** Faster version than "drawSingleSample", but requires a previous call to
156  * "prepareFastDrawSingleSamples"
157  */
158  void fastDrawSingleSample(mrpt::poses::CPose2D& outSample) const;
159 
160  protected:
161  /** Computes the PDF of the pose increment from an odometry reading, using a
162  * Gaussian approximation as the motion model.
163  * \sa computeFromOdometry
164  */
166  const mrpt::poses::CPose2D& odometryIncrement,
167  const TMotionModelOptions& o);
168 
169  /** Computes the PDF of the pose increment from an odometry reading, using
170  * the motion model from Thrun's book.
171  * This model is discussed in "Probabilistic Robotics", Thrun, Burgard, and
172  * Fox, 2006, pp.136.
173  * \sa computeFromOdometry
174  */
176  const mrpt::poses::CPose2D& odometryIncrement,
177  const TMotionModelOptions& o);
178 
179  /** The sample generator for the model "computeFromOdometry_modelGaussian",
180  * internally called when the user invokes "drawSingleSample".
181  */
183 
184  /** The sample generator for the model "computeFromOdometry_modelThrun",
185  * internally called when the user invokes "drawSingleSample".
186  */
187  void drawSingleSample_modelThrun(mrpt::poses::CPose2D& outSample) const;
188 
189  /** Internal use
190  */
192 
193  /** Internal use
194  */
196 
197  /** Internal use
198  */
200  mrpt::poses::CPose2D& outSample) const;
201 
202  /** Internal use
203  */
205 
206  /** Auxiliary matrix
207  */
210 
211 }; // End of class def.
212 
213 } // namespace obs
214 } // namespace mrpt
215 
216 #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.
Wrapper to a std::shared_ptr<>, adding deep-copy semantics to copy ctor and copy operator, suitable for polymorphic classes with a clone() method.
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...
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:27
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
mrpt::containers::deepcopy_poly_ptr< mrpt::poses::CPosePDF::Ptr > poseChange
The 2D pose change probabilistic estimation.
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: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at lun oct 28 00:14:14 CET 2019