Skip to content

Commit

Permalink
Rename method that computes contact forces
Browse files Browse the repository at this point in the history
Co-authored-by: Diego Ferigo <[email protected]>
  • Loading branch information
flferretti and diegoferigo committed Jun 17, 2024
1 parent d2cb44b commit a5c69ce
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/jaxsim/api/contact.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def collidable_point_dynamics(
# collidable point, and the corresponding material deformation rate.
# Note that the material deformation rate is always returned in the mixed frame
# C[W] = (W_p_C, [W]). This is convenient for integration purpose.
W_f_Ci, CW_ṁ = jax.vmap(soft_contacts.contact_model)(
W_f_Ci, CW_ṁ = jax.vmap(soft_contacts.compute_contact_forces)(
W_p_Ci, W_ṗ_Ci, data.state.contacts_state.tangential_deformation
)

Expand Down
5 changes: 3 additions & 2 deletions src/jaxsim/rbda/contacts/common.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

import abc
from typing import Any

import jaxsim.terrain
import jaxsim.typing as jtp
Expand Down Expand Up @@ -80,12 +81,12 @@ class ContactModel(abc.ABC):
terrain: jaxsim.terrain.Terrain

@abc.abstractmethod
def contact_model(
def compute_contact_forces(
self,
position: jtp.Vector,
velocity: jtp.Vector,
**kwargs,
) -> tuple[jtp.Vector, jtp.Vector]:
) -> tuple[Any, ...]:
"""
Compute the contact forces.
Args:
Expand Down
2 changes: 1 addition & 1 deletion src/jaxsim/rbda/contacts/soft_contacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class SoftContacts(ContactModel):

terrain: Terrain = dataclasses.field(default_factory=FlatTerrain)

def contact_model(
def compute_contact_forces(
self,
position: jtp.Vector,
velocity: jtp.Vector,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_automatic_differentiation.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ def close_over_inputs_and_parameters(
m: jtp.VectorLike,
params: SoftContactsParams,
) -> tuple[jtp.Vector, jtp.Vector]:
return SoftContacts(parameters=params).contact_model(
return SoftContacts(parameters=params).compute_contact_forces(
position=p, velocity=v, tangential_deformation=m
)

Expand Down

0 comments on commit a5c69ce

Please sign in to comment.