How to use set_rigid_body_linear_velocity(self, arg0, arg1) from class DynamicControl?

Hi, I want to move my robot basis using set_rigid_body_linear_velocity. So far as I understand, arg1 is the vector in 3D. But what is arg0? Can someone give me an example of how to use it?

Hi @hoanggiang

As far as I know, it depends on the method called.
This argument can be a handle to an articulation, a dof, a joint, or a rigid body, for example.

The name of the method can help you infer the correct handle type

For the set_rigid_body_linear_velocity method arg0 is the handle to a rigid body. You can get this handle using the get_rigid_body method by passing the path (string) of the rigid body object in the stage, as shown the documentation

Thanks for your reply, I tried a snippet of code to test that function get_rigid_body to get the position and velocity but it didn’t work correctly. Can you tell me what did I do wrong?
To reproduce:

  1. Go to Isaac Examples / Controlling / Dynamic Control / Robot Navigation
  2. Load Environment => Click Play => Move Robot
  3. Wait until it’s moving then Run the code
from omni.isaac.dynamic_control import _dynamic_control
dc = _dynamic_control.acquire_dynamic_control_interface()

rigid_body = dc.get_rigid_body("/robot")
print("Position", dc.get_rigid_body_pose(rigid_body).p)
print("Velocity", dc.get_rigid_body_linear_velocity(rigid_body))

The results are always (0,0,0) for Position and Velocity

Ok I found the problem, actually the function name is quite misleading for me. Instead of get_rigid_body one should use get_articulation_root_body. Now it works for me:

from omni.isaac.dynamic_control import _dynamic_control
dc = _dynamic_control.acquire_dynamic_control_interface()

art = dc.get_articulation("/robot")
rigid_body = dc.get_articulation_root_body(art)
# print old values
print("Position", dc.get_rigid_body_pose(rigid_body).p)
print("Velocity", dc.get_rigid_body_linear_velocity(rigid_body))
dc.set_rigid_body_linear_velocity(rigid_body, [100, 0, 0])
# print new values
print("Velocity", dc.get_rigid_body_linear_velocity(rigid_body))

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.