diff --git a/src/jaxsim/rbda/contacts/common.py b/src/jaxsim/rbda/contacts/common.py index f87a61ca9..e6548d810 100644 --- a/src/jaxsim/rbda/contacts/common.py +++ b/src/jaxsim/rbda/contacts/common.py @@ -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. @@ -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 diff --git a/src/jaxsim/rbda/contacts/relaxed_rigid.py b/src/jaxsim/rbda/contacts/relaxed_rigid.py index d928c1517..6770251f4 100644 --- a/src/jaxsim/rbda/contacts/relaxed_rigid.py +++ b/src/jaxsim/rbda/contacts/relaxed_rigid.py @@ -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. @@ -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. diff --git a/src/jaxsim/rbda/contacts/rigid.py b/src/jaxsim/rbda/contacts/rigid.py index e58ac4a3a..9c99beb12 100644 --- a/src/jaxsim/rbda/contacts/rigid.py +++ b/src/jaxsim/rbda/contacts/rigid.py @@ -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. @@ -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. diff --git a/src/jaxsim/rbda/contacts/soft.py b/src/jaxsim/rbda/contacts/soft.py index 8b626bc00..4af693527 100644 --- a/src/jaxsim/rbda/contacts/soft.py +++ b/src/jaxsim/rbda/contacts/soft.py @@ -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 diff --git a/src/jaxsim/rbda/contacts/visco_elastic.py b/src/jaxsim/rbda/contacts/visco_elastic.py index 35e7342a5..dcbfd3d20 100644 --- a/src/jaxsim/rbda/contacts/visco_elastic.py +++ b/src/jaxsim/rbda/contacts/visco_elastic.py @@ -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.