-
Notifications
You must be signed in to change notification settings - Fork 13
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
Add new ViscoElasticContacts
#248
Conversation
ViscoElasticContactModel
ViscoElasticContacts
ed97707
to
986854e
Compare
Hi @diegoferigo, another early comment since I'm testing this contact model: in Lines 378 to 387 in 986854e
From jaxsim/src/jaxsim/api/contact.py Lines 235 to 236 in 986854e
|
986854e
to
8a7e3ae
Compare
Thanks @xela-95 for the feedback. The dictionary returned by the visco-elastic contact model is somewhat different then the one returned by the soft contact model. The latter returns Regardless, I'm still unsure how to integrate the new visco-elastic contacts with the default |
aee7fc2
to
d534a25
Compare
d534a25
to
7556b6b
Compare
7556b6b
to
2bd727b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Diego, this is great! In general, would you agree in adding an underscore before the "private" methods so it is easier to understand what the user should not call externally?
Perhaps we can simply print a nice error if |
After my comment, I already implemented a jit-compatible exception in this PR that is raised when the new contact model is used with the regular integrators. jaxsim/src/jaxsim/api/contact.py Lines 212 to 220 in 2bd727b
|
Co-authored-by: Filippo Luca Ferretti <102977828+flferretti@users.noreply.github.com>
e1434e1
to
aa41dfc
Compare
@andreadelprete you might be interested in having a look at this PR. After we discussed about this methodology f2f, I was interested in drafting an implementation. In open-loop, it seems working pretty well. We are investigating if we can run our closed-loop control stack that currently works using both Note that, as I wrote in the PR description, I updated the formulation to properly account for static friction and non-linear contact models. Performance are not yet the best due to the usage of the plain Edit: last comment, the video reported above was recorded by running a simulation on GPU with 32-bits floats :) |
Hi @diegoferigo , thanks for pointing this out to me. Actually @DanielePucci has been bragging about this work with me for the last two weeks, so I was curious to see it! :)
This is interesting, but I really don't get how you could achieve this. I guess I could understand by looking at the code, but that would take me a long time. Maybe you can explain me here instead?
Nice that you changed the tangential force computation. I was not completely satisfied by our results when slippage occured, so I expect you probably improved this.
How much larger? If one day you write the theory down, I'd love to have a look. Andrea |
This is a workaround that we were already using in our simple The main intuition is that, instead of detecting/saving/updating The original idea was taken from this paper2, that I extended to non-flat surfaces in my PhD thesis3. The resulting system that allows for sticking/slipping can be seen as a spring/damper/clutch (Fig. 12 of the Azad paper):
We include this extra Footnotes
|
Ok, got it. So you get rid of p0 but you introduce m, so there is no gain in terms of quantity of information that you have to remember. The gain is regarding the sticking-slipping dynamics.
Ok. Unfortunately 50% larger is a significant increase, but if that's the price to pay to get a nice stick-slip behavior it's definitely worth it! Thanks for the quick and clear reply! Andrea |
Exactly, there is no real workaround to obtain sticking/slipping without somehow tracking the point displacement. You can find different ways to accumulate/compute this displacement, but if this information (corresponding to the tangential terrain direction) is used together with a second Hunt/Crossley-like model to compute the friction force, there's no really any solution I can think of that allows us to remove its need. I agree that 50% more rows and columns is a significant increase, and this is the real trade-off of my proposed changes. In a sense, the formulation of this PR provides a self-contained solution without tricks that happen outside the contact model itself to obtain a behavior that intrinsically supports stick/slip transitions operating with a real friction cone (no pyramid or other approximations). In a JAX-based context, this approach seems to be beneficial under many terms. I see this methodology as something that is more complex than our simple Anyway, thanks for pointing me out to this methodology. I had fun studying the theory and implementing it, linearization and exponential integration brought me back to my time at university :) |
This PR implements a revised and ―possibly― improved contact model originally proposed in the following manuscript:
Although the theory is not yet public, my implementation proposes the following improvements:
viscoelastic_contacts_ergocub.mp4
Open points left to future work:
jax.scipy.linalg.expm
. However, beyond implementing the logic, which is doable, we should also figure out how to expose AD. It's not clear to me what could be the performance degradation of relying to pure AD w.r.t. the usage of the custom adjoints as done internally in JAX.📚 Documentation preview 📚: https://jaxsim--248.org.readthedocs.build//248/