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

Analytical policy gradient using num diff with contacts #865

Closed
Jogima-cyber opened this issue May 13, 2023 · 1 comment
Closed

Analytical policy gradient using num diff with contacts #865

Jogima-cyber opened this issue May 13, 2023 · 1 comment
Labels
question Request for help or information

Comments

@Jogima-cyber
Copy link

Hi,

I'm trying to use MuJoCo to get gradients in contact situations with numerical differentiation (finite differences).
I'm currently using these lines to calculate the forward dynamics :

mujoco.mj_forward(mj_model, mj_data)
mujoco.mj_Euler(mj_model, mj_data)

and then later this line to get the num diff gradients :

mujoco.mjd_transitionFD(mj_model, mj_data, eps, centered, Fx, Fu, None, None)

This works well when there are no contacts, I've checked the gradients.

I was wondering if this is still giving the correct num diff gradient in a contact situation. I've read this issue which seems to indicate that I have to add mujoco.mj_rnePostConstraint(mj_model, mj_data) before the call to mujoco.forward but I'm not sure, what do you think?

@Jogima-cyber Jogima-cyber added the question Request for help or information label May 13, 2023
@erez-tom
Copy link
Collaborator

I expect things to Just Work. Give it a try, and let us know how it goes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Request for help or information
Projects
None yet
Development

No branches or pull requests

2 participants