Is there any documentation on implementing terrain curriculum with the direct workflow? #1564
-
Dear All, I need help setting up a terrain curriculum with the direct workflow. Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Thanks for starting this discussion. We are currently reviewing our upcoming tutorials and will aim to have this in our list. Unfortunately, there's not a specific one for this case just yet, all those we have are listed in our tutorials section. |
Beta Was this translation helpful? Give feedback.
-
In the direct workflow, the user takes care of most of the environment stepping and its internal operations. Hence, there are no tutorials suggesting use-case dependent operations. You can call the operations from the terrain curriculum function in the step function of the direct RL environment. Mainly something similar to these lines from here should be added to the step call: # extract the used quantities (to enable type-hinting)
asset: Articulation = env.scene[asset_cfg.name]
terrain: TerrainImporter = env.scene.terrain
command = env.command_manager.get_command("base_velocity")
# compute the distance the robot walked
distance = torch.norm(asset.data.root_link_pos_w[env_ids, :2] - env.scene.env_origins[env_ids, :2], dim=1)
# robots that walked far enough progress to harder terrains
move_up = distance > terrain.cfg.terrain_generator.size[0] / 2
# robots that walked less than half of their required distance go to simpler terrains
move_down = distance < torch.norm(command[env_ids, :2], dim=1) * env.max_episode_length_s * 0.5
move_down *= ~move_up
# update terrain levels
terrain.update_env_origins(env_ids, move_up, move_down) |
Beta Was this translation helpful? Give feedback.
-
Hello @RandomOakForest, @Mayankm96, Thank you, I understand. |
Beta Was this translation helpful? Give feedback.
In the direct workflow, the user takes care of most of the environment stepping and its internal operations. Hence, there are no tutorials suggesting use-case dependent operations.
You can call the operations from the terrain curriculum function in the step function of the direct RL environment. Mainly something similar to these lines from here should be added to the step call: