1
1
//
2
- // Copyright (c) 2016-2020 CNRS INRIA
2
+ // Copyright (c) 2016-2024 CNRS INRIA
3
3
//
4
4
5
5
#include " pinocchio/multibody/model.hpp"
@@ -569,14 +569,14 @@ BOOST_AUTO_TEST_CASE(test_frame_jacobian_time_variation)
569
569
const Motion & v_ref_local = frame.placement .actInv (data_ref.v [parent_idx]);
570
570
const Motion & v_ref = data_ref.oMf [idx].act (v_ref_local);
571
571
572
- const SE3 & wMf = SE3 (data_ref.oMf [idx].rotation (), SE3::Vector3::Zero ());
573
- const Motion & v_ref_local_world_aligned = wMf.act (v_ref_local);
572
+ const SE3 wMf = SE3 (data_ref.oMf [idx].rotation (), SE3::Vector3::Zero ());
573
+ const Motion v_ref_local_world_aligned = wMf.act (v_ref_local);
574
574
BOOST_CHECK (v_idx.isApprox (v_ref));
575
575
576
576
Motion a_idx (J * a + dJ * v);
577
- const Motion & a_ref_local = frame.placement .actInv (data_ref.a [parent_idx]);
578
- const Motion & a_ref = data_ref.oMf [idx].act (a_ref_local);
579
- const Motion & a_ref_local_world_aligned = wMf.act (a_ref_local);
577
+ const Motion a_ref_local = frame.placement .actInv (data_ref.a [parent_idx]);
578
+ const Motion a_ref = data_ref.oMf [idx].act (a_ref_local);
579
+ const Motion a_ref_local_world_aligned = wMf.act (a_ref_local);
580
580
BOOST_CHECK (a_idx.isApprox (a_ref));
581
581
582
582
J.fill (0 .);
@@ -594,12 +594,15 @@ BOOST_AUTO_TEST_CASE(test_frame_jacobian_time_variation)
594
594
// Regarding to the LOCAL_WORLD_ALIGNED frame
595
595
getFrameJacobian (model, data, idx, LOCAL_WORLD_ALIGNED, J);
596
596
getFrameJacobianTimeVariation (model, data, idx, LOCAL_WORLD_ALIGNED, dJ);
597
+ Data::Motion world_v_frame = data.ov [parent_idx];
598
+ world_v_frame.linear ().setZero ();
597
599
598
600
v_idx = (Motion::Vector6)(J * v);
599
601
BOOST_CHECK (v_idx.isApprox (v_ref_local_world_aligned));
600
602
601
603
a_idx = (Motion::Vector6)(J * a + dJ * v);
602
- BOOST_CHECK (a_idx.isApprox (a_ref_local_world_aligned));
604
+ BOOST_CHECK (
605
+ a_idx.isApprox (world_v_frame.cross (wMf.act (v_ref_local)) + a_ref_local_world_aligned));
603
606
604
607
// compare to finite differencies
605
608
{
@@ -617,7 +620,6 @@ BOOST_AUTO_TEST_CASE(test_frame_jacobian_time_variation)
617
620
J_ref_local_world_aligned.fill (0 .);
618
621
computeJointJacobians (model, data_ref, q);
619
622
updateFramePlacements (model, data_ref);
620
- const SE3 & oMf_q = data_ref.oMf [idx];
621
623
getFrameJacobian (model, data_ref, idx, WORLD, J_ref_world);
622
624
getFrameJacobian (model, data_ref, idx, LOCAL, J_ref_local);
623
625
getFrameJacobian (model, data_ref, idx, LOCAL_WORLD_ALIGNED, J_ref_local_world_aligned);
@@ -630,21 +632,11 @@ BOOST_AUTO_TEST_CASE(test_frame_jacobian_time_variation)
630
632
J_ref_plus_local_world_aligned.fill (0 .);
631
633
computeJointJacobians (model, data_ref_plus, q_plus);
632
634
updateFramePlacements (model, data_ref_plus);
633
- const SE3 & oMf_q_plus = data_ref_plus.oMf [idx];
634
635
getFrameJacobian (model, data_ref_plus, idx, WORLD, J_ref_plus_world);
635
636
getFrameJacobian (model, data_ref_plus, idx, LOCAL, J_ref_plus_local);
636
637
getFrameJacobian (
637
638
model, data_ref_plus, idx, LOCAL_WORLD_ALIGNED, J_ref_plus_local_world_aligned);
638
639
639
- // Move J_ref_plus_local to reference frame
640
- J_ref_plus_local = (oMf_q.inverse () * oMf_q_plus).toActionMatrix () * (J_ref_plus_local);
641
-
642
- // Move J_ref_plus_local_world_aligned to reference frame
643
- SE3 oMf_translation = SE3::Identity ();
644
- oMf_translation.translation () = oMf_q_plus.translation () - oMf_q.translation ();
645
- J_ref_plus_local_world_aligned =
646
- oMf_translation.toActionMatrix () * (J_ref_plus_local_world_aligned);
647
-
648
640
Data::Matrix6x dJ_ref_world (6 , model.nv ), dJ_ref_local (6 , model.nv ),
649
641
dJ_ref_local_world_aligned (6 , model.nv );
650
642
dJ_ref_world.fill (0 .);
0 commit comments