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
mrpt::obs::CActionRobotMovement2D::m_fastDrawGauss_M
mrpt::poses::CPose2D m_fastDrawGauss_M
Definition: CActionRobotMovement2D.h:209
mrpt::obs::CActionRobotMovement2D::emScan2DMatching
@ emScan2DMatching
Definition: CActionRobotMovement2D.h:43
mrpt::obs::CActionRobotMovement2D::TMotionModelOptions::TOptions_ThrunModel::alfa3_trans_trans
float alfa3_trans_trans
Definition: CActionRobotMovement2D.h:111
mrpt::obs::CActionRobotMovement2D::drawSingleSample_modelGaussian
void drawSingleSample_modelGaussian(mrpt::poses::CPose2D &outSample) const
The sample generator for the model "computeFromOdometry_modelGaussian", internally called when the us...
Definition: CActionRobotMovement2D.cpp:560
mrpt::obs::CActionRobotMovement2D::prepareFastDrawSingleSample_modelThrun
void prepareFastDrawSingleSample_modelThrun() const
Internal use.
Definition: CActionRobotMovement2D.cpp:695
mrpt::obs::CActionRobotMovement2D::TMotionModelOptions::modelSelection
TDrawSampleMotionModel modelSelection
The model to be used.
Definition: CActionRobotMovement2D.h:86
mrpt::obs::CActionRobotMovement2D::TMotionModelOptions::TOptions_ThrunModel
Options for the Thrun's model, which generates a CPosePDFParticles object in poseChange See docs in :...
Definition: CActionRobotMovement2D.h:103
mrpt::obs::CActionRobotMovement2D::TMotionModelOptions::TMotionModelOptions
TMotionModelOptions()
Default values loader.
Definition: CActionRobotMovement2D.cpp:398
mrpt::obs::CActionRobotMovement2D::velocityAng
double velocityAng() const
Definition: CActionRobotMovement2D.h:73
mrpt::obs::CActionRobotMovement2D::hasVelocities
bool hasVelocities
If "true" means that "velocityLin" and "velocityAng" contain valid values.
Definition: CActionRobotMovement2D.h:67
mrpt::obs::CActionRobotMovement2D::TMotionModelOptions::thrunModel
struct mrpt::obs::CActionRobotMovement2D::TMotionModelOptions::TOptions_ThrunModel thrunModel
mrpt::obs::CActionRobotMovement2D::drawSingleSample
void drawSingleSample(mrpt::poses::CPose2D &outSample) const
Using this method instead of "poseChange->drawSingleSample()" may be more efficient in most situation...
Definition: CActionRobotMovement2D.cpp:539
mrpt::math::TTwist2D::vx
double vx
Velocity components: X,Y (m/s)
Definition: lightweight_geom_data.h:2152
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CKalmanFilterCapable.h:30
mrpt::obs::CActionRobotMovement2D::TMotionModelOptions::TOptions_GaussianModel::a4
float a4
Definition: CActionRobotMovement2D.h:95
mrpt::obs::CActionRobotMovement2D
Represents a probabilistic 2D movement of the robot mobile base.
Definition: CActionRobotMovement2D.h:32
CPose2D.h
mrpt::obs::CActionRobotMovement2D::drawSingleSample_modelThrun
void drawSingleSample_modelThrun(mrpt::poses::CPose2D &outSample) const
The sample generator for the model "computeFromOdometry_modelThrun", internally called when the user ...
Definition: CActionRobotMovement2D.cpp:571
mrpt::obs::CActionRobotMovement2D::computeFromOdometry_modelThrun
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's ...
Definition: CActionRobotMovement2D.cpp:474
mrpt::obs::CActionRobotMovement2D::m_fastDrawGauss_Z
mrpt::math::CMatrixDouble33 m_fastDrawGauss_Z
Auxiliary matrix.
Definition: CActionRobotMovement2D.h:208
mrpt::obs::CActionRobotMovement2D::TMotionModelOptions::TOptions_GaussianModel::a3
float a3
Definition: CActionRobotMovement2D.h:95
mrpt::obs::CActionRobotMovement2D::velocityLin
double velocityLin() const
Definition: CActionRobotMovement2D.h:72
lightweight_geom_data.h
mrpt::obs::CActionRobotMovement2D::estimationMethod
TEstimationMethod estimationMethod
This fields indicates the way in which this estimation was obtained.
Definition: CActionRobotMovement2D.h:54
mrpt::obs::CActionRobotMovement2D::TMotionModelOptions::TOptions_ThrunModel::alfa4_trans_rot
float alfa4_trans_rot
Definition: CActionRobotMovement2D.h:112
mrpt::obs::CActionRobotMovement2D::emOdometry
@ emOdometry
Definition: CActionRobotMovement2D.h:42
mrpt::obs::CActionRobotMovement2D::rawOdometryIncrementReading
mrpt::poses::CPose2D rawOdometryIncrementReading
This is the raw odometry reading, and only is used when "estimationMethod" is "TEstimationMethod::emO...
Definition: CActionRobotMovement2D.h:52
CPosePDF.h
mrpt::obs::CActionRobotMovement2D::TMotionModelOptions::TOptions_GaussianModel::a1
float a1
Definition: CActionRobotMovement2D.h:95
mrpt::poses::CPose2D
A class used to store a 2D pose, including the 2D coordinate point and a heading (phi) angle.
Definition: CPose2D.h:40
mrpt::obs::CActionRobotMovement2D::mmGaussian
@ mmGaussian
Definition: CActionRobotMovement2D.h:76
mrpt::obs::CActionRobotMovement2D::CActionRobotMovement2D
CActionRobotMovement2D()
Definition: CActionRobotMovement2D.cpp:30
mrpt::obs::CActionRobotMovement2D::fastDrawSingleSample
void fastDrawSingleSample(mrpt::poses::CPose2D &outSample) const
Faster version than "drawSingleSample", but requires a previous call to "prepareFastDrawSingleSamples...
Definition: CActionRobotMovement2D.cpp:643
mrpt::obs::CActionRobotMovement2D::encoderRightTicks
int32_t encoderRightTicks
Definition: CActionRobotMovement2D.h:63
mrpt::containers::deepcopy_poly_ptr< mrpt::poses::CPosePDF::Ptr >
mrpt::obs::CActionRobotMovement2D::TMotionModelOptions::gaussianModel
struct mrpt::obs::CActionRobotMovement2D::TMotionModelOptions::TOptions_GaussianModel gaussianModel
mrpt::obs::CActionRobotMovement2D::TMotionModelOptions::TOptions_ThrunModel::additional_std_XY
float additional_std_XY
An additional noise added to the thrun model (std.
Definition: CActionRobotMovement2D.h:116
mrpt::obs::CActionRobotMovement2D::TMotionModelOptions::TOptions_GaussianModel
Options for the gaussian model, which generates a CPosePDFGaussian object in poseChange See docs in :...
Definition: CActionRobotMovement2D.h:93
mrpt::math::CMatrixFixedNumeric< double, 3, 3 >
mrpt::obs::CActionRobotMovement2D::mmThrun
@ mmThrun
Definition: CActionRobotMovement2D.h:77
mrpt::obs::CActionRobotMovement2D::computeFromOdometry_modelGaussian
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...
Definition: CActionRobotMovement2D.cpp:423
int32_t
__int32 int32_t
Definition: rptypes.h:46
CAction.h
mrpt::obs::CActionRobotMovement2D::computeFromEncoders
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...
Definition: CActionRobotMovement2D.cpp:350
mrpt::obs::CActionRobotMovement2D::TMotionModelOptions::TOptions_ThrunModel::nParticlesCount
uint32_t nParticlesCount
The default number of particles to generate in a internal representation (anyway you can draw as many...
Definition: CActionRobotMovement2D.h:108
DEFINE_SERIALIZABLE
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
Definition: CSerializable.h:102
mrpt::obs::CActionRobotMovement2D::TMotionModelOptions::TOptions_ThrunModel::alfa2_rot_trans
float alfa2_rot_trans
Definition: CActionRobotMovement2D.h:110
mrpt::obs::CActionRobotMovement2D::velocityLocal
mrpt::math::TTwist2D velocityLocal
If "hasVelocities"=true, the robot velocity in local (robot frame, +X forward) coordinates.
Definition: CActionRobotMovement2D.h:70
mrpt::obs::CActionRobotMovement2D::TMotionModelOptions::TOptions_GaussianModel::minStdPHI
float minStdPHI
Definition: CActionRobotMovement2D.h:95
mrpt::obs::CActionRobotMovement2D::TMotionModelOptions::TOptions_GaussianModel::minStdXY
float minStdXY
Definition: CActionRobotMovement2D.h:95
deepcopy_poly_ptr.h
mrpt::obs::CActionRobotMovement2D::hasEncodersInfo
bool hasEncodersInfo
If "true" means that "encoderLeftTicks" and "encoderRightTicks" contain valid values.
Definition: CActionRobotMovement2D.h:58
mrpt::obs::CActionRobotMovement2D::poseChange
mrpt::containers::deepcopy_poly_ptr< mrpt::poses::CPosePDF::Ptr > poseChange
The 2D pose change probabilistic estimation.
Definition: CActionRobotMovement2D.h:49
mrpt::obs::CActionRobotMovement2D::prepareFastDrawSingleSample_modelGaussian
void prepareFastDrawSingleSample_modelGaussian() const
Internal use.
Definition: CActionRobotMovement2D.cpp:664
mrpt::obs::CActionRobotMovement2D::prepareFastDrawSingleSamples
void prepareFastDrawSingleSamples() const
Call this before calling a high number of times "fastDrawSingleSample", which is much faster than "dr...
Definition: CActionRobotMovement2D.cpp:627
mrpt::obs::CAction
Declares a class for storing a robot action.
Definition: CAction.h:27
mrpt::obs::CActionRobotMovement2D::TMotionModelOptions::TOptions_ThrunModel::alfa1_rot_rot
float alfa1_rot_rot
Definition: CActionRobotMovement2D.h:109
mrpt::obs::CActionRobotMovement2D::computeFromOdometry
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...
Definition: CActionRobotMovement2D.cpp:381
mrpt::obs::CActionRobotMovement2D::TMotionModelOptions::TOptions_GaussianModel::a2
float a2
Definition: CActionRobotMovement2D.h:95
mrpt::obs::CActionRobotMovement2D::fastDrawSingleSample_modelThrun
void fastDrawSingleSample_modelThrun(mrpt::poses::CPose2D &outSample) const
Internal use.
Definition: CActionRobotMovement2D.cpp:719
mrpt::obs::CActionRobotMovement2D::TMotionModelOptions
The parameter to be passed to "computeFromOdometry".
Definition: CActionRobotMovement2D.h:80
mrpt::obs::CActionRobotMovement2D::fastDrawSingleSample_modelGaussian
void fastDrawSingleSample_modelGaussian(mrpt::poses::CPose2D &outSample) const
Internal use.
Definition: CActionRobotMovement2D.cpp:699
mrpt::obs::CActionRobotMovement2D::motionModelConfiguration
struct mrpt::obs::CActionRobotMovement2D::TMotionModelOptions motionModelConfiguration
mrpt::math::TTwist2D::omega
double omega
Angular velocity (rad/s)
Definition: lightweight_geom_data.h:2154
mrpt::obs::CActionRobotMovement2D::TMotionModelOptions::TOptions_ThrunModel::additional_std_phi
float additional_std_phi
Definition: CActionRobotMovement2D.h:116
uint32_t
unsigned __int32 uint32_t
Definition: rptypes.h:47
mrpt::obs::CActionRobotMovement2D::TEstimationMethod
TEstimationMethod
A list of posible ways for estimating the content of a CActionRobotMovement2D object.
Definition: CActionRobotMovement2D.h:40
mrpt::obs::CActionRobotMovement2D::encoderLeftTicks
int32_t encoderLeftTicks
For odometry only: the ticks count for each wheel FROM the last reading (positive means FORWARD,...
Definition: CActionRobotMovement2D.h:63
mrpt::obs::CActionRobotMovement2D::TDrawSampleMotionModel
TDrawSampleMotionModel
Definition: CActionRobotMovement2D.h:74
mrpt::math::TTwist2D
2D twist: 2D velocity vector (vx,vy) + planar angular velocity (omega)
Definition: lightweight_geom_data.h:2145



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST