Improbable-AI / walk-these-ways

Sim-to-real RL training and deployment tools for the Unitree Go1 robot.
https://gmargo11.github.io/walk-these-ways/
Other
488 stars 129 forks source link

How to get joint torque values from StateEstimator? Maybe tau_est? #34

Closed Robokan closed 1 year ago

Robokan commented 1 year ago

In StateEstimator you get back 3 sets of leg values: joint_pos, joint_vel, and tau_est. Is tau_est the force feedback from the joints? If not do you know if its possible to get this information from the Go1?

I am getting ready to put my own neural network that takes all it's movements from motion capture. Your repo has been super helpful. Thanks for posting it.

gmargo11 commented 1 year ago

Hi @Robokan ,

Yes, tau_est is the torque estimate for the joints. This estimate comes from Unitree's SDK. It is computed based on the motor current, which can be noisy but seems reasonable in my experience.

Glad to hear you've found the repo useful!

-Gabe

Robokan commented 1 year ago

I see you are also using an additional NN to predict the internal dynamics of the actuators. I am interested in changing it to output positional values rather than torques. It seems like it would be more efficient. Have you tried it?

gmargo11 commented 1 year ago

@Robokan I haven't tried that! However, I think it's better to provide the torques to IsaacGym so it can compute the forward dynamics. If you set the position directly with a neural network, IsaacGym can't ensure that the laws of physics are maintained.

-Gabe

Robokan commented 1 year ago

Keeping the computation of the spring/damper in the internal physics engine should be more stable and work with higher integrations steps. So wondering if tuning the stiffness and damping parameters first then using the actuation network just capture and dynamics of the physical actuators might be and interesting approach. It would take in the desired targets and emit desired targets (or just additional forces) to make the isaac gym spring/damper system behave more like reality. How would it break the laws of physics? I would assume if the spring/damper system was set up correctly it should enforce them. I am sure you have thought a lot about these things and figured out what actually worked. I was just curious about this approach.

gmargo11 commented 1 year ago

@Robokan that's a neat idea, I haven't tried it! If you have the neural network predict the position target for PD control, I agree it might improve the stability of the physics simulation.

As another extension, you could even train the actuator network to predict the "effective" PD gains that predict the torque profile between time steps. To capture those fast dynamics, you could probably increase the logging frequency to a higher rate than 50Hz. That would give you some data to estimate the effective PD gains

Robokan commented 1 year ago

Thanks, I will take a look at that and maybe even get the actual simulator in the training loop and see if it can be tuned to be as close as possible.