mujoco-python-viewer icon indicating copy to clipboard operation
mujoco-python-viewer copied to clipboard

How do I apply force to the actuator?

Open smwscth opened this issue 1 year ago • 1 comments

Hello, I want to apply force to ur5 model but I don't found the function. I use 'sim.data.ctrl' when I use mujoco-python, anyone can tell me which function can I use ? Thank you for your answer very much.

smwscth avatar Feb 20 '24 10:02 smwscth

Simplest working model. Need more details for a better answer.

m = mujoco.MjModel.from_xml_path(<xml>)
d =  mujoco.MjData(m)

while <simloop>:
  mujoco.mj_step(m, d)
  d.ctrl[<act_id>] = <your_control_value>

nsk126 avatar Mar 05 '24 22:03 nsk126