Fix jaxsim.api.model.link_contact_forces
#242
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In this PR I added to the
jaxsim.api.model.link_contact_forces
API the external link forces and joint torques as additional input arguments. These are then passed tojaxsim.api.contact.collidable_point_forces
. In this way, the contact forces computed with the rigid contact model (but this applies also to relaxed-rigid ones I think) will consider all the forces acting on the model.I faced an issue when I was performing simulations with @flferretti using rigid contacts, and we noted that the contact forces given by
jaxsim.api.model.link_contact_forces
were only related to the weight of the model and were not considering other forces potentially acting on the model.The computation of the contact forces used inside
model.step
was already correct: throughode.system_velocity_dynamics
it callscontact.collidable_point_dynamics
with the correct arguments, whilecontact.collidable_point_forces
was not aligned.Let me know what do you think of this :)
📚 Documentation preview 📚: https://jaxsim--242.org.readthedocs.build//242/