Demonstrates how to use the action primitives to pick and place an object in a crowded scene.
It loads Rs_int with a robot, and the robot picks and places an apple.
Source code in omnigibson/examples/action_primitives/rs_int_example.py
| def main():
"""
Demonstrates how to use the action primitives to pick and place an object in a crowded scene.
It loads Rs_int with a robot, and the robot picks and places an apple.
"""
# Load the config
config_filename = os.path.join(og.example_config_path, "fetch_primitives.yaml")
config = yaml.load(open(config_filename, "r"), Loader=yaml.FullLoader)
# Update it to run a grocery shopping task
config["scene"]["scene_model"] = "Rs_int"
config["scene"]["not_load_object_categories"] = ["ceilings"]
config["objects"] = [
{
"type": "DatasetObject",
"name": "apple",
"category": "apple",
"model": "agveuv",
"position": [-0.3, -1.1, 0.5],
"orientation": [0, 0, 0, 1],
},
]
# Load the environment
env = og.Environment(configs=config)
scene = env.scene
robot = env.robots[0]
# Allow user to move camera more easily
og.sim.enable_viewer_camera_teleoperation()
controller = StarterSemanticActionPrimitives(env, enable_head_tracking=False)
cabinet = scene.object_registry("name", "bottom_cabinet_slgzfc_0")
apple = scene.object_registry("name", "apple")
# Grasp apple
print("Executing controller")
execute_controller(controller.apply_ref(StarterSemanticActionPrimitiveSet.GRASP, apple), env)
print("Finished executing grasp")
# Place on cabinet
print("Executing controller")
execute_controller(controller.apply_ref(StarterSemanticActionPrimitiveSet.PLACE_ON_TOP, cabinet), env)
print("Finished executing place")
|