Skip to content

Commit

Permalink
Move test_collidable_point_jacobians to test_api_contact
Browse files Browse the repository at this point in the history
  • Loading branch information
flferretti committed Mar 3, 2025
1 parent 1dd113d commit ee5d8c8
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 37 deletions.
32 changes: 32 additions & 0 deletions tests/test_api_contact.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,38 @@ def test_contact_kinematics(
assert W_ṗ_C == pytest.approx(CW_vl_WC)


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

model = jaxsim_models_types

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

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

# Compute the velocity of the collidable points with a RBDA.
# This function always returns the linear part of the mixed velocity of the
# implicit frame C corresponding to the collidable point.
W_ṗ_C = js.contact.collidable_point_velocities(model=model, data=data)

# Compute the generalized velocity and the free-floating Jacobian of the frame C.
ν = data.generalized_velocity
CW_J_WC = js.contact.jacobian(model=model, data=data, output_vel_repr=VelRepr.Mixed)

# Compute the velocity of the collidable points using the Jacobians.
v_WC_from_jax = jax.vmap(lambda J, ν: J @ ν, in_axes=(0, None))(CW_J_WC, ν)

assert W_ṗ_C == pytest.approx(v_WC_from_jax[:, 0:3])


def test_contact_jacobian_derivative(
jaxsim_models_floating_base: js.model.JaxSimModel,
velocity_representation: VelRepr,
Expand Down
37 changes: 0 additions & 37 deletions tests/test_contact.py

This file was deleted.

0 comments on commit ee5d8c8

Please sign in to comment.