Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Filippo Luca Ferretti <[email protected]>
  • Loading branch information
diegoferigo and flferretti committed Oct 17, 2024
1 parent 6c91b3b commit 70aec89
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/jaxsim/rbda/contacts/relaxed_rigid.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,13 +265,13 @@ def compute_contact_forces(
jnp.array(link_forces, dtype=float).squeeze()
if link_forces is not None
else jnp.zeros((model.number_of_links(), 6))
).astype(float)
)

joint_force_references = jnp.atleast_1d(
jnp.array(joint_force_references, dtype=float).squeeze()
if joint_force_references is not None
else jnp.zeros(model.number_of_joints())
).astype(float)
)

references = js.references.JaxSimModelReferences.build(
model=model,
Expand Down
8 changes: 4 additions & 4 deletions tests/test_simulations.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,11 +402,11 @@ def test_simulation_with_relaxed_rigid_contacts(
model=model,
base_position=jnp.array([0.0, 0.0, box_height * 2]),
velocity_representation=VelRepr.Inertial,
# In order to achieve almost no penetration, we need to use a fairly large
# Baumgarte stabilization term.
# For this contact model, the following method is practically no-op.
# Let's leave it there for consistency and to make sure that nothing
# gets broken if it is updated in the future.
contacts_params=js.contact.estimate_good_contact_parameters(
model=model,
time_constant=0.001,
),
)
# ===========================================
Expand All @@ -415,7 +415,7 @@ def test_simulation_with_relaxed_rigid_contacts(

data_tf = run_simulation(model=model, data_t0=data_t0, dt=0.001, tf=1.0)

# With this contact model, we need to slightly adjust the tolerance on xy.
# With this contact model, we need to slightly increase the tolerances.
assert data_tf.base_position()[0:2] == pytest.approx(
data_t0.base_position()[0:2], abs=0.000_010
)
Expand Down

0 comments on commit 70aec89

Please sign in to comment.