# Pair Lab Simulation
[](https://www.python.org/downloads/)
[](https://docs.isaacsim.omniverse.nvidia.com/4.5.0/index.html)
[](https://isaac-sim.github.io/IsaacLab/v2.1.0/index.html)
This repository contains the simulation tooling for the PAIR (Physical AI and Robotics) Lab
## Table of Contents
* [Prerequisites](#prerequisites)
* [Setup](#setup)
* [Training a Policy](#training-a-policy)
* [Evaluating a Trained Policy](#evaluating-a-trained-policy)
* [Listing Available Tasks](#listing-available-tasks)
* [Troubleshooting](#troubleshooting)
* [Project Structure](#project-structure)
## Prerequisites
- **Python 3.10** - [Download](https://www.python.org/downloads/)
- **CUDA-capable, RTX-based GPU** - [NVIDIA Requirements](https://developer.nvidia.com/cuda-gpus)
## Repo Setup
**NOTE** Follow these steps regardless of whether you are using Docker or not.
### Install git and curl
```bash
sudo apt update
sudo apt install git curl
```
### Setup a Personal Access Token on Github (if you don't already have one)
FOllow [this guide](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens), specifically creating a "classic" token.
Make sure to check at least `repo` in the checkboxes below `Description` field to ensure you will be able to clone the repo. (I checked all of them to avoid having to redo this step, but unsure of the security / permission implications).
### Clone the repository:
```bash
# Use your chewy Github account as username, and the PAT from previous step as your password
git clone git@github.com:Chewy-Inc/pair-lab-sim.git
cd pair-lab-sim
```
### Set Environment Variables to Access the Nucleus Server
Generate an API token from the Nucleus server (see [instructions here](https://docs.omniverse.nvidia.com/nucleus/latest/config-and-info/api_tokens.html#token-generation)).
It's recommended to add this to your shell profile (e.g. \~/.bashrc or \~/.zshrc), so you don't need to export the env var each terminal session.
Replace `YOUR_API_TOKEN` with the token you generated.
For ~/.bashrc users
```bash
echo 'export OMNI_USER="\$omni-api-token"' >> ~/.bashrc
echo 'export OMNI_PASS="YOUR_API_TOKEN"' >> ~/.bashrc
source ~/.bashrc
````
For ~/.zshrc users
```bash
echo 'export OMNI_USER="\$omni-api-token"' >> ~/.zshrc
echo 'export OMNI_PASS="YOUR_API_TOKEN"' >> ~/.zshrc
source ~/.zshrc
```
### Install pipx and add it to path
```bash
sudo apt install pipx
pipx ensurepath
```
### Setup pre-commit
[pre-commit](https://pre-commit.com/) runs all of our code checking tooling automatically when you run a `git commit`, helping maintain a clean, consistent codebase.
First install pre-commit:
```bash
pipx install pre-commit
```
In order to activate it for this repo, you need to run (from within this repo's top-level):
```bash
pre-commit install
```
## Docker Setup (recommended)
### Install Docker and Docker compose
Follow [this guide](https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository) to install `docker` and `docker-compose` using apt.
**NOTE** Make sure you add your user to the docker group (instructions to do so are [here](https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user) - you only need to do up until the `Configure Docker to start on boot with systemd` section).
### Install gitman and clone repos
```bash
pipx install gitman
gitman update
```
### Install NVIDIA Container Toolkit
Follow instructions [here](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html#with-apt-ubuntu-debian) to install NVIDIA Container toolkit via `apt`.
Make sure to follow the steps in `Configuring Docker` section [here](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html#configuring-docker) - configuring the runtime and restarting the docker daemon (`sudo systemctl restart docker`). Optionally set up Rootless mode in the next section [here](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html#rootless-mode).
### Start docker container
You now have all the prerequisites needed to start and enter the Docker container.
```bash
./docker/container.py start pair
```
### Enter docker container
```bash
./docker/container.py enter pair
```
Now you're all set up and can start developing. Skip along to first steps section below.
### [Optional] VSCode Support for IsaacLab Python Language Features (outside container):
**NOTE**: This step is only needed if you want the Python language server features (e.g. syntax highlighting, go to definition functionality and other ease-of-use tools found [here](https://code.visualstudio.com/docs/editing/editingevolved)) specifically for Isaac Lab code, *outside* of the docker container. This step happens automatically as part of the docker build process, so these features will work when attaching to the docker container via DevContainers
without any manual user input.
1. Use VSCode or Cursor's `Tasks: Run Tasks` (Ctrl+Shift+P to open command palette) command and select `setup_python_env_with_path`.
2. Use VSCode or Cursor's `Developer: Reload Window`, (Ctrl+Shift+P to open command palette) and you should see that your IDE's Go To Definition feature now works for Isaac Lab imports.
## Manual Setup (not recommended)
**NOTE** The following manual installation is not recommended, as Docker installation above is easier / guaranteed to have all users on the same setup
### [Optional] Create virtual environment
**NOTE** If you already have a venv for setting up Isaac Sim / Lab, source that here and skip ahead to clone section below.
```bash
# Create and activate a virtual environment (recommended)
python -m venv pair_lab_venv
source pair_lab_venv/bin/activate
```
### Setup Isaac Sim and Isaac Lab
Follow the official installation guides, preferring pip-based installation over installing from source:
* **Isaac Sim**: [Installation Documentation](https://docs.omniverse.nvidia.com/isaacsim/latest/installation/install_workstation.html)
* **Isaac Lab**: [Setup Instructions](https://isaac-sim.github.io/IsaacLab/main/source/setup/installation/index.html)
### Clone the SO100 repo to get URDFs and meshes of SO-101
```bash
git clone https://github.com/TheRobotStudio/SO-ARM100
export SO_REPO_PATH="$(realpath SO-ARM100)"
```
It's recommended to add this to your shell profile (e.g. \~/.bashrc or \~/.zshrc), so you don't need to export the env var each terminal session.
For ~/.bashrc users
```bash
echo "export SO_REPO_PATH=\"$(realpath SO-ARM100)\"" >> ~/.bashrc
source ~/.bashrc
````
For ~/.zshrc users
```bash
echo "export SO_REPO_PATH=\"$(realpath SO-ARM100)\"" >> ~/.zshrc
source ~/.zshrc
````
### Install the `pair_lab` python package
From within your virtual env, use pip to install `pair_lab`:
```bash
cd pair_lab/source/pair_lab
pip install -e .
```
To verify installation, `pip list | grep pair_lab` should print `pair_lab` followed by the current version of the package, and its installation directory:
```bash
(env_isaaclab) $ pip list | grep pair_lab
pair_lab 0.1.0 /home/ubuntu/pair/repos/pair-lab-sim/pair_lab/source/pair_lab
```
## Training a Policy
Now that everything is properly setup, we can start training an RL policy!
To run training for the box-push with SO-101, from the top-level directory, from inside the `pair_lab` docker container, run:
```bash
python scripts/rsl_rl/train.py --task Pair-Push-Cube-SO101-v0 --num_envs 4096
```
**NOTE:** I recommend starting with `--num_envs 1` to quickly check that things are running (as increasing `num_envs` increases start-up and iteration time.)
### Training Parameters
* `--task Pair-Push-Cube-SO101-v0`: Specifies the training task/environment
* `--num_envs [NUM_ENVS]`: Number of parallel environments (adjust based on your hardware)
### Additional Options
You can customize training with additional parameters:
* `--headless`: Run training headlessly (no GUI). This is most likely what you want when you run a longer training job, as it reduces the overhead of rendering the GUI, speeding up cycle time.
* `--max_iterations`: Maximum training iterations
* `--checkpoint_interval`: How often to save checkpoints
* `--log_dir`: Directory to save logs and checkpoints
Use `--help` to get info on the other CLI args.
### Monitoring Training
Training metrics are automatically logged via the `--logger` arg:
* **[Weights & Biases (WandB)](https://wandb.ai/)** - `--logger wandb` For experiment tracking and visualization
* **[TensorBoard](https://www.tensorflow.org/tensorboard)** - For real-time monitoring
* \*\*\[Neptune]
## Evaluating a Trained Policy
To run a "play" (inference/demo) session for the box-push with SO-101:
From the top-level directory, run:
```bash
python scripts/rsl_rl/play.py --task Pair-Push-Cube-SO101-v0 --num_envs 1 --checkpoint logs/rsl_rl/so101_push_cube/[DATE_OF_TRAINING_RUN]/[SELECTED_CHECKPOINT]
```
**NOTE:** Fill in `[DATE_OF_TRAINING_RUN]` and `[SELECTED_CHECKPOINT]` as follows:
```bash
python scripts/rsl_rl/play.py --task Pair-Push-Cube-SO101-v0 --num_envs 1 --checkpoint logs/rsl_rl/so101_push_cube/2025-07-16_21-29-32/model_9999.pt
```
In the above example, the 9999th checkpoint is the final one in a 10,000 iteration training run. You can select the checkpoint with the optimal performance via [WandB](https://wandb.ai/), [Tensorboard](https://www.tensorflow.org/tensorboard) or [MLFlow](https://mlflow.org/).
## Listing Available Tasks
To quickly see **all tasks/environments** that have been registered by the **PAIR Lab** extension (those beginning with `Pair-`), run the helper script from the repository **root**:
```bash
python scripts/list_envs.py
```
The script launches Isaac Sim headlessly, queries the Gymnasium registry, and prints a pretty‑table that shows:
| S. No. | Task Name | Entry Point | Config |
| ------ | ----------------------- | ---------------- | ---------------------------- |
| … | Pair‑Push‑Cube‑SO101‑v0 | pair\_lab.tasks… | pair\_lab.tasks…/config.yaml |
This is handy for discovering new tasks or double‑checking the exact string to pass to `--task` in training or evaluation commands.
## Troubleshooting
### Common Issues
- **CUDA out of memory**
Reduce the `--num_envs` parameter.
- **SO_REPO_PATH not found**
Ensure the environment variable is properly set and the SO-ARM100 repository is cloned.
- **Import errors**
Verify that `pair_lab` is properly installed:
```bash
pip list | grep pair_lab
```
- **Isaac Sim crashes**
Check the [Isaac Sim System Requirements](https://docs.omniverse.nvidia.com/isaacsim/latest/installation/requirements.html).
- **Slow training**
Enable `--headless` mode and ensure your GPU is being utilized.
- **NVMLError** or
**Error response from daemon: could not select device driver "nvidia" with capabilities: [[gpu]]**
Ensure Docker's `no-cgroups` setting is set to `false` and make sure you have NVIDIA container toolkit is installed, and you've either rebooted or run `sudo systemctl reload docker` after installation.
[See troubleshooting steps here.](https://forums.developer.nvidia.com/t/nvida-container-toolkit-failed-to-initialize-nvml-unknown-error/286219/3)
### Getting Help
* **Isaac Sim Documentation**: [Official Docs](https://docs.omniverse.nvidia.com/isaacsim/latest/)
* **Isaac Lab Documentation**: [Official Docs](https://isaac-sim.github.io/IsaacLab/)
* **NVIDIA Omniverse Forums**: [Community Support](https://forums.developer.nvidia.com/c/omniverse/)
## Project Structure
```
pair-lab-sim/
├── docker/ # Dockerfiles and container setup script
├── IsaacLab/ # Isaac Lab (cloned by gitman into this directory)
├── pair_lab/ # Main package source
│ └── source/pair_lab/ # Core simulation components
├── scripts/ # Training and evaluation scripts
│ └── rsl_rl/ # RSL-RL specific scripts
├── gitman.yml # Repository and submodule management configuration
└── README.md # This file
```
## Related Projects
* **[Isaac Sim](https://developer.nvidia.com/isaac-sim)** - NVIDIA's robotics simulation platform
* **[Isaac Lab](https://isaac-sim.github.io/IsaacLab/)** - Unified framework for robot learning
* **[RSL-RL](https://github.com/leggedrobotics/rsl_rl)** - Reinforcement learning library
* **[SO-ARM100](https://github.com/TheRobotStudio/SO-ARM100)** - Robot hardware specifications