From eb5b327579473dedb68a118b34c5c88ac1034246 Mon Sep 17 00:00:00 2001 From: diegoferigo Date: Tue, 4 Jun 2024 12:10:00 +0200 Subject: [PATCH] Test output representation of link jacobian --- tests/test_api_link.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/test_api_link.py b/tests/test_api_link.py index 3a52984e5..949ef45f8 100644 --- a/tests/test_api_link.py +++ b/tests/test_api_link.py @@ -158,6 +158,28 @@ def test_link_jacobians( v_WL_js = js.link.velocity(model=model, data=data, link_index=link_idx) assert v_WL_js == pytest.approx(v_WL_idt), link_name + # Test conversion to a different output velocity representation. + for other_repr in {VelRepr.Inertial, VelRepr.Body, VelRepr.Mixed}.difference( + {data.velocity_representation} + ): + + with data.switch_velocity_representation(other_repr): + kin_dyn_other_repr = ( + utils_idyntree.build_kindyncomputations_from_jaxsim_model( + model=model, data=data + ) + ) + + for link_name, link_idx in zip( + model.link_names(), + js.link.names_to_idxs(model=model, link_names=model.link_names()), + ): + v_WL_idt = kin_dyn_other_repr.frame_velocity(frame_name=link_name) + v_WL_js = js.link.velocity( + model=model, data=data, link_index=link_idx, output_vel_repr=other_repr + ) + assert v_WL_js == pytest.approx(v_WL_idt), link_name + def test_link_bias_acceleration( jaxsim_models_types: js.model.JaxSimModel,