Development - abmoRobotics/RLRoverLab GitHub Wiki
This page shows how to add new tasks and assets so that you can perform your own experiments.
Adding new assets
To integrate a new robot asset into your project, please follow the steps outlined below. These steps ensure that the asset is correctly added and configured for use in ORBIT.
Step 1: Collect the Asset
Begin by collecting the necessary asset within Isaac Sim. You do this by right clicking your robot USD file, and click collect as illustratred in the figure below.
You then type in the following options, select an output folder and click collect.
Step 2: Add the Asset Files
Once you have the asset, you need to add it to your project's file structure. Specifically:
-
Navigate to
rover_envs/assets/robots/YOUR_ROBOT_NAME. -
Add the Universal Scene Description (USD) file along with any related content (textures, metadata, etc.) to this directory.
Make sure to replace
YOUR_ROBOT_NAMEwith the actual name of your robot to maintain a clear and organized file structure.
Step 3: Create the Configuration File
For each robot asset, a configuration (cfg) file is required. This file specifies various parameters and settings for the robot:
- Create a new cfg file named
YOUR_ROBOT_NAME.cfgin the same directory as your asset files (rover_envs/assets/robots/YOUR_ROBOT_NAME).
Step 4: Configure the Robot
The final step involves configuring your robot asset using the newly created cfg file:
- Open
YOUR_ROBOT_NAME.cfgand configure it as needed. You can refer to previous configuration files for examples of how to structure your settings. An example configuration file can be found here: Exomy Example Configuration.
By following these steps, you can successfully add and configure a new robot asset and use the suite to train an agent or perform experiments.
Adding a New Task
To incorporate a new task into your project, follow the steps outlined below. This guide ensures that your new task is properly set up and integrated within the existing project structure.
Step 1: Create a New Environment Folder
- Within the
rover_envs/envsdirectory, create a new folder named after your task (TASK_FOLDER). This folder will house all the necessary configuration files for your new task.
Step 2: Create the Task Configuration File
- Inside
TASK_FOLDER, create a configuration file namedTASK_env_cfg.py, substitutingTASKwith the name of your task. This file will define the task's configuration.
Step 3: Define the MDPs
-
In
TASK_env_cfg.py, you'll define the configurations for actions, observations, terminations, commands, and, optionally, randomizations that make up your task's Markov Decision Process (MDP).You can refer to the Navigation Task example for guidance on how to structure this file.
Step 4: Set Up the Robot Folder
-
Within
rover_envs/envs/TASK_FOLDER, create a new folder namedrobots/ROBOT_NAME, replacingROBOT_NAMEwith the name of the robot used in the task.In this folder, create two files:
__init__.pyandenv_cfg.py.
Step 5: Configure env_cfg.py
- The
env_cfg.pyfile customizesTASK_env_cfg.pyfor a specific robot. At a minimum, it should contain the following Python code:
from rover_envs.assets.robots.YOUR_ROBOT import YOUR_ROBOT_CFG
from rover_envs.envs.YOUR_TASK.TASK_env_cfg.py import TaskEnvCfg
@configclass
class TaskEnvCfg(TaskEnvCfg):
def __post_init__(self):
super().__post_init__()
# Define robot
self.scene.robot = YOUR_ROBOT_CFG.replace(prim_path="{ENV_REGEX_NS}/Robot")
Make sure to replace YOUR_ROBOT and YOUR_TASK with the appropriate robot and task names
Step 6: Configure __init__.py
This file registers the environment with the OPENAI gym library. Include at least the following code.
import os
import gymnasium as gym
from . import env_cfg
gym.register(
id="TASK_NAME-v0",
entry_point='omni.isaac.orbit.envs:RLTaskEnv',
disable_env_checker=True,
kwargs={
"env_cfg_entry_point": env_cfg.TaskEnvCfg,
"best_model_path": f"{os.path.dirname(__file__)}/policies/best_agent.pt", # This is optional
}
)
Step 7: Running the Task
With everything set up, you can now run the task as follows:
# Run training policy
cd examples/02_train
python train.py --task="TASK_NAME-v0" --num_envs=128