Skip to content

Commit

Permalink
Address review
Browse files Browse the repository at this point in the history
Co-authored-by: Alessandro Croci <[email protected]>
Co-authored-by: Filippo Luca Ferretti <[email protected]>
  • Loading branch information
3 people committed Jun 3, 2024
1 parent acd8a46 commit bcd35dc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/jaxsim/api/contact.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,8 @@ def jacobian(W_H_C: jtp.Matrix, W_J_WC: jtp.Matrix) -> jtp.Matrix:
C_X_W = jaxsim.math.Adjoint.from_transform(
transform=W_H_C, inverse=True
)
C_J_WCi = C_X_W @ W_J_WC
return C_J_WCi
C_J_WC = C_X_W @ W_J_WC
return C_J_WC

O_J_WC = jax.vmap(jacobian)(W_H_C, W_J_WC)

Expand Down
4 changes: 2 additions & 2 deletions tests/test_contact.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ def test_collidable_point_jacobians(

# Compute the generalized velocity and the free-floating Jacobian of the frame C.
ν = data.generalized_velocity()
CL_J_WC = js.contact.jacobian(model=model, data=data, output_vel_repr=VelRepr.Mixed)
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))(CL_J_WC, ν)
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])

0 comments on commit bcd35dc

Please sign in to comment.