Skip to content

Commit

Permalink
Update signature of ContactModel.compute_contact_forces
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoferigo committed Oct 9, 2024
1 parent a9fd6b2 commit 847a600
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 9 deletions.
7 changes: 4 additions & 3 deletions src/jaxsim/rbda/contacts/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def compute_contact_forces(
model: js.model.JaxSimModel,
data: js.data.JaxSimModelData,
**kwargs,
) -> tuple[jtp.Vector, tuple[Any, ...]]:
) -> tuple[jtp.Matrix, tuple[Any, ...]]:
"""
Compute the contact forces.
Expand All @@ -140,8 +140,9 @@ def compute_contact_forces(
data: The data of the considered model.
Returns:
A tuple containing as first element the computed 6D contact force applied to the contact point and expressed in the world frame,
and as second element a tuple of optional additional information.
A tuple containing as first element the computed 6D contact force applied to
the contact points and expressed in the world frame, and as second element
a tuple of optional additional information.
"""

pass
Expand Down
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 @@ -230,7 +230,7 @@ def compute_contact_forces(
*,
link_forces: jtp.MatrixLike | None = None,
joint_force_references: jtp.VectorLike | None = None,
) -> tuple[jtp.Vector, tuple[Any, ...]]:
) -> tuple[jtp.Matrix, tuple]:
"""
Compute the contact forces.
Expand All @@ -244,7 +244,7 @@ def compute_contact_forces(
Optional `(n_joints,)` vector of joint forces.
Returns:
A tuple containing the contact forces.
A tuple containing as first element the computed contact forces.
"""

# Initialize the model and data this contact model is operating on.
Expand Down
4 changes: 2 additions & 2 deletions src/jaxsim/rbda/contacts/rigid.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ def compute_contact_forces(
*,
link_forces: jtp.MatrixLike | None = None,
joint_force_references: jtp.VectorLike | None = None,
) -> tuple[jtp.Vector, tuple[Any, ...]]:
) -> tuple[jtp.Matrix, tuple]:
"""
Compute the contact forces.
Expand All @@ -256,7 +256,7 @@ def compute_contact_forces(
Optional `(n_joints,)` vector of joint forces.
Returns:
A tuple containing the contact forces.
A tuple containing as first element the computed contact forces.
"""

# Initialize the model and data this contact model is operating on.
Expand Down
13 changes: 12 additions & 1 deletion src/jaxsim/rbda/contacts/soft.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,18 @@ def compute_contact_forces(
self,
model: js.model.JaxSimModel,
data: js.data.JaxSimModelData,
) -> tuple[jtp.Vector, tuple[jtp.Vector]]:
) -> tuple[jtp.Matrix, tuple[jtp.Matrix]]:
"""
Compute the contact forces.
Args:
model: The model to consider.
data: The data of the considered model.
Returns:
A tuple containing as first element the computed contact forces, and as
second element the derivative of the material deformation.
"""

# Initialize the model and data this contact model is operating on.
# This will raise an exception if either the contact model or the
Expand Down
2 changes: 1 addition & 1 deletion src/jaxsim/rbda/contacts/visco_elastic.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ def compute_contact_forces(
dt: jtp.FloatLike,
link_forces: jtp.MatrixLike | None = None,
joint_force_references: jtp.VectorLike | None = None,
) -> tuple[jtp.Vector, tuple[Any, ...]]:
) -> tuple[jtp.Matrix, tuple[jtp.Matrix, jtp.Matrix]]:
"""
Compute the contact forces.
Expand Down

0 comments on commit 847a600

Please sign in to comment.