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

Allow keeping the base pose when a model is reduced #42

Merged
merged 5 commits into from
Jun 30, 2023

Conversation

diegoferigo
Copy link
Member

No description provided.

@diegoferigo diegoferigo self-assigned this Jun 30, 2023
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.

I've tried with my humanoid class for PPO and I've encountered a problem related to the new ABA version in the following line:

vJ = S[i] * qd[ii]

In fact respect to the one presented in #35 I've seen that you've removed a part of the code:

98c81
< vJ = S[i] * qd[i - 1] if qd.size != 0 else S[i] * 0 
#35
---
> vJ = S[i] * qd[ii]
#42

This should allow to treat the case in which the model has no joints, e.g. in the case of this PR, when every joint is blocked

@diegoferigo
Copy link
Member Author

Thanks, I didn't test this case. Should be fixed now, let me know if you still have problems.

@flferretti
Copy link
Collaborator

flferretti commented Jun 30, 2023

Thanks for your changes Diego! I'm now encoutering a small issue that I described in #37. In particular, after having reduced the model, when I try to simulate using step_over_horizon the attribute VelRepr is changed to be a DeviceArray. As I said in #37 (comment), making velocity_representation static in the JaxSim class solved the issue for me

@diegoferigo
Copy link
Member Author

Thanks for your changes Diego! I'm now encoutering a small issue that I described in #37. In particular, after having reduced the model, when I try to simulate using step_over_horizon the attribute VelRepr is changed to be a DeviceArray. As I said in #37 (comment), making velocity_representation static in the JaxSim class solved the issue for me

Mmh, I guess that by JIT-compiling a JaxSim class, jax wants to treat the enum of the velocity representation as a parameter that can be changed without triggering recompilation.

This is not something we want to achieve in the short term since it would involve using jax.lax.select everywhere in high_level.model.Model. Since it's already static in Model, I guess it makes sense to keep it as static also in the simulator.

@flferretti
Copy link
Collaborator

Thank you for your feedback! Looks good to me

@diegoferigo diegoferigo merged commit 11bc6f4 into main Jun 30, 2023
@diegoferigo diegoferigo deleted the feature/reduce_and_keep_base_pose branch June 30, 2023 21:04
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.

Update step_over_horizon to preserve velocity_representation attribute
2 participants