Demo to use the raycasting-based sampler to load objects onTop and/or inside another
Loads a cabinet, a microwave open on top of it, and two plates with apples on top, one inside and one on top of the cabinet
Then loads a shelf and cracker boxes inside of it
Source code in examples/object_states/sample_kinematics_demo.py
| def main(random_selection=False, headless=False, short_exec=False):
"""
Demo to use the raycasting-based sampler to load objects onTop and/or inside another
Loads a cabinet, a microwave open on top of it, and two plates with apples on top, one inside and one on top of the cabinet
Then loads a shelf and cracker boxes inside of it
"""
logging.info("*" * 80 + "\nDescription:" + main.__doc__ + "*" * 80)
# Create the scene config to load -- empty scene
cfg = {
"scene": {
"type": "Scene",
}
}
# Create the environment
env = og.Environment(configs=cfg, action_timestep=1/60., physics_timestep=1/60.)
env.step([])
# Sample microwave and boxes
sample_boxes_on_shelf(env)
sample_microwave_plates_apples(env)
max_steps = 100 if short_exec else -1
step = 0
while step != max_steps:
env.step(np.array([]))
step += 1
# Always close environment at the end
env.close()
|