flybody icon indicating copy to clipboard operation
flybody copied to clipboard

Controlling the fly legs using torque control

Open Er1ckR0mo opened this issue 1 year ago • 8 comments

Hi! From your paper, I see the wings can be controlled by inputting torques. My question is, can I do the same with the leg joints? Also, what units should the input torque be? Thanks!

Er1ckR0mo avatar May 23 '24 12:05 Er1ckR0mo

Yes of course, the fly model is readily reconfigurable and you can switch to torque actuators for legs as well.

You can do it either by directly editing the fly xml file (low-level, so might be painful), of do it programmatically using PyMJCF (recommended). Here is an example of how it's done for the dm_control rodent model. It would be slightly different for the fly model, but the procedure is similar.

The MuJoCo docs on actuators could also be helpful.

vaxenburg avatar May 24 '24 17:05 vaxenburg

Thank you for your reply! May I ask two more doubts: How do you select the components of the actuator, such as forcerange, etc.?

Also, how are the damping and stiffness values of the joint selected? Are these based on literature or trial and error?

Thanks!

Er1ckR0mo avatar May 28 '24 13:05 Er1ckR0mo

Most of these things are pretty loose for now. The actuator parameters are mostly educated guesses. For example you can use some fly walking videos to estimate the leg velocity and/or acceleration and then roughly estimate the force ballpark. Trial and error also works:)

One choice of damping could be to use critical damping (for given actuator gain), you can try calculating it with a function like this.

Getting better estimates for some of these parameters could be an interesting project.

vaxenburg avatar May 29 '24 18:05 vaxenburg

Hi again!

Do you have an example where you control the wings of your fly model by using torque control?

Thanks in advance!

Er1ckR0mo avatar Jul 02 '24 18:07 Er1ckR0mo

Sure, in fact we used nothing but torque control for the wings

vaxenburg avatar Jul 02 '24 18:07 vaxenburg

could you please refer me to it?

Er1ckR0mo avatar Jul 02 '24 18:07 Er1ckR0mo

Do you mean the flight task? It's here: https://github.com/TuragaLab/flybody/blob/main/flybody/fly_envs.py#L29 https://github.com/TuragaLab/flybody/blob/main/flybody/tasks/flight_imitation.py#L16

vaxenburg avatar Jul 02 '24 18:07 vaxenburg

Thanks! Going to check these. I am interested in knowing how the torques are inputted to the actuators in mujoco and how these torque values are selected/updated during the task.

Er1ckR0mo avatar Jul 02 '24 18:07 Er1ckR0mo