Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix jaxsim.api.model.link_contact_forces #242

Merged
merged 2 commits into from
Sep 24, 2024

Conversation

xela-95
Copy link
Member

@xela-95 xela-95 commented Sep 23, 2024

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 to jaxsim.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: through ode.system_velocity_dynamics it calls contact.collidable_point_dynamics with the correct arguments, while contact.collidable_point_forces was not aligned.

Let me know what do you think of this :)


📚 Documentation preview 📚: https://jaxsim--242.org.readthedocs.build//242/

Add external link forces and joint torques as input arguments that are then passed to `collidable_point_dynamics`
Add external link forces and joint torques as input arguments that are then considered when computing the link contact forces
@xela-95 xela-95 self-assigned this Sep 23, 2024
@xela-95
Copy link
Member Author

xela-95 commented Sep 23, 2024

Also I'm not sure where it is more appropriate to validate the input arguments in the chain of function calls, for now I just check the input link forces and joint torques in jaxsim.api.model.link_contact_forces.

Copy link
Collaborator

@flferretti flferretti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot @xela-95 for the fix, LGTM

Copy link
Member

@diegoferigo diegoferigo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @xela-95, LGTM!

@diegoferigo diegoferigo merged commit db72bf5 into ami-iit:main Sep 24, 2024
14 checks passed
@xela-95 xela-95 deleted the fix/model-link-contact-forces branch September 24, 2024 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants