Get all state from dynamic control resets the effort set previously

Hi, I am using Dynamic control to apply torque to my robot joint using dc.set_dof_effort(). I have found that if I get all dof state using dc.get_articulation_dof_states() API, it resets the effort I set previously. Can you help me confirm this behaviour? is it a bug?

A minimal example is provided below:

effort = 10
dc.set_dof_effort(joint_handle, effort)
dof_efforts = dc.get_articulation_dof_efforts(art_handle)
print(dof_efforts) # This value is correct. It shows the effort that was set.
dof_state = dc.get_articulation_dof_states(art_handle, dc.STATE_ALL)
print(dof_state["effort"] # This value is wrong. It does not show the effort that was set.
dof_efforts = dc.get_articulation_dof_efforts(art_handle)
print(dof_efforts) # This value is now wrong. It no longer shows the effort that was set

When

get_articulation_dof_states

is called it currently will return the force due to gravity on the articulation. Which overrides the effort that was set. There is a larger effort to fix the efforts that are reported because currently they only contain gravity, and there are other problems with joint force sensors that we are working on fixing.

I would consider this a bug from a user’s perspective. I am not sure if there is a way to workaround this though, PhysX resets the effort variable that’s used internally when gravitational forces are computed.

But yes I can confirm the behavior and why its happening.