I am trying to execute a sequence of pick and place tasks using a cobotta_pro_900 in IsaacSim with DynamicCylinders as objects for the tasks. I took the pick and place example from omni.isaac.core and used the template to create a new task class that picks an object and places it in a desired position. However, when I try to create a multiple tasks and execute them one after the other, the simulation fails after the first object with the below warning
2024-06-11 17:58:18 [91,858ms] [Warning] [omni.usd] Unexpected reference count of 2 for UsdStage 'anon:0x13b006d0:World0.usd' while being closed in UsdContext (this may indicate it is still resident in memory).
[91.917s] Simulation App Shutting Down
The only reference to multiple tasks I have found from the documentation is at Multiple Tasks — Omniverse IsaacSim latest documentation but this doesn’t describe how to sequentially implement multiple tasks on the same robot. Is there any reference to this specific use case and how can I achieve this functionality?
Below is the code snippet I am using to create a list of tasks. For the controller, I am using the rmpflow controller from standalone_examples/api/omni.isaac.manipulators/cobotta_900
picking_robot = my_world.scene.get_object("cobotta_robot")
picking_controller = PickPlaceController(name="controller", robot_articulation=picking_robot, gripper=picking_robot.gripper)
articulation_controller = picking_robot.get_articulation_controller()
tasks = []
for i in range(num_tasks):
target_position = dest_positions[i]
task_name = "task_"+str(i)
tasks.append(PickPlaceObject(name=task_name, target_position=target_position,robot=picking_robot,target_obj = cylinder_block))
my_world.add_task(tasks[-1])
my_world.reset()
for i in range(num_tasks):
target_position = dest_positions[i]
task_name = tasks[i].name
task_params = my_world.get_task(task_name).get_params()
while simulation_app.is_running():
my_world.step(render=True)
if my_world.is_playing():
if my_world.current_time_step_index == 0:
my_world.reset()
picking_controller.reset()
observations = my_world.get_observations()
actions = picking_controller.forward(
picking_position = source_positions[i],
placing_position= dest_positions[i],
current_joint_positions=observations[task_params["robot_name"]["value"]]["joint_positions"],
# This offset needs tuning as well
end_effector_offset=np.array([0.0, 0, 0.25]))
articulation_controller.apply_action(actions)
if picking_controller.is_done():
print("Done picking and placing object")
break
simulation_app.close()