44 if (estimationMethod == emOdometry)
47 out << rawOdometryIncrementReading;
49 out << motionModelConfiguration.gaussianModel.a1
50 << motionModelConfiguration.gaussianModel.a2
51 << motionModelConfiguration.gaussianModel.a3
52 << motionModelConfiguration.gaussianModel.a4
53 << motionModelConfiguration.gaussianModel.minStdXY
54 << motionModelConfiguration.gaussianModel.minStdPHI;
56 out << motionModelConfiguration.thrunModel.nParticlesCount
57 << motionModelConfiguration.thrunModel.alfa1_rot_rot
58 << motionModelConfiguration.thrunModel.alfa2_rot_trans
59 << motionModelConfiguration.thrunModel.alfa3_trans_trans
60 << motionModelConfiguration.thrunModel.alfa4_trans_rot
61 << motionModelConfiguration.thrunModel.additional_std_XY
62 << motionModelConfiguration.thrunModel.additional_std_phi;
72 if (hasVelocities) out << velocityLocal;
74 out << hasEncodersInfo;
76 out << encoderLeftTicks << encoderRightTicks;
101 if (estimationMethod == emOdometry)
104 in >> rawOdometryIncrementReading;
107 motionModelConfiguration.modelSelection =
110 in >> motionModelConfiguration.gaussianModel.a1 >>
111 motionModelConfiguration.gaussianModel.a2 >>
112 motionModelConfiguration.gaussianModel.a3 >>
113 motionModelConfiguration.gaussianModel.a4 >>
114 motionModelConfiguration.gaussianModel.minStdXY >>
115 motionModelConfiguration.gaussianModel.minStdPHI;
118 motionModelConfiguration.thrunModel.nParticlesCount = i;
119 in >> motionModelConfiguration.thrunModel.alfa1_rot_rot >>
120 motionModelConfiguration.thrunModel.alfa2_rot_trans >>
121 motionModelConfiguration.thrunModel.alfa3_trans_trans >>
122 motionModelConfiguration.thrunModel.alfa4_trans_rot;
127 motionModelConfiguration.thrunModel.additional_std_XY >>
128 motionModelConfiguration.thrunModel.additional_std_phi;
132 motionModelConfiguration.thrunModel.additional_std_XY =
133 motionModelConfiguration.thrunModel.additional_std_phi =
139 rawOdometryIncrementReading, motionModelConfiguration);
152 if (hasVelocities)
in >> velocityLocal;
156 float velocityLin, velocityAng;
157 in >> velocityLin >> velocityAng;
158 velocityLocal.vx = velocityLin;
159 velocityLocal.vy = .0f;
160 velocityLocal.omega = velocityAng;
162 in >> hasEncodersInfo;
163 if (version < 7 || hasEncodersInfo)
166 encoderLeftTicks = i;
168 encoderRightTicks = i;
172 encoderLeftTicks = 0;
173 encoderRightTicks = 0;
194 if (estimationMethod == emOdometry)
197 in >> rawOdometryIncrementReading;
200 motionModelConfiguration.modelSelection =
203 float dum1, dum2, dum3;
205 in >> dum1 >> dum2 >> dum3 >>
206 motionModelConfiguration.gaussianModel.minStdXY >>
207 motionModelConfiguration.gaussianModel.minStdPHI;
211 motionModelConfiguration.thrunModel.nParticlesCount = i;
212 in >> motionModelConfiguration.thrunModel.alfa1_rot_rot;
213 in >> motionModelConfiguration.thrunModel.alfa2_rot_trans >>
214 motionModelConfiguration.thrunModel.alfa3_trans_trans >>
215 motionModelConfiguration.thrunModel.alfa4_trans_rot;
219 rawOdometryIncrementReading, motionModelConfiguration);
231 float velocityLin, velocityAng;
232 in >> velocityLin >> velocityAng;
233 velocityLocal.vx = velocityLin;
234 velocityLocal.vy = .0f;
235 velocityLocal.omega = velocityAng;
237 in >> hasEncodersInfo;
240 encoderLeftTicks = i;
242 encoderRightTicks = i;
257 if (estimationMethod == emOdometry)
260 in >> rawOdometryIncrementReading;
266 in.ReadBuffer(&dummy,
sizeof(dummy));
272 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;
292 encoderLeftTicks = i;
294 encoderRightTicks = i;
312 if (estimationMethod == emOdometry)
313 poseChange->getMean(rawOdometryIncrementReading);
315 rawOdometryIncrementReading =
CPose2D(0, 0, 0);
321 float velocityLin, velocityAng;
322 in >> velocityLin >> velocityAng;
323 velocityLocal.vx = velocityLin;
324 velocityLocal.vy = .0f;
325 velocityLocal.omega = velocityAng;
327 in >> hasEncodersInfo;
329 encoderLeftTicks = i;
331 encoderRightTicks = i;
336 hasVelocities = hasEncodersInfo =
false;
337 encoderLeftTicks = encoderRightTicks = 0;
351 double K_left,
double K_right,
double D)
356 0.5 * (K_right * encoderRightTicks + K_left * encoderLeftTicks);
358 (K_right * encoderRightTicks - K_left * encoderLeftTicks) / D;
363 const double R = As / Aphi;
365 y =
R * (1 - cos(Aphi));
374 computeFromOdometry(
CPose2D(
x,
y, Aphi), motionModelConfiguration);
385 estimationMethod = emOdometry;
386 rawOdometryIncrementReading = odometryIncrement;
387 motionModelConfiguration = options;
390 computeFromOdometry_modelGaussian(odometryIncrement, options);
392 computeFromOdometry_modelThrun(odometryIncrement, options);
428 poseChange = mrpt::make_aligned_shared<CPosePDFGaussian>();
436 double Al = odometryIncrement.
norm();
452 double cos_Aphi_2 = cos(odometryIncrement.
phi() / 2);
453 double sin_Aphi_2 = sin(odometryIncrement.
phi() / 2);
455 H(0, 0) = H(1, 1) = cos_Aphi_2;
456 H(0, 1) = -(H(1, 0) = sin_Aphi_2);
461 J(0, 2) = -sin_Aphi_2 * ODO_INCR(0, 0) - cos_Aphi_2 * ODO_INCR(1, 0);
462 J(1, 2) = cos_Aphi_2 * ODO_INCR(0, 0) - sin_Aphi_2 * ODO_INCR(1, 0);
465 aux->
mean = odometryIncrement;
468 J.multiply_HCHt(C_ODO, aux->
cov);
482 poseChange = mrpt::make_aligned_shared<CPosePDFParticles>();
496 float Arot1 = (odometryIncrement.
y() != 0 || odometryIncrement.
x() != 0)
497 ? atan2(odometryIncrement.
y(), odometryIncrement.
x())
499 float Atrans = odometryIncrement.
norm();
505 float Arot1_draw = Arot1 -
514 float Arot2_draw = Arot2 -
521 Atrans_draw * cos(Arot1_draw) +
525 Atrans_draw * sin(Arot1_draw) +
529 Arot1_draw + Arot2_draw +
600 (fabs(Arot1) + fabs(Arot2))) *
610 Atrans_draw * cos(Arot1_draw) +
614 Atrans_draw * sin(Arot1_draw) +
618 Arot1_draw + Arot2_draw +
686 D = D.array().sqrt().matrix();
703 for (
size_t i = 0; i < 3; i++)
706 for (
size_t d = 0; d < 3; d++)