NVIDIA / warp

A Python framework for high performance GPU simulation and graphics
https://nvidia.github.io/warp/
Other
1.75k stars 148 forks source link

Why state.joint_q is not updated during simulation? #210

Open Qianzhong-Chen opened 1 month ago

Qianzhong-Chen commented 1 month ago

Previously, I used dFlex's integrator.forward() method to control and update robot's state.joint_q, state.joint_qd with joint_act. Recently, as I turned to Warp, I found that when using integrator.simulate(), though I include control.joint_act, but the joint_q and joint_qd were stay unchanged.

Moreove, during testing, I print out Warp's example_cartpole's state.joint_q state.joint_qd and find them stay unchanged as well.

I am wondering if there is anyway to update state.joint_q and state.joint_qd during simulation using integrator? Thank you for any possible help!

eric-heiden commented 1 month ago

Hi @Qianzhong-Chen,

You can update the state.joint_q and state.joint_qd manually using the inverse kinematics function eval_ik:

wp.sim.eval_ik(model, state, state.joint_q, state.joint_qd)

Alternatively, you could use the FeatherstoneIntegrator which, like dFlex, uses state.joint_q, state.joint_qd as state representation for rigid bodies as opposed to body_q/body_qd like the other integrators.