Main MRPT website > C++ reference for MRPT 1.4.0
obs/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-2016, 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>
15 
16 namespace mrpt
17 {
18  namespace obs
19  {
21 
22  /** Represents a probabilistic 2D movement of the robot mobile base
23  *
24  * See the tutorial on <a href="http://www.mrpt.org/Probabilistic_Motion_Models" >probabilistic motion models</a>.
25  *
26  * \sa CAction
27  * \ingroup mrpt_obs_grp
28  */
30  {
31  // This must be added to any CSerializable derived class:
33 
34  public:
35  /** A list of posible ways for estimating the content of a CActionRobotMovement2D object.
36  */
38  {
39  emOdometry = 0,
40  emScan2DMatching
41  };
42 
43  CActionRobotMovement2D(); //!< Constructor
44  CActionRobotMovement2D(const CActionRobotMovement2D &o); //!< Copy constructor
45  CActionRobotMovement2D & operator =(const CActionRobotMovement2D &o); //!< Copy operator
46  ~CActionRobotMovement2D(); //!< Destructor
47 
48  mrpt::poses::CPosePDFPtr poseChange; //!< The 2D pose change probabilistic estimation.
49  /** This is the raw odometry reading, and only is used when "estimationMethod" is "TEstimationMethod::emOdometry" */
51  TEstimationMethod estimationMethod; //!< This fields indicates the way in which this estimation was obtained.
52 
53  bool hasEncodersInfo; //!< If "true" means that "encoderLeftTicks" and "encoderRightTicks" contain valid values.
54  /** For odometry only: the ticks count for each wheel FROM the last reading (positive means FORWARD, for both wheels);
55  * \sa hasEncodersInfo
56  */
57  int32_t encoderLeftTicks,encoderRightTicks;
58 
59  bool hasVelocities; //!< If "true" means that "velocityLin" and "velocityAng" contain valid values.
60  float velocityLin, velocityAng; //!< The velocity of the robot, linear in meters/sec and angular in rad/sec.
61 
63  {
64  mmGaussian = 0,
65  mmThrun
66  };
67  /** The parameter to be passed to "computeFromOdometry". */
69  {
70  TMotionModelOptions(); //!< Default values loader.
71 
72  TDrawSampleMotionModel modelSelection; //!< The model to be used.
73 
74  /** Options for the gaussian model, which generates a CPosePDFGaussian object in poseChange
75  * See docs in : http://www.mrpt.org/tutorials/programming/odometry-and-motion-models/probabilistic_motion_models/
76  */
78  {
79  float a1,a2,a3,a4,minStdXY,minStdPHI;
80  } gausianModel;
81 
82  /** Options for the Thrun's model, which generates a CPosePDFParticles object in poseChange
83  * See docs in : http://www.mrpt.org/tutorials/programming/odometry-and-motion-models/probabilistic_motion_models/
84  */
86  {
87  /** The default number of particles to generate in a internal representation (anyway you can draw as many samples as you want through CActionRobotMovement2D::drawSingleSample) */
88  uint32_t nParticlesCount;
93 
94  /** An additional noise added to the thrun model (std. dev. in meters and radians). */
95  float additional_std_XY, additional_std_phi;
96  } thrunModel;
97 
98  } motionModelConfiguration;
99 
100  /** Computes the PDF of the pose increment from an odometry reading and according to the given motion model (speed and encoder ticks information is not modified).
101  * According to the parameters in the passed struct, it will be called one the private sampling functions (see "see also" next).
102  * \sa computeFromOdometry_modelGaussian, computeFromOdometry_modelThrun
103  */
105  const mrpt::poses::CPose2D &odometryIncrement,
106  const TMotionModelOptions &options);
107 
108  /** If "hasEncodersInfo"=true, this method updates the pose estimation according to the ticks from both encoders and the passed parameters, which is passed internally to the method "computeFromOdometry" with the last used PDF options (or the defualt ones if not explicitly called by the user).
109  *
110  * \param K_left The meters / tick ratio for the left encoder.
111  * \param K_right The meters / tick ratio for the right encoder.
112  * \param D The distance between both wheels, in meters.
113  */
115  double K_left,
116  double K_right,
117  double D );
118 
119  /** Using this method instead of "poseChange->drawSingleSample()" may be more efficient in most situations.
120  * \sa CPosePDF::drawSingleSample
121  */
122  void drawSingleSample( mrpt::poses::CPose2D &outSample ) const;
123 
124  /** Call this before calling a high number of times "fastDrawSingleSample", which is much faster than "drawSingleSample"
125  */
127 
128  /** Faster version than "drawSingleSample", but requires a previous call to "prepareFastDrawSingleSamples"
129  */
130  void fastDrawSingleSample( mrpt::poses::CPose2D &outSample ) const;
131 
132  protected:
133  /** Computes the PDF of the pose increment from an odometry reading, using a Gaussian approximation as the motion model.
134  * \sa computeFromOdometry
135  */
137  const mrpt::poses::CPose2D &odometryIncrement,
138  const TMotionModelOptions &o
139  );
140 
141  /** Computes the PDF of the pose increment from an odometry reading, using the motion model from Thrun's book.
142  * This model is discussed in "Probabilistic Robotics", Thrun, Burgard, and Fox, 2006, pp.136.
143  * \sa computeFromOdometry
144  */
146  const mrpt::poses::CPose2D &odometryIncrement,
147  const TMotionModelOptions &o
148  );
149 
150  /** The sample generator for the model "computeFromOdometry_modelGaussian", internally called when the user invokes "drawSingleSample".
151  */
153 
154  /** The sample generator for the model "computeFromOdometry_modelThrun", internally called when the user invokes "drawSingleSample".
155  */
157 
158  /** Internal use
159  */
161 
162  /** Internal use
163  */
165 
166  /** Internal use
167  */
169 
170  /** Internal use
171  */
173 
174  /** Auxiliary matrix
175  */
178 
179 
180  }; // End of class def.
182 
183 
184  } // End of namespace
185 } // End of namespace
186 
187 #endif
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
This declaration must be inserted in all CSerializable classes definition, before the class declarati...
A numeric matrix of compile-time fixed size.
Declares a class for storing a robot action.
Definition: obs/CAction.h:34
Represents a probabilistic 2D movement of the robot mobile base.
mrpt::poses::CPose2D rawOdometryIncrementReading
This is the raw odometry reading, and only is used when "estimationMethod" is "TEstimationMethod::emO...
void fastDrawSingleSample(mrpt::poses::CPose2D &outSample) const
Faster version than "drawSingleSample", but requires a previous call to "prepareFastDrawSingleSamples...
float velocityAng
The velocity of the robot, linear in meters/sec and angular in rad/sec.
void prepareFastDrawSingleSample_modelGaussian() const
Internal use.
void prepareFastDrawSingleSamples() const
Call this before calling a high number of times "fastDrawSingleSample", which is much faster than "dr...
void drawSingleSample_modelGaussian(mrpt::poses::CPose2D &outSample) const
The sample generator for the model "computeFromOdometry_modelGaussian", internally called when the us...
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 ...
void drawSingleSample_modelThrun(mrpt::poses::CPose2D &outSample) const
The sample generator for the model "computeFromOdometry_modelThrun", internally called when the user ...
void fastDrawSingleSample_modelThrun(mrpt::poses::CPose2D &outSample) const
Internal use.
void fastDrawSingleSample_modelGaussian(mrpt::poses::CPose2D &outSample) const
Internal use.
bool hasVelocities
If "true" means that "velocityLin" and "velocityAng" contain valid values.
int32_t encoderLeftTicks
For odometry only: the ticks count for each wheel FROM the last reading (positive means FORWARD,...
CActionRobotMovement2D(const CActionRobotMovement2D &o)
Copy constructor.
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 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...
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...
bool hasEncodersInfo
If "true" means that "encoderLeftTicks" and "encoderRightTicks" contain valid values.
void drawSingleSample(mrpt::poses::CPose2D &outSample) const
Using this method instead of "poseChange->drawSingleSample()" may be more efficient in most situation...
TEstimationMethod
A list of posible ways for estimating the content of a CActionRobotMovement2D object.
mrpt::math::CMatrixDouble33 m_fastDrawGauss_Z
Auxiliary matrix.
mrpt::poses::CPosePDFPtr poseChange
The 2D pose change probabilistic estimation.
void prepareFastDrawSingleSample_modelThrun() const
Internal use.
TEstimationMethod estimationMethod
This fields indicates the way in which this estimation was obtained.
A class used to store a 2D pose.
Definition: CPose2D.h:37
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Options for the gaussian model, which generates a CPosePDFGaussian object in poseChange See docs in :...
Options for the Thrun's model, which generates a CPosePDFParticles object in poseChange See docs in :...
uint32_t nParticlesCount
The default number of particles to generate in a internal representation (anyway you can draw as many...
The parameter to be passed to "computeFromOdometry".
TDrawSampleMotionModel modelSelection
The model to be used.



Page generated by Doxygen 1.9.1 for MRPT 1.4.0 SVN: at Fri Sep 3 01:11:30 UTC 2021