30 using namespace gtsam;
33 static const double kTol = 1
e-8;
106 Gal3 g_from_matrix(M_known);
110 Matrix5 M_invalid_zero = M_known;
111 M_invalid_zero(4, 0) = 1
e-5;
113 Gal3 g_invalid(M_invalid_zero);
114 FAIL(
"Constructor should have thrown for invalid matrix structure (zero violation).");
115 }
catch (
const std::invalid_argument&
e) {
118 FAIL(
"Constructor threw unexpected exception type for invalid matrix.");
122 Matrix5 M_invalid_diag = M_known;
123 M_invalid_diag(3, 3) = 0.9;
125 Gal3 g_invalid(M_invalid_diag);
126 FAIL(
"Constructor should have thrown for invalid matrix structure (M(3,3) != 1).");
127 }
catch (
const std::invalid_argument&
e) {
130 FAIL(
"Constructor threw unexpected exception type for invalid matrix.");
138 const Matrix3 expected_R_mat = Matrix3::Identity();
139 const Vector3 expected_r_vec = Vector3::Zero();
140 const Vector3 expected_v_vec = Vector3::Zero();
141 const double expected_t_val = 0.0;
143 Gal3 custom_ident = Gal3::Identity();
159 -0.9919387548344049, 0.41796965721894275, -0.08567669832855362,
160 -0.24728318780816563, 0.42470896104182426, 0.37654216726012074,
161 -0.4665439537974297, -0.46391731412948783, -0.46638346398428376,
165 0.0, 0.46638346398428376, -0.46391731412948783, -0.24728318780816563, -0.9919387548344049,
166 -0.46638346398428376, 0.0, 0.4665439537974297, 0.42470896104182426, 0.41796965721894275,
167 0.46391731412948783, -0.4665439537974297, 0.0, 0.37654216726012074, -0.08567669832855362,
168 0.0, 0.0, 0.0, 0.0, -0.2703091399101363,
169 0.0, 0.0, 0.0, 0.0, 0.0
172 Matrix5 custom_Xi_1 = Gal3::Hat(tau_vec_1);
175 Vector10 custom_tau_rec_1 = Gal3::Vee(expected_xi_matrix_1);
179 Vector10 custom_tau_rec_roundtrip_1 = Gal3::Vee(custom_Xi_1);
187 -0.6659680127970163, 0.0801034296770802, -0.005425197747099379,
188 -0.24823309993679712, -0.3282613511681929, -0.3614305580886979,
189 0.3267045270397072, -0.21318895514136532, -0.1810111529904679,
192 const Matrix3 expected_R_mat_1 = (Matrix3() <<
193 0.961491754653074, 0.14119138670272793, -0.23579354964696073,
194 -0.20977429976081094, 0.9313179826319476, -0.297727322203087,
195 0.17756223949368974, 0.33572579219851445, 0.925072885538575
197 const Point3 expected_r_vec_1(-0.637321673031978, 0.16116104619552254, -0.03248254605908951);
198 const Velocity3 expected_v_vec_1(-0.22904001980446076, -0.23988916442951638, -0.4308710747620977);
199 const double expected_t_val_1 = -0.11137002094819903;
200 const Gal3 expected_exp_1(
Rot3(expected_R_mat_1), expected_r_vec_1, expected_v_vec_1, expected_t_val_1);
216 const Matrix3 input_R_mat_1 = (Matrix3() <<
217 -0.8479395778141634, 0.26601628670932354, -0.4585126035145831,
218 0.5159883846729487, 0.612401478276553, -0.5989327310201821,
219 0.1214679351060988, -0.744445944720015, -0.6565407650184298
221 const Point3 input_r_vec_1(0.6584021866593519, -0.3393257406257678, -0.5420636579124554);
222 const Velocity3 input_v_vec_1(0.1772802663861217, 0.3146080790621266, 0.7173535084539808);
223 const double input_t_val_1 = -0.12088016100268817;
224 const Gal3 custom_g_1(
Rot3(input_R_mat_1), input_r_vec_1, input_v_vec_1, input_t_val_1);
227 -0.6366686897004876, -0.2565186503803428, -1.1108185946230884,
228 1.122213550821757, -0.21828427331226408, 0.03100839182220047,
229 -0.6312616056853186, -2.516056355068653, 1.0844223965979727,
233 Vector10 custom_log_tau_1 = Gal3::Logmap(custom_g_1);
239 -0.6659680127970163, 0.0801034296770802, -0.005425197747099379,
240 -0.24823309993679712, -0.3282613511681929, -0.3614305580886979,
241 0.3267045270397072, -0.21318895514136532, -0.1810111529904679,
245 Vector10 tau_log_exp_rt1 = Gal3::Logmap(g_exp_rt1);
249 Gal3 custom_g_orig_rt2 = custom_g_1;
250 Vector10 tau_log_rt2 = Gal3::Logmap(custom_g_orig_rt2);
258 const Matrix3 g1_R_mat_1 = (Matrix3() <<
259 -0.5427153955878299, 0.8391431164114453, 0.03603927817303032,
260 0.8040805715986894, 0.5314810596281534, -0.2664250694549225,
261 -0.24272295682417533, -0.11561450357036887, -0.963181630220753
263 const Point3 g1_r_vec_1(0.9978490360071179, -0.5634861893781862, 0.025864788808796835);
264 const Velocity3 g1_v_vec_1(0.04857438013356852, -0.012834026018545996, 0.945550047767139);
265 const double g1_t_val_1 = -0.41496643117394594;
266 const Gal3 c1_1(
Rot3(g1_R_mat_1), g1_r_vec_1, g1_v_vec_1, g1_t_val_1);
268 const Matrix3 g2_R_mat_1 = (Matrix3() <<
269 -0.3264538540162394, 0.24276278793202133, -0.9135064914894779,
270 0.9430076454867458, 0.1496317101600385, -0.2972321178273404,
271 0.06453264097716288, -0.9584761760784951, -0.27777501352435885
273 const Point3 g2_r_vec_1(-0.1995427558196442, 0.7830589040103644, -0.433370507989717);
274 const Velocity3 g2_v_vec_1(0.8986541507293722, 0.051990700444202176, -0.8278883042875157);
275 const double g2_t_val_1 = -0.6155723080111539;
276 const Gal3 c2_1(
Rot3(g2_R_mat_1), g2_r_vec_1, g2_v_vec_1, g2_t_val_1);
278 const Matrix3 expected_R_mat_1 = (Matrix3() <<
279 0.9708156167565788, -0.04073147244077803, 0.23634294026763253,
280 0.22150238776832248, 0.5300893429357028, -0.8184998355032984,
281 -0.09194417042137741, 0.8469629482207595, 0.5236411308011658
283 const Point3 expected_r_vec_1(1.7177230471349891, -0.18439262777314758, -0.18087448280827323);
284 const Velocity3 expected_v_vec_1(-0.4253479212754224, 0.9579585887030762, 1.5188219826819997);
285 const double expected_t_val_1 = -1.0305387391850998;
286 const Gal3 expected_comp_1(
Rot3(expected_R_mat_1), expected_r_vec_1, expected_v_vec_1, expected_t_val_1);
288 Gal3 custom_comp_1 = c1_1 * c2_1;
294 Gal3 expected_identity = Gal3::Identity();
297 const Matrix3 g_R_mat_1 = (Matrix3() <<
298 0.6680516673568877, 0.2740542884848495, -0.6918101016209183,
299 0.6729369985913887, -0.6193062871756463, 0.4044941514923666,
300 -0.31758898858193396, -0.7357676057205693, -0.5981498680963873
302 const Point3 g_r_vec_1(0.06321286832132045, -0.9214393132931736, -0.12472480681013542);
303 const Velocity3 g_v_vec_1(0.4770686298036335, 0.2799576331302327, -0.29190264050471715);
304 const double g_t_val_1 = 0.3757227805330059;
305 const Gal3 custom_g_1(
Rot3(g_R_mat_1), g_r_vec_1, g_v_vec_1, g_t_val_1);
307 const Matrix3 expected_inv_R_mat_1 = (Matrix3() <<
308 0.6680516673568877, 0.6729369985913887, -0.31758898858193396,
309 0.2740542884848495, -0.6193062871756463, -0.7357676057205693,
310 -0.6918101016209183, 0.4044941514923666, -0.5981498680963873
312 const Point3 expected_inv_r_vec_1(0.7635904739613719, -0.6150700906051861, 0.32598918251792036);
313 const Velocity3 expected_inv_v_vec_1(-0.5998054073176801, -0.17213568846657853, 0.042198146082895516);
314 const double expected_inv_t_val_1 = -0.3757227805330059;
315 const Gal3 expected_inv_1(
Rot3(expected_inv_R_mat_1), expected_inv_r_vec_1, expected_inv_v_vec_1, expected_inv_t_val_1);
321 Gal3 ident_c_1 = custom_g_1 * custom_inv_1;
328 const Matrix3 g1_R_mat_1 = (Matrix3() <<
329 -0.2577418495238488, 0.7767168385303765, 0.5747000015202739,
330 -0.6694062876067332, -0.572463082520484, 0.47347781496466923,
331 0.6967527259484512, -0.26267274676776586, 0.6674868290752107
333 const Point3 g1_r_vec_1(0.680375434309419, -0.21123414636181392, 0.5661984475172117);
334 const Velocity3 g1_v_vec_1(0.536459189623808, -0.44445057839362445, 0.10793991159086103);
335 const double g1_t_val_1 = -0.0452058962756795;
336 const Gal3 c1_1(
Rot3(g1_R_mat_1), g1_r_vec_1, g1_v_vec_1, g1_t_val_1);
338 const Matrix3 g2_R_mat_1 = (Matrix3() <<
339 0.1981112115076329, -0.12884463237051902, 0.9716743325745948,
340 0.9776658305457298, -0.04497580389201028, -0.20529661674659028,
341 0.0701532013404006, 0.9906443548385938, 0.11705678352030657
343 const Point3 g2_r_vec_1(0.9044594503494257, 0.8323901360074013, 0.2714234559198019);
344 const Velocity3 g2_v_vec_1(-0.5142264587405261, -0.7255368464279626, 0.6083535084539808);
345 const double g2_t_val_1 = -0.6866418214918308;
346 const Gal3 c2_1(
Rot3(g2_R_mat_1), g2_r_vec_1, g2_v_vec_1, g2_t_val_1);
349 const Matrix3 expected_R_mat_1 = (Matrix3() <<
350 -0.6566377699430239, 0.753549894443112, -0.0314546605295386,
351 -0.4242286152401611, -0.3345440819370167, 0.8414929228771536,
352 0.6235839326792096, 0.5659000033801861, 0.5393517081447288
354 const Point3 expected_r_vec_1(-0.8113603292280276, 0.06632931940009146, 0.535144598419476);
355 const Velocity3 expected_v_vec_1(0.8076311151757332, -0.7866187376416414, -0.4028976707214998);
356 const double expected_t_val_1 = -0.6414359252161513;
357 const Gal3 expected_btw_1(
Rot3(expected_R_mat_1), expected_r_vec_1, expected_v_vec_1, expected_t_val_1);
366 const Matrix3 source_R_mat_1 = (Matrix3() <<
367 0.43788117516687186, -0.12083239518241493, -0.8908757538001356,
368 0.4981128609611659, 0.8575347951217139, 0.12852102124027118,
369 0.7484274541861499, -0.5000336063006573, 0.43568651389548174
371 const Point3 source_r_vec_1(0.3684370505476542, 0.8219440615838134, -0.03501868668711683);
372 const Velocity3 source_v_vec_1(0.7621243390078305, 0.282161192634218, -0.13609316346053646);
373 const double source_t_val_1 = 0.23919296788014144;
374 const Gal3 c1(
Rot3(source_R_mat_1), source_r_vec_1, source_v_vec_1, source_t_val_1);
377 expected_Mc << source_R_mat_1, source_v_vec_1, source_r_vec_1,
378 Vector3::Zero().transpose(), 1.0, source_t_val_1,
379 Vector4::Zero().transpose(), 1.0;
389 0.14491869060866264, -0.21431172810692092, -0.4956042914756127,
390 -0.13411549788475238, 0.44534636811395767, -0.33281648500962074,
391 -0.012095339359589743, -0.20104157502639808, 0.08197507996416392,
392 -0.006285789459736368
395 0.29551108535517384, 0.2938672197508704, 0.0788811297200055,
396 -0.07107463852205165, 0.22379088709954872, -0.26508231911443875,
397 -0.11625916165500054, 0.04661407377867886, 0.1788274027858556,
398 -0.015243024791797033
401 0.37646834040234084, 0.3782542871960659, -0.6525520272351378,
402 0.005426723127791683, 0.09951505587485733, 0.3813252061414707,
403 -0.09289643299325814, -0.0017149201262141199, -0.08507973168896384,
411 Gal3 left_assoc_1 = (g1_1 * g2_1) * g3_1;
412 Gal3 right_assoc_1 = g1_1 * (g2_1 * g3_1);
420 Gal3 custom_identity = Gal3::Identity();
423 const Matrix3 g_R_mat_1 = (Matrix3() <<
424 -0.5204974727334908, 0.7067813015326174, 0.4791060140322894,
425 0.773189425449982, 0.15205374379417114, 0.6156766776243058,
426 0.3622989004266723, 0.6908978584436601, -0.6256194178153267
428 const Point3 g_r_vec_1(-0.8716573584227159, -0.9599539022706234, -0.08459652545144625);
429 const Velocity3 g_v_vec_1(0.7018395735425127, -0.4666685012479632, 0.07952068144433233);
430 const double g_t_val_1 = -0.24958604725524136;
431 const Gal3 custom_g_1(
Rot3(g_R_mat_1), g_r_vec_1, g_v_vec_1, g_t_val_1);
435 Gal3 g_times_inv_1 = custom_g_1 * g_inv_1;
439 Gal3 id_times_g_1 = custom_identity * custom_g_1;
443 Gal3 g_times_id_1 = custom_g_1 * custom_identity;
450 const Matrix3 g_R_mat_1 = (Matrix3() <<
451 -0.2577418495238488, 0.7767168385303765, 0.5747000015202739,
452 -0.6694062876067332, -0.572463082520484, 0.47347781496466923,
453 0.6967527259484512, -0.26267274676776586, 0.6674868290752107
455 const Point3 g_r_vec_1(0.680375434309419, -0.21123414636181392, 0.5661984475172117);
456 const Velocity3 g_v_vec_1(0.536459189623808, -0.44445057839362445, 0.10793991159086103);
457 const double g_t_val_1 = -0.0452058962756795;
458 const Gal3 test_g(
Rot3(g_R_mat_1), g_r_vec_1, g_v_vec_1, g_t_val_1);
462 -0.2577418495238488, 0.7767168385303765, 0.5747000015202739, -0.011651451315476903, 0.03511218083817791, 0.025979828658358354, 0.22110620799336958, 0.3876840721487304, -0.42479976201969083, 0.536459189623808,
463 -0.6694062876067332, -0.572463082520484, 0.47347781496466923, -0.03026111120383766, -0.025878706730076754, 0.021403988992128208, -0.6381411631187845, 0.6286520658991062, -0.14213043434767314, -0.44445057839362445,
464 0.6967527259484512, -0.26267274676776586, 0.6674868290752107, 0.03149733145902263, -0.011874356944831452, 0.03017434036055619, -0.5313038186955878, -0.22369794100291154, 0.4665680546909384, 0.10793991159086103,
465 0.0, 0.0, 0.0, -0.2577418495238488, 0.7767168385303765, 0.5747000015202739, -0.23741649654248634, 0.1785366687454684, -0.3477720607401242, 0.0,
466 0.0, 0.0, 0.0, -0.6694062876067332, -0.572463082520484, 0.47347781496466923, -0.40160003518135456, 0.22475195574939733, -0.2960463760548867, 0.0,
467 0.0, 0.0, 0.0, 0.6967527259484512, -0.26267274676776586, 0.6674868290752107, -0.47366266867570694, 0.03810916679440729, 0.5094272729993004, 0.0,
468 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -0.2577418495238488, 0.7767168385303765, 0.5747000015202739, 0.0,
469 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -0.6694062876067332, -0.572463082520484, 0.47347781496466923, 0.0,
470 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.6967527259484512, -0.26267274676776586, 0.6674868290752107, 0.0,
471 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0
479 -0.28583171387804845, -0.7221038902918132, -0.09516831208249353,
480 -0.13619637934919504, -0.05432836001072756, 0.1629798883384306,
481 -0.20194877118636279, -0.18928645162443278, 0.07312685929426145,
482 -0.042327821984942095
487 -0.7097860882934639, 0.5869666797222274, 0.10746143202899403,
488 0.07529021542994252, 0.21635024626679053, 0.15385717129791027,
489 -0.05294531834013589, 0.27816922833676766, -0.042176749221369034,
490 -0.042327821984942095
498 Gal3 g_exp_tau_ginv = test_g * exp_tau * test_g.
inverse();
499 Vector10 log_result = Gal3::Logmap(g_exp_tau_ginv);
504 -0.7097860882934638, 0.5869666797222274, 0.10746143202899389,
505 0.07529021542994252, 0.21635024626679047, 0.15385717129791018,
506 -0.05294531834013579, 0.27816922833676755, -0.04217674922136877,
519 Matrix3 g1_R_mat = (Matrix3() <<
520 -0.3264538540162394, 0.24276278793202133, -0.9135064914894779,
521 0.9430076454867458, 0.1496317101600385, -0.2972321178273404,
522 0.06453264097716288, -0.9584761760784951, -0.27777501352435885
524 Point3 g1_r_vec(-0.1995427558196442, 0.7830589040103644, -0.433370507989717);
525 Velocity3 g1_v_vec(0.8986541507293722, 0.051990700444202176, -0.8278883042875157);
526 double g1_t_val = -0.6155723080111539;
527 Gal3 g1(
Rot3(g1_R_mat), g1_r_vec, g1_v_vec, g1_t_val);
529 Matrix3 g2_R_mat = (Matrix3() <<
530 -0.5204974727334908, 0.7067813015326174, 0.4791060140322894,
531 0.773189425449982, 0.15205374379417114, 0.6156766776243058,
532 0.3622989004266723, 0.6908978584436601, -0.6256194178153267
534 Point3 g2_r_vec(-0.8716573584227159, -0.9599539022706234, -0.08459652545144625);
535 Velocity3 g2_v_vec(0.7018395735425127, -0.4666685012479632, 0.07952068144433233);
536 double g2_t_val = -0.24958604725524136;
537 Gal3 g2(
Rot3(g2_R_mat), g2_r_vec, g2_v_vec, g2_t_val);
541 -0.5204974727334908, 0.773189425449982, 0.3622989004266723, 0.12990890682589473, -0.19297729247761214, -0.09042475048241341, -0.2823811043440715, 0.3598327802048799, -1.1736098322206205, 0.6973186192002845,
542 0.7067813015326174, 0.15205374379417114, 0.6908978584436601, -0.17640275132344085, -0.03795049288394836, -0.17243846554606443, -0.650366876876537, 0.542434959867202, 0.5459387038042347, -0.4800290630417764,
543 0.4791060140322894, 0.6156766776243058, -0.6256194178153267, -0.11957817625853331, -0.15366430835548997, 0.15614587757865273, 0.652649909196605, -0.5858564732208887, -0.07673941868885611, 0.0008110342596663322,
544 0.0, 0.0, 0.0, -0.5204974727334908, 0.773189425449982, 0.3622989004266723, -0.23055803486323456, -0.29566601949219695, 0.29975516112150496, 0.0,
545 0.0, 0.0, 0.0, 0.7067813015326174, 0.15205374379417114, 0.6908978584436601, -0.3345116854380048, -0.42869572760154795, 0.4365499053963549, 0.0,
546 0.0, 0.0, 0.0, 0.4791060140322894, 0.6156766776243058, -0.6256194178153267, 0.24299784710943456, 0.47718330211934956, 0.6556899423712481, 0.0,
547 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -0.5204974727334908, 0.773189425449982, 0.3622989004266723, 0.0,
548 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.7067813015326174, 0.15205374379417114, 0.6908978584436601, 0.0,
549 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.4791060140322894, 0.6156766776243058, -0.6256194178153267, 0.0,
550 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0
552 Matrix10 expected_H2 = Matrix10::Identity();
564 Matrix3 g_R_mat = (Matrix3() <<
565 0.6680516673568877, 0.2740542884848495, -0.6918101016209183,
566 0.6729369985913887, -0.6193062871756463, 0.4044941514923666,
567 -0.31758898858193396, -0.7357676057205693, -0.5981498680963873
569 Point3 g_r_vec(0.06321286832132045, -0.9214393132931736, -0.12472480681013542);
570 Velocity3 g_v_vec(0.4770686298036335, 0.2799576331302327, -0.29190264050471715);
571 double g_t_val = 0.3757227805330059;
572 Gal3 g(
Rot3(g_R_mat), g_r_vec, g_v_vec, g_t_val);
576 -0.6680516673568877, -0.2740542884848495, 0.6918101016209183, 0.2510022299990406, 0.10296843928652219, -0.2599288149818328, -0.33617296841685484, -0.7460372203093872, -0.6201638436054394, -0.4770686298036335,
577 -0.6729369985913887, 0.6193062871756463, -0.4044941514923666, 0.252837760234292, -0.23268748021920607, 0.1519776673080509, 0.04690510412308051, 0.0894976987957895, 0.05899296065652178, -0.2799576331302327,
578 0.31758898858193396, 0.7357676057205693, 0.5981498680963873, -0.1193254178566693, -0.27644465064744467, -0.22473853161662533, -0.6077563738775408, -0.3532109665151345, 0.7571646227598928, 0.29190264050471715,
579 -0.0, -0.0, -0.0, -0.6680516673568877, -0.2740542884848495, 0.6918101016209183, -0.10752062523052273, 0.3867608979391727, 0.049383710440088574, -0.0,
580 -0.0, -0.0, -0.0, -0.6729369985913887, 0.6193062871756463, -0.4044941514923666, 0.04349430207154942, -0.271014473064643, -0.48729973338095034, -0.0,
581 -0.0, -0.0, -0.0, 0.31758898858193396, 0.7357676057205693, 0.5981498680963873, -0.1340109682602236, 0.3721751918050696, -0.38664898924142477, -0.0,
582 -0.0, -0.0, -0.0, -0.0, -0.0, -0.0, -0.6680516673568877, -0.2740542884848495, 0.6918101016209183, -0.0,
583 -0.0, -0.0, -0.0, -0.0, -0.0, -0.0, -0.6729369985913887, 0.6193062871756463, -0.4044941514923666, -0.0,
584 -0.0, -0.0, -0.0, -0.0, -0.0, -0.0, 0.31758898858193396, 0.7357676057205693, 0.5981498680963873, -0.0,
585 -0.0, -0.0, -0.0, -0.0, -0.0, -0.0, -0.0, -0.0, -0.0, -1.0
596 const double jac_tol = 1
e-5;
599 const Matrix3 R1_mat = (Matrix3() <<
600 -0.5204974727334908, 0.7067813015326174, 0.4791060140322894,
601 0.773189425449982, 0.15205374379417114, 0.6156766776243058,
602 0.3622989004266723, 0.6908978584436601, -0.6256194178153267
604 const Point3 r1_vec(-0.8716573584227159, -0.9599539022706234, -0.08459652545144625);
605 const Velocity3 v1_vec(0.7018395735425127, -0.4666685012479632, 0.07952068144433233);
606 const double t1_val = -0.24958604725524136;
607 const Gal3 g1(
Rot3(R1_mat), r1_vec, v1_vec, t1_val);
610 -1.2604528322799349, -0.3898722924179116, -0.6402392791385879,
611 -0.34870126525214656, -0.4153032457886797, 1.1791315551702946,
612 1.4969846781977756, 2.324590726540746, 1.321595100333433,
617 Vector10 log1_gtsam = Gal3::Logmap(
g1, Hg1_gtsam);
622 [](
const Gal3& g_in) {
return Gal3::Logmap(g_in); };
623 Matrix H_numerical1 = numericalDerivative11<Vector10, Gal3>(logmap_func1,
g1, jac_tol);
627 const Matrix3 R2_mat = (Matrix3() <<
628 0.6680516673568877, 0.2740542884848495, -0.6918101016209183,
629 0.6729369985913887,-0.6193062871756463, 0.4044941514923666,
630 -0.31758898858193396,-0.7357676057205693, -0.5981498680963873
632 const Point3 r2_vec(0.06321286832132045, -0.9214393132931736, -0.12472480681013542);
633 const Velocity3 v2_vec(0.4770686298036335, 0.2799576331302327, -0.29190264050471715);
634 const double t2_val = 0.3757227805330059;
635 const Gal3 g2(
Rot3(R2_mat), r2_vec, v2_vec, t2_val);
638 -0.5687147057967125, -0.3805406510759017, -1.063343079044753,
639 0.5179342682694047, 0.3616924279678234, -0.0984011207117694,
640 -2.215366977027571, -0.72705858167113, 0.7749725693135466,
645 Vector10 log2_gtsam = Gal3::Logmap(
g2, Hg2_gtsam);
650 [](
const Gal3& g_in) {
return Gal3::Logmap(g_in); };
651 Matrix H_numerical2 = numericalDerivative11<Vector10, Gal3>(logmap_func2,
g2, jac_tol);
659 0.1644755309744135, -0.212580759622502, 0.027598787765563664,
660 0.06314401798217141, -0.07707725418679535, -0.26078036994807674,
661 0.3779854061644677, -0.09638288751073966, -0.2917351793587256,
667 0.9844524218735122, -0.1490063714302354, 0.02908427677999133, -0.24094497482047258, 0.04906744369191897, -0.008766606502586993, 0.0010755746403492512, 0.020896120374367614, 0.09422195803906698, -0.032194210151797825,
668 0.13700585416694203, 0.9624511801109918, 0.18991633864490795, -0.04463269623239319, -0.23281449603592955, -0.06241249224896669, -0.05013517822202011, -0.011608679508659724, 0.08214064896800377, 0.05141115662809599,
669 -0.06540787266535304, -0.1806541475679301, 0.9749387339968734, 0.0221898591040537, 0.05898968326106501, -0.23742922610598202, -0.09935687017740953, -0.06570748233856251, -0.025136525844073204, 0.1253312320983055,
670 0.0, 0.0, 0.0, 0.9844524218735122, -0.1490063714302354, 0.02908427677999133, -0.02734050131352483, -0.1309992318097018, 0.01786013841817754, 0.0,
671 0.0, 0.0, 0.0, 0.13700585416694203, 0.9624511801109918, 0.18991633864490795, 0.1195266279722227, -0.032519018758919625, 0.035417068913109986, 0.0,
672 0.0, 0.0, 0.0, -0.06540787266535304, -0.1806541475679301, 0.9749387339968734, -0.0560073503522914, -0.019830198590275447, -0.010039835763395311, 0.0,
673 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.9844524218735122, -0.1490063714302354, 0.02908427677999133, 0.0,
674 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.13700585416694203, 0.9624511801109918, 0.18991633864490795, 0.0,
675 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -0.06540787266535304, -0.1806541475679301, 0.9749387339968734, 0.0,
676 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0
689 Matrix3 g1_R_mat = (Matrix3() <<
690 0.1981112115076329, -0.12884463237051902, 0.9716743325745948,
691 0.9776658305457298, -0.04497580389201028, -0.20529661674659028,
692 0.0701532013404006, 0.9906443548385938, 0.11705678352030657
694 Point3 g1_r_vec(0.9044594503494257, 0.8323901360074013, 0.2714234559198019);
695 Velocity3 g1_v_vec(-0.5142264587405261, -0.7255368464279626, 0.6083535084539808);
696 double g1_t_val = -0.6866418214918308;
697 Gal3 g1(
Rot3(g1_R_mat), g1_r_vec, g1_v_vec, g1_t_val);
699 Matrix3 g2_R_mat = (Matrix3() <<
700 -0.5427153955878299, 0.8391431164114453, 0.03603927817303032,
701 0.8040805715986894, 0.5314810596281534, -0.2664250694549225,
702 -0.24272295682417533, -0.11561450357036887, -0.963181630220753
704 Point3 g2_r_vec(0.9978490360071179, -0.5634861893781862, 0.025864788808796835);
705 Velocity3 g2_v_vec(0.04857438013356852, -0.012834026018545996, 0.945550047767139);
706 double g2_t_val = -0.41496643117394594;
707 Gal3 g2(
Rot3(g2_R_mat), g2_r_vec, g2_v_vec, g2_t_val);
709 Matrix10 H1_analytical, H2_analytical;
712 std::function<
Gal3(
const Gal3&,
const Gal3&)> between_func =
713 [](
const Gal3& g1_in,
const Gal3& g2_in) {
return g1_in.
between(g2_in); };
728 Matrix3 g1_R_mat = (Matrix3() <<
729 0.1981112115076329, -0.12884463237051902, 0.9716743325745948,
730 0.9776658305457298, -0.04497580389201028, -0.20529661674659028,
731 0.0701532013404006, 0.9906443548385938, 0.11705678352030657
733 Point3 g1_r_vec(0.9044594503494257, 0.8323901360074013, 0.2714234559198019);
734 Velocity3 g1_v_vec(-0.5142264587405261, -0.7255368464279626, 0.6083535084539808);
735 double g1_t_val = -0.6866418214918308;
738 Vector10 xi = (
Vector10() << 0.1, -0.2, 0.3, 0.4, -0.5, 0.6, -0.1, 0.15, -0.25, 0.9).finished();
753 g.Adjoint(
xi, H_g_analytical);
767 Matrix3 g1_R_mat = (Matrix3() <<
768 0.1981112115076329, -0.12884463237051902, 0.9716743325745948,
769 0.9776658305457298, -0.04497580389201028, -0.20529661674659028,
770 0.0701532013404006, 0.9906443548385938, 0.11705678352030657
772 Point3 g1_r_vec(0.9044594503494257, 0.8323901360074013, 0.2714234559198019);
773 Velocity3 g1_v_vec(-0.5142264587405261, -0.7255368464279626, 0.6083535084539808);
774 double g1_t_val = -0.6866418214918308;
779 g.inverse(H_inv_analytical);
782 std::function<
Gal3(
const Gal3&)> inverse_func =
788 Matrix10 expected_adjoint = -
g.AdjointMap();
796 Matrix3 g1_R_mat = (Matrix3() <<
797 0.1981112115076329, -0.12884463237051902, 0.9716743325745948,
798 0.9776658305457298, -0.04497580389201028, -0.20529661674659028,
799 0.0701532013404006, 0.9906443548385938, 0.11705678352030657
801 Point3 g1_r_vec(0.9044594503494257, 0.8323901360074013, 0.2714234559198019);
802 Velocity3 g1_v_vec(-0.5142264587405261, -0.7255368464279626, 0.6083535084539808);
803 double g1_t_val = -0.6866418214918308;
804 Gal3 g1(
Rot3(g1_R_mat), g1_r_vec, g1_v_vec, g1_t_val);
806 Matrix3 g2_R_mat = (Matrix3() <<
807 -0.5427153955878299, 0.8391431164114453, 0.03603927817303032,
808 0.8040805715986894, 0.5314810596281534, -0.2664250694549225,
809 -0.24272295682417533, -0.11561450357036887, -0.963181630220753
811 Point3 g2_r_vec(0.9978490360071179, -0.5634861893781862, 0.025864788808796835);
812 Velocity3 g2_v_vec(0.04857438013356852, -0.012834026018545996, 0.945550047767139);
813 double g2_t_val = -0.41496643117394594;
814 Gal3 g2(
Rot3(g2_R_mat), g2_r_vec, g2_v_vec, g2_t_val);
817 Matrix10 H1_analytical, H2_analytical;
821 std::function<
Gal3(
const Gal3&,
const Gal3&)> compose_func =
822 [](
const Gal3& g1_in,
const Gal3& g2_in) {
return g1_in.
compose(g2_in); };
836 const double kTol = 1
e-9;
837 const double jac_tol = 1
e-6;
840 const Matrix3 R1_mat = (Matrix3() <<
841 -0.2577418495238488, 0.7767168385303765, 0.5747000015202739,
842 -0.6694062876067332, -0.572463082520484, 0.47347781496466923,
843 0.6967527259484512, -0.26267274676776586, 0.6674868290752107
845 const Point3 r1_vec(0.680375434309419, -0.21123414636181392, 0.5661984475172117);
846 const Velocity3 v1_vec(0.536459189623808, -0.44445057839362445, 0.10793991159086103);
847 const double t1_val = -0.0452058962756795;
848 const Gal3 g1(
Rot3(R1_mat), r1_vec, v1_vec, t1_val);
849 const Point3 point_in1(4.967141530112327, -1.3826430117118464, 6.476885381006925);
850 const double time_in1 = 0.0;
851 const Event e_in1(time_in1, point_in1);
853 const double expected_t_out1 = time_in1 + t1_val;
855 Matrix H1g_gtsam = Matrix::Zero(4, 10);
856 Matrix H1e_gtsam = Matrix::Zero(4, 4);
857 Event e_out1_gtsam =
g1.act(e_in1, H1g_gtsam, H1e_gtsam);
865 Matrix H1g_loc_numerical = numericalDerivative21<Point3, Gal3, Event>(act_func1_loc_wrt_g,
g1, e_in1, jac_tol);
868 std::function<double(
const Gal3&,
const Event&)> act_func1_time_wrt_g =
870 Matrix H1g_time_numerical = numericalDerivative21<double, Gal3, Event>(act_func1_time_wrt_g,
g1, e_in1, jac_tol);
876 Matrix H1e_loc_numerical = numericalDerivative22<Point3, Gal3, Event>(act_func1_loc_wrt_e,
g1, e_in1, jac_tol);
879 std::function<double(
const Gal3&,
const Event&)> act_func1_time_wrt_e =
881 Matrix H1e_time_numerical = numericalDerivative22<double, Gal3, Event>(act_func1_time_wrt_e,
g1, e_in1, jac_tol);
885 const Matrix3 R2_mat = (Matrix3() <<
886 0.1981112115076329, -0.12884463237051902, 0.9716743325745948,
887 0.9776658305457298, -0.04497580389201028, -0.20529661674659028,
888 0.0701532013404006, 0.9906443548385938, 0.11705678352030657
890 const Point3 r2_vec(0.9044594503494257, 0.8323901360074013, 0.2714234559198019);
891 const Velocity3 v2_vec(-0.5142264587405261, -0.7255368464279626, 0.6083535084539808);
892 const double t2_val = -0.6866418214918308;
893 const Gal3 g2(
Rot3(R2_mat), r2_vec, v2_vec, t2_val);
894 const Point3 point_in2(15.230298564080254, -2.3415337472333597, -2.3413695694918055);
895 const double time_in2 = 0.0;
896 const Event e_in2(time_in2, point_in2);
898 const double expected_t_out2 = time_in2 + t2_val;
900 Matrix H2g_gtsam = Matrix::Zero(4, 10);
901 Matrix H2e_gtsam = Matrix::Zero(4, 4);
902 Event e_out2_gtsam =
g2.act(e_in2, H2g_gtsam, H2e_gtsam);
910 Matrix H2g_loc_numerical = numericalDerivative21<Point3, Gal3, Event>(act_func2_loc_wrt_g,
g2, e_in2, jac_tol);
913 std::function<double(
const Gal3&,
const Event&)> act_func2_time_wrt_g =
915 Matrix H2g_time_numerical = numericalDerivative21<double, Gal3, Event>(act_func2_time_wrt_g,
g2, e_in2, jac_tol);
921 Matrix H2e_loc_numerical = numericalDerivative22<Point3, Gal3, Event>(act_func2_loc_wrt_e,
g2, e_in2, jac_tol);
924 std::function<double(
const Gal3&,
const Event&)> act_func2_time_wrt_e =
926 Matrix H2e_time_numerical = numericalDerivative22<double, Gal3, Event>(act_func2_time_wrt_e,
g2, e_in2, jac_tol);
932 const double interp_tol = 1
e-6;
935 const Matrix3 R1_mat = (Matrix3() <<
936 -0.5427153955878299, 0.8391431164114453, 0.03603927817303032,
937 0.8040805715986894, 0.5314810596281534, -0.2664250694549225,
938 -0.24272295682417533,-0.11561450357036887,-0.963181630220753
940 const Point3 r1_vec(0.9978490360071179, -0.5634861893781862, 0.025864788808796835);
941 const Velocity3 v1_vec(0.04857438013356852, -0.012834026018545996, 0.945550047767139);
942 const double t1_val = -0.41496643117394594;
943 const Gal3 g1(
Rot3(R1_mat), r1_vec, v1_vec, t1_val);
945 const Matrix3 R2_mat = (Matrix3() <<
946 -0.3264538540162394, 0.24276278793202133, -0.9135064914894779,
947 0.9430076454867458, 0.1496317101600385, -0.2972321178273404,
948 0.06453264097716288,-0.9584761760784951, -0.27777501352435885
950 const Point3 r2_vec(-0.1995427558196442, 0.7830589040103644, -0.433370507989717);
951 const Velocity3 v2_vec(0.8986541507293722, 0.051990700444202176, -0.8278883042875157);
952 const double t2_val = -0.6155723080111539;
953 const Gal3 g2(
Rot3(R2_mat), r2_vec, v2_vec, t2_val);
956 const Gal3 expected_alpha0_00 =
g1;
957 const Gal3 expected_alpha0_25(
Rot3(-0.5305293740379828, 0.8049951577356123, -0.26555861745588893,
958 0.8357380608208966, 0.444360967494815, -0.32262241748272774,
959 -0.14170559967126867, -0.39309811318459514,-0.9085116380281089),
960 Point3(0.7319725410358775, -0.24509083842031143, -0.20526665070473993),
961 Velocity3(0.447233815335834, 0.08156238532481315, 0.6212732810121263),
962 -0.46511790038324796);
963 const Gal3 expected_alpha0_50(
Rot3(-0.4871812472793253, 0.6852678695634308, -0.5413523614461815,
964 0.8717937932763143, 0.34522257149684665,-0.34755856791913387,
965 -0.051283665082120816,-0.6412716453057169, -0.7655982383878919),
966 Point3(0.4275876127256323, 0.0806397132393819, -0.3622648631703127),
967 Velocity3(0.7397753319939113, 0.12027591889377548, 0.19009330402180313),
968 -0.5152693695925499);
969 const Gal3 expected_alpha0_75(
Rot3(-0.416880477991759, 0.49158776471130083,-0.7645600935541361,
970 0.9087464582621175, 0.24369303223618222,-0.338812013712018,
971 0.019762127046961175,-0.8360353913714909, -0.5483195078682666),
972 Point3(0.10860773480095642, 0.42140693978775756, -0.4380637787537704),
973 Velocity3(0.895925123398753, 0.10738792759782673, -0.3083508669060544),
974 -0.5654208388018519);
975 const Gal3 expected_alpha1_00 =
g2;
989 const double jac_tol = 1
e-7;
997 return Gal3::Create(
R, r,
v,
t);
1015 std::function<
Gal3(
const Pose3&,
const Velocity3&,
const double&)> fromPoseVelTime_func =
1017 return Gal3::FromPoseVelocityTime(
pose,
v,
t);
1033 const double jac_tol = 1
e-7;
1038 std::function<
Rot3(
const Gal3&)> rot_func =
1039 [](
const Gal3&
g) {
return g.rotation(); };
1040 Matrix Hrot_num = numericalDerivative11<Rot3, Gal3>(rot_func,
kTestGal3, jac_tol);
1046 std::function<
Point3(
const Gal3&)> pos_func =
1047 [](
const Gal3&
g) {
return g.translation(); };
1048 Matrix Hpos_num = numericalDerivative11<Point3, Gal3>(pos_func,
kTestGal3, jac_tol);
1055 [](
const Gal3&
g) {
return g.velocity(); };
1056 Matrix Hvel_num = numericalDerivative11<Velocity3, Gal3>(vel_func,
kTestGal3, jac_tol);
1062 std::function<double(
const Gal3&)> time_func =
1063 [](
const Gal3&
g) {
return g.time(); };
1064 Matrix Htime_num = numericalDerivative11<double, Gal3>(time_func,
kTestGal3, jac_tol);
1074 const double jac_tol = 1
e-7;
1077 const double alpha = 0.3;
1082 std::function<
Gal3(
const Gal3&,
const Gal3&,
const double&)> interp_func =
1083 [](
const Gal3& g1_in,
const Gal3& g2_in,
const double&
a){
1087 const double& alpha_ref =
alpha;
1101 const double jac_tol = 1
e-7;
1102 Vector10 xi = (
Vector10() << 0.1, -0.2, 0.3, 0.4, -0.5, 0.6, -0.1, 0.15, -0.25, 0.9).finished();
1103 Vector10 y = (
Vector10() << -0.5, 0.4, -0.3, 0.2, -0.1, 0.0, 0.3, -0.35, 0.45, -0.1).finished();
1107 Vector10 ad_xi_map_times_y = ad_xi_map *
y;
1131 Vector10 z = (
Vector10() << 0.7, 0.8, 0.9, -0.1, -0.2, -0.3, 0.5, 0.6, 0.7, 0.1).finished();
1135 Vector10 sum_terms = term1 + term2 + term3;
1141 const double kTolRoundtrip =
kTol * 100;
1145 xi_small1 << 1
e-5, -2
e-5, 1.5e-5, -3
e-5, 4
e-5, -2.5e-5, 1
e-7, -2
e-7, 1.5e-7, -5
e-5;
1147 Vector10 xi_recovered1 = Gal3::Logmap(g_small1);
1152 xi_small2 << -5
e-6, 1
e-6, -4
e-6, 2
e-6, -6
e-6, 1
e-6, -5
e-8, 8
e-8, -2
e-8, 9
e-6;
1154 Vector10 xi_recovered2 = Gal3::Logmap(g_small2);
1159 xi_small3 << 1
e-9, 2
e-9, 3
e-9, -4
e-9,-5
e-9,-6
e-9, 1
e-10, 2
e-10, 3
e-10, 7
e-9;
1161 Vector10 xi_recovered3 = Gal3::Logmap(g_small3);
1165 Vector10 xi_zero = Vector10::Zero();
1167 Vector10 xi_recovered_zero = Gal3::Logmap(g_identity);