Skip to content

Commit

Permalink
Add test of api.link.bias_acceleration
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoferigo committed Apr 3, 2024
1 parent 5e5920a commit d637eb7
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tests/test_api_link.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,36 @@ def test_link_jacobians(
v_WL_idt = kin_dyn.frame_velocity(frame_name=link_name)
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


def test_link_bias_acceleration(
jaxsim_models_types: js.model.JaxSimModel,
velocity_representation: VelRepr,
prng_key: jax.Array,
):

model = jaxsim_models_types

key, subkey = jax.random.split(prng_key, num=2)
data = js.data.random_model_data(
model=model,
key=subkey,
velocity_representation=velocity_representation,
)

kin_dyn = utils_idyntree.build_kindyncomputations_from_jaxsim_model(
model=model, data=data
)

# =====
# Tests
# =====

for name, index in zip(
model.link_names(),
js.link.names_to_idxs(model=model, link_names=model.link_names()),
):
Jν_idt = kin_dyn.frame_bias_acc(frame_name=name)
Jν_js = js.link.bias_acceleration(model=model, data=data, link_index=index)
assert pytest.approx(Jν_idt) == Jν_js

0 comments on commit d637eb7

Please sign in to comment.