-
Notifications
You must be signed in to change notification settings - Fork 11
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
Refactor velocity representations as integers #160
base: main
Are you sure you want to change the base?
Conversation
9bc8e2c
to
a262dda
Compare
40457a7
to
5d5ba73
Compare
The AD tests take a bit longer to complete. This can be due to the JAX traceback used in |
Awesome, thanks @flferretti for this PR. I'd expect the following consequences:
Not yet sure if my intuition is correct. This being said, I'd like to tag a release with all the previous improvement. I don't expect surprises here, but being such a large change touching pretty much all our API surface, I prefer being cautious and include this PR in the following release (v0.4.0). I'll be reviewing this shortly. |
I guess that now AD needs to propagate gradients through all possible branches instead of just one. And yes, this might take longer. |
I agree with your intuitions, the IR should now include the three branches for each velocity representation and the recompilation should not be triggered when we use
I totally agree, this can be potentially disruptive, so I'd also prefer to be cautious and eventually rebase this onto #172 |
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.
I've just finished a first review pass, things look generally good. I'll going to request some changes, and make a second pass later. I still need to weight some consequences especially on AD performance.
Here below my comments / questions:
- Most of the match-case seem to me 1:1 with the new lax.switch functions. Are there any sections in which you had to modify the original code? I checked the diff, but since it's quite large, I could have missed something.
- In most cases, this PR does not alter significantly the readability of the code, I like that. We already had an extra indentation level due to the match-case statements, and the new functions use the same. There are cases, however, where the logic got much more complex and indented, like in
JaxSimModelReferences
. Let's keep this in mind in case we want to refactor it with a more simple approach. - Do you think it could be helpful adding a new
jaxsim.typing.VelRepr
variable that points toint
? Since this removed enum are part of the core public APIs, I'd prefer to make clear that those are not generic integer types.
No, they should be equivalent
Yes, the logic got more complex since I needed to somehow check the values of some parameters. We can think of a smarter solution to handle that in the future.
Totally yes! I'll a commit for that |
8398f0b
to
88d5a2d
Compare
b878836
to
cec46de
Compare
In Articulated Body Algorithm Co-authored-by: Alessandro Croci <[email protected]>
Co-authored-by: Diego Ferigo <[email protected]>
dc175c9
to
d580622
Compare
Checks are failing due to a timeout of the CI |
This pull request refactors the velocity representation in the JaxSim API. The changes include avoiding the use of
enum
inVelRepr
and makingvelocity_representation
a non-static argument in some methods ofjaxsim.api.JaxSimModelData
. These changes improve the compatibility with JAX while avoiding breaking changes in the API, making it possible to potentially usingjax.vmap
on different velocity representations📚 Documentation preview 📚: https://jaxsim--160.org.readthedocs.build//160/