Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoferigo committed Oct 7, 2024
1 parent a8b20c9 commit f34a845
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions tests/test_automatic_differentiation.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import jaxsim.rbda
import jaxsim.typing as jtp
from jaxsim import VelRepr
from jaxsim.rbda.contacts import SoftContacts, SoftContactsParams, SoftContactsState
from jaxsim.rbda.contacts import SoftContacts, SoftContactsParams

# All JaxSim algorithms, excluding the variable-step integrators, should support
# being automatically differentiated until second order, both in FWD and REV modes.
Expand Down Expand Up @@ -343,16 +343,13 @@ def test_ad_integration(
model=model, velocity_representation=VelRepr.Inertial, key=subkey
)

# Make sure that the active contact model is SoctContacts.
assert isinstance(data.state.contact, SoftContactsState)

# State in VelRepr.Inertial representation.
W_p_B = data.base_position()
W_Q_B = data.base_orientation(dcm=False)
s = data.joint_positions(model=model)
W_v_WB = data.base_velocity()
= data.joint_velocities(model=model)
m = data.state.contact.tangential_deformation
m = data.state.extended["tangential_deformation"]

# Inputs.
W_f_L = references.link_forces(model=model)
Expand Down Expand Up @@ -406,7 +403,7 @@ def step(
base_angular_velocity=W_v_WB[3:6],
joint_velocities=,
),
contact=js.ode_data.SoftContactsState.build(tangential_deformation=m),
extended_state={"tangential_deformation": m},
),
)

Expand All @@ -425,7 +422,7 @@ def step(
xf_s = data_xf.joint_positions(model=model)
xf_W_v_WB = data_xf.base_velocity()
xf_ṡ = data_xf.joint_velocities(model=model)
xf_m = data_xf.state.contact.tangential_deformation
xf_m = data_xf.state.extended["tangential_deformation"]

return xf_W_p_B, xf_W_Q_B, xf_s, xf_W_v_WB, xf_ṡ, xf_m

Expand Down

0 comments on commit f34a845

Please sign in to comment.