34 rawOdometryIncrementReading(),
35 estimationMethod(emOdometry),
36 hasEncodersInfo(false),
40 velocityLocal(.0,.0,.0),
41 motionModelConfiguration(),
63 if ( estimationMethod == emOdometry )
66 out << rawOdometryIncrementReading;
68 i =
static_cast<uint32_t>(motionModelConfiguration.modelSelection);
70 out << motionModelConfiguration.gaussianModel.a1
71 << motionModelConfiguration.gaussianModel.a2
72 << motionModelConfiguration.gaussianModel.a3
73 << motionModelConfiguration.gaussianModel.a4
74 << motionModelConfiguration.gaussianModel.minStdXY
75 << motionModelConfiguration.gaussianModel.minStdPHI;
77 out << motionModelConfiguration.thrunModel.nParticlesCount
78 << motionModelConfiguration.thrunModel.alfa1_rot_rot
79 << motionModelConfiguration.thrunModel.alfa2_rot_trans
80 << motionModelConfiguration.thrunModel.alfa3_trans_trans
81 << motionModelConfiguration.thrunModel.alfa4_trans_rot
82 << motionModelConfiguration.thrunModel.additional_std_XY
83 << motionModelConfiguration.thrunModel.additional_std_phi;
96 out << hasEncodersInfo;
98 out << encoderLeftTicks << encoderRightTicks;
125 if ( estimationMethod == emOdometry )
128 in >> rawOdometryIncrementReading;
133 in >> motionModelConfiguration.gaussianModel.a1
134 >> motionModelConfiguration.gaussianModel.a2
135 >> motionModelConfiguration.gaussianModel.a3
136 >> motionModelConfiguration.gaussianModel.a4
137 >> motionModelConfiguration.gaussianModel.minStdXY
138 >> motionModelConfiguration.gaussianModel.minStdPHI;
140 in >> i; motionModelConfiguration.thrunModel.nParticlesCount=i;
141 in >> motionModelConfiguration.thrunModel.alfa1_rot_rot
142 >> motionModelConfiguration.thrunModel.alfa2_rot_trans
143 >> motionModelConfiguration.thrunModel.alfa3_trans_trans
144 >> motionModelConfiguration.thrunModel.alfa4_trans_rot;
148 in >> motionModelConfiguration.thrunModel.additional_std_XY
149 >> motionModelConfiguration.thrunModel.additional_std_phi;
153 motionModelConfiguration.thrunModel.additional_std_XY =
154 motionModelConfiguration.thrunModel.additional_std_phi = 0;
158 computeFromOdometry( rawOdometryIncrementReading,motionModelConfiguration );
174 float velocityLin, velocityAng;
175 in >> velocityLin >> velocityAng;
176 velocityLocal.vx = velocityLin;
177 velocityLocal.vy = .0f;
178 velocityLocal.omega = velocityAng;
180 in >> hasEncodersInfo;
181 if (
version < 7 || hasEncodersInfo) {
182 in >> i; encoderLeftTicks = i;
183 in >> i; encoderRightTicks = i;
186 encoderLeftTicks = 0;
187 encoderRightTicks = 0;
206 if ( estimationMethod == emOdometry )
209 in >> rawOdometryIncrementReading;
214 float dum1,dum2,dum3;
216 in >> dum1 >> dum2 >> dum3 >> motionModelConfiguration.gaussianModel.minStdXY >> motionModelConfiguration.gaussianModel.minStdPHI;
219 in >> i; motionModelConfiguration.thrunModel.nParticlesCount=i;
220 in >> motionModelConfiguration.thrunModel.alfa1_rot_rot;
221 in >> motionModelConfiguration.thrunModel.alfa2_rot_trans >> motionModelConfiguration.thrunModel.alfa3_trans_trans >> motionModelConfiguration.thrunModel.alfa4_trans_rot;
224 computeFromOdometry( rawOdometryIncrementReading,motionModelConfiguration );
236 float velocityLin, velocityAng;
237 in >> velocityLin >> velocityAng;
238 velocityLocal.vx = velocityLin;
239 velocityLocal.vy = .0f;
240 velocityLocal.omega = velocityAng;
242 in >> hasEncodersInfo;
244 in >> i; encoderLeftTicks=i;
245 in >> i; encoderRightTicks=i;
259 if ( estimationMethod == emOdometry )
262 in >> rawOdometryIncrementReading;
267 in.ReadBuffer( &dummy,
sizeof(dummy) );
272 computeFromOdometry( rawOdometryIncrementReading,motionModelConfiguration );
284 float velocityLin, velocityAng;
285 in >> velocityLin >> velocityAng;
286 velocityLocal.vx = velocityLin;
287 velocityLocal.vy = .0f;
288 velocityLocal.omega = velocityAng;
290 in >> hasEncodersInfo;
291 in >> i; encoderLeftTicks=i;
292 in >> i; encoderRightTicks=i;
310 if (estimationMethod==emOdometry)
311 poseChange->getMean( rawOdometryIncrementReading );
312 else rawOdometryIncrementReading =
CPose2D(0,0,0);
318 float velocityLin, velocityAng;
319 in >> velocityLin >> velocityAng;
320 velocityLocal.vx = velocityLin;
321 velocityLocal.vy = .0f;
322 velocityLocal.omega = velocityAng;
324 in >> hasEncodersInfo;
325 in >> i; encoderLeftTicks = i;
326 in >> i; encoderRightTicks = i;
331 hasVelocities = hasEncodersInfo =
false;
332 encoderLeftTicks= encoderRightTicks= 0;
354 const double As = 0.5* ( K_right*encoderRightTicks + K_left*encoderLeftTicks );
355 const double Aphi = ( K_right*encoderRightTicks - K_left*encoderLeftTicks ) / D;
360 const double R = As/Aphi;
371 computeFromOdometry(
CPose2D(
x,
y,Aphi), motionModelConfiguration );
379 const CPose2D &odometryIncrement,
383 estimationMethod = emOdometry;
384 rawOdometryIncrementReading = odometryIncrement;
385 motionModelConfiguration = options;
388 computeFromOdometry_modelGaussian( odometryIncrement, options );
389 else computeFromOdometry_modelThrun( odometryIncrement, options );
422 const CPose2D &odometryIncrement,
436 double Al = odometryIncrement.
norm();
446 double cos_Aphi_2 = cos( odometryIncrement.
phi()/2 );
447 double sin_Aphi_2 = sin( odometryIncrement.
phi()/2 );
449 H(0,0) = H(1,1) = cos_Aphi_2 ;
450 H(0,1) = - (H(1,0) = sin_Aphi_2);
455 J(0,2) = -sin_Aphi_2 * ODO_INCR(0,0) - cos_Aphi_2 * ODO_INCR(1,0);
456 J(1,2) = cos_Aphi_2 * ODO_INCR(0,0) - sin_Aphi_2 * ODO_INCR(1,0);
459 aux->
mean = odometryIncrement;
462 J.multiply_HCHt( C_ODO, aux->
cov );
470 const CPose2D &odometryIncrement,
477 static CPose2D nullPose(0,0,0);
491 float Arot1 = ( odometryIncrement.
y()!=0 || odometryIncrement.
x()!=0) ?
492 atan2( odometryIncrement.
y(), odometryIncrement.
x() ) : 0;
493 float Atrans = odometryIncrement.
norm();
630 D = D.array().sqrt().matrix();
649 for (
size_t i=0;i<3;i++)
652 for (
size_t d=0;d<3;d++)
struct OBS_IMPEXP mrpt::obs::CActionRobotMovement2D::TMotionModelOptions motionModelConfiguration
A namespace of pseudo-random numbers genrators of diferent distributions.
double x() const
Common members of all points & poses classes.
mrpt::utils::poly_ptr_ptr< mrpt::poses::CPosePDFPtr > poseChange
The 2D pose change probabilistic estimation.
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
CPose2D mean
The mean value.
CMatrixFixedNumeric< double, 3, 1 > CMatrixDouble31
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 readFromStream(mrpt::utils::CStream &in, int version)
Introduces a pure virtual method responsible for loading from a CStream This can not be used directly...
void drawSingleSample_modelThrun(mrpt::poses::CPose2D &outSample) const
The sample generator for the model "computeFromOdometry_modelThrun", internally called when the user ...
T::value_type * pointer()
BASE_IMPEXP CRandomGenerator randomGenerator
A static instance of a CRandomGenerator class, for use in single-thread applications.
Column vector, like Eigen::MatrixX*, but automatically initialized to zeros since construction...
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".
IMPLEMENTS_SERIALIZABLE(CLogFileRecord_FullEval, CHolonomicLogFileRecord, mrpt::nav) IMPLEMENTS_SERIALIZABLE(CHolonomicFullEval
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...
mrpt::math::CMatrixDouble33 cov
The 3x3 covariance matrix.
double drawGaussian1D_normalized(double *likelihood=NULL)
Generate a normalized (mean=0, std=1) normally distributed sample.
void drawSingleSample_modelGaussian(mrpt::poses::CPose2D &outSample) const
The sample generator for the model "computeFromOdometry_modelGaussian", internally called when the us...
mrpt::poses::CPose2D m_fastDrawGauss_M
T square(const T x)
Inline function for the square of a number.
2D twist: 2D velocity vector (vx,vy) + planar angular velocity (omega)
Represents a probabilistic 2D movement of the robot mobile base.
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
CParticleList m_particles
The array of particles.
TMotionModelOptions()
Default values loader.
A numeric matrix of compile-time fixed size.
This base provides a set of functions for maths stuff.
mrpt::math::CMatrixDouble33 m_fastDrawGauss_Z
Auxiliary matrix.
Declares a class that represents a Probability Density function (PDF) of a 2D pose ...
void fastDrawSingleSample(mrpt::poses::CPose2D &outSample) const
Faster version than "drawSingleSample", but requires a previous call to "prepareFastDrawSingleSamples...
Eigen::Matrix< typename MATRIX::Scalar, MATRIX::ColsAtCompileTime, MATRIX::ColsAtCompileTime > cov(const MATRIX &v)
Computes the covariance matrix from a list of samples in an NxM matrix, where each row is a sample...
double norm() const
Returns the euclidean norm of vector: .
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
float additional_std_XY
An additional noise added to the thrun model (std.
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 fastDrawSingleSample_modelThrun(mrpt::poses::CPose2D &outSample) const
Internal use.
This namespace contains representation of robot actions and observations.
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.
Declares a class that represents a Probability Density Function (PDF) over a 2D pose (x...
T wrapToPi(T a)
Modifies the given angle to translate it into the ]-pi,pi] range.
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
TDrawSampleMotionModel modelSelection
The model to be used.
#define INVALID_TIMESTAMP
Represents an invalid timestamp, where applicable.
void fastDrawSingleSample_modelGaussian(mrpt::poses::CPose2D &outSample) const
Internal use.
Declares a class for storing a robot action.
void prepareFastDrawSingleSamples() const
Call this before calling a high number of times "fastDrawSingleSample", which is much faster than "dr...
void prepareFastDrawSingleSample_modelGaussian() const
Internal use.
void prepareFastDrawSingleSample_modelThrun() const
Internal use.
A class used to store a 2D pose, including the 2D coordinate point and a heading (phi) angle...
void resetDeterministic(const CPose2D &location, size_t particlesCount=0)
Reset the PDF to a single point: All m_particles will be set exactly to the supplied pose...
const double & phi() const
Get the phi angle of the 2D pose (in radians)
#define IS_CLASS(ptrObj, class_name)
Evaluates to true if the given pointer to an object (derived from mrpt::utils::CSerializable) is of t...
uint32_t nParticlesCount
The default number of particles to generate in a internal representation (anyway you can draw as many...
struct OBS_IMPEXP mrpt::obs::CActionRobotMovement2D::TMotionModelOptions::TOptions_GaussianModel gaussianModel
void writeToStream(mrpt::utils::CStream &out, int *getVersion) const
Introduces a pure virtual method responsible for writing to a CStream.
unsigned __int32 uint32_t
struct OBS_IMPEXP mrpt::obs::CActionRobotMovement2D::TMotionModelOptions::TOptions_ThrunModel thrunModel
void normalizePhi()
Forces "phi" to be in the range [-pi,pi];.
mrpt::poses::CPose2D rawOdometryIncrementReading
This is the raw odometry reading, and only is used when "estimationMethod" is "TEstimationMethod::emO...