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