Hi @q199493422
The articulation must be called while the simulation is running.
To do that, you can subscribe a callback to the editor step event and control the articulation there
I edited your code as shown below and its works for me 😅
I used the UR10 robot for that (because I don’t have the ur5e.usd asset). Also, you can remove some print statements
def editor_update(self, step):
print("step", step)
if not self.ur5e_ar:
self.ur5e_ar = self._dc.get_articulation("/ur10")
joint_target = [1.5, 0, 0, 0, 0, 0]
self._dc.set_articulation_dof_position_targets(self.ur5e_ar, joint_target)
print("step done", time.time())
def load_ur5e(self):
print("load", time.time())
self._dc = _dynamic_control.acquire_dynamic_control_interface()
_physxIFace = _physx.acquire_physx_interface()
self._ar = _dynamic_control.INVALID_HANDLE
set_up_z_axis(self.stage)
add_ground_plane(self.stage, "/groundPlane", "Z", 1000.0, Gf.Vec3f(0.0), Gf.Vec3f(1.0))
setup_physics(self.stage)
_physxIFace.release_physics_objects()
_physxIFace.force_load_physics_from_usd()
light_prim = UsdLux.DistantLight.Define(self.stage, Sdf.Path("/World/defaultLight"))
light_prim.CreateIntensityAttr(1000)
self.update_sub = self.kit.editor.subscribe_to_update_events(self.editor_update)
self.ur5e_ar = None
print("before play", time.time())
self._editor.play()
print("after play", time.time())
# time.sleep(0.5)
# self.ur5e_ar = self._dc.get_articulation("/ur5e")
while True:
print("update", time.time())
# joint_target = [1.5, 0, 0, 0, 0, 0]
# self._dc.set_articulation_dof_position_targets(ur5e_ar, joint_target)
self.kit.update()
time.sleep(0.01)