-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
59 changed files
with
2,905 additions
and
510 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[submodule "ros/newton_ros"] | ||
path = ros/pkgs/newton_ros | ||
url = https://github.com/TheNewtonCapstone/newton-ros | ||
[submodule "ros/newton_sim_ros"] | ||
path = ros/pkgs/newton_sim_ros | ||
url = https://github.com/TheNewtonCapstone/newton-sim-ros |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,52 @@ | ||
# TWIP - Isaac Sim | ||
This repo contains the code and configuration used during our journey of developing TWIP using NVIDIA's Isaac Sim and rl games. | ||
# Newton - Isaac Sim | ||
This repo contains the code and configuration used during our journey of developing Newton using NVIDIA's Isaac Sim. | ||
|
||
## Requirements | ||
- Ubuntu 22.04 LTS (Works with Pop OS as well) | ||
- Nvidia GPU with 510.73.05+ drivers (`nvidia-smi` to make sure these are set up) | ||
- Isaac Sim (tested with version `4.0.0`) | ||
- RL games | ||
- Nvidia GPU (RTX 2070 & above) with 510.73.05+ drivers (execute `nvidia-smi` in your terminal to make sure the drivers are set up) | ||
- Isaac Sim (tested with version `4.2.0`) | ||
- Stable Baselines 3 | ||
- Anaconda | Miniconda | ||
- If using ROS: install Mamba (optional; with `conda install mamba -c conda-forge`) for faster package installation | ||
|
||
## Isaac Sim Setup | ||
- Download Isaac Sim by following the steps found within Nvidia's installation (guide)[https://docs.omniverse.nvidia.com/isaacsim/latest/installation/install_workstation.html]. | ||
- Download Isaac Sim by following the steps found within Nvidia's installation [guide](https://docs.omniverse.nvidia.com/isaacsim/latest/installation/install_workstation.html). | ||
- Run Isaac sim from the Omniverse application to make sure it runs properly | ||
- Clone this repository `git clone https://github.com/TheNewtonCapstone/twip-isaac-sim` | ||
- Remove any folder named `_isaac_sim` | ||
- Run `cd twip-isaac-sim && ln -s home/YOUR_NAME/.local/share/ov/pkg/isaac-sim-4.0.0` | ||
- Create the conda environment `conda env create -f environment.yml` | ||
- Clone this repository `git clone https://github.com/TheNewtonCapstone/newton-isaac-sim` | ||
- Run `cd newton-isaac-sim && ln -s /home/YOUR_USERNAME/.local/share/ov/pkg/isaac-sim-4.2.0 _isaac_sim` | ||
- Create the conda environment `conda env create -f environment.yml` | ||
- If using ROS: `conda env create -f environment_ros.yml` | ||
|
||
## Repo Structure | ||
- `twip.py`: Main script used for training/testing/exporting models | ||
- `export.py`: Script for exporting models as ONNX files | ||
- `cfg/task/`: YAML configs for each task defining environment parameters and domain randomization | ||
- `cfg/train/`: YAML configs for each task defining RL model and hyperparameters | ||
- `tasks/`: Class definitions and assets for each task | ||
- `runs/`: Model checkpoints and summaries will be saved here | ||
|
||
## Usage | ||
- `newton.py`: Main script used for training/testing/exporting models | ||
- `environment(_ros).yml`: Project dependency requirements | ||
- `core/`: Contains all the core functionalities (Simulation, Training, Animation...) | ||
- `assets/`: Contains miscellaneous assets (e.g. animations, USD files) | ||
- `docs/`: Contains general project documentation | ||
- `scripts/`: Contains helper scripts such as the animation keyframe extractor | ||
- `configs/`: Contains the configuration files | ||
- `runs/`: Model checkpoints and summaries will be saved here (by default) | ||
- `apps/`: Contains the Isaac Sim applications configuration files | ||
|
||
### Running Isaac Sim | ||
The entry point of our project is `twip.py`. To run our project you must configure the environment: | ||
The entry point of our project is `newton.py`. **Before running your IDE** (and in any terminal that you wish to run the project in), you must configure the environment: | ||
- `conda activate isaac-sim` | ||
- `source _isaac_sim/setup_conda_env.sh` | ||
- `python twip.py --sim-only --num-envs 4` | ||
- `source setup.sh` | ||
- If using ROS: this script will automatically source the Newton ROS workspace | ||
|
||
Now with your environment configured, within the same terminal, you can open your desired IDE: | ||
- `pycharm` for Pycharm (recommended) | ||
- `code` for VS Code | ||
|
||
We have provided a simple CLI to allow you to start training your very own Newton. All you have to do is run `newton.py`! | ||
Here is how the first option should look like: | ||
|
||
`--sim-only` is used to run the simluation alone without any reinforcement learning. `--num-envs` specifies the number of twip environments within the simulation. To see all the options, run `twip.py --help`. | ||
![docs/assets/mode_select.png](docs/assets/mode_select.png) | ||
|
||
### Training | ||
- `python train.py task={task_name}` to begin training | ||
- execute `python newton.py` and select `training`. | ||
- Models are saved as `runs/{TaskName}/nn/{checkpoint_name}.pth` | ||
|
||
### Exporting ONNX | ||
- `python twip.py --checkpoint="runs/{checkpoint_name}/nn/{task_name}.pth --export-onnx"` to export | ||
- Model is exported to `runs/{checkpoint_name}/nn/{task_name}.pth.onnx` | ||
|
||
### Adding a New Task (?) | ||
Create a new folder called `tasks/{task_name}`. The following files will be needed: | ||
- `tasks/{task_name}/{task_name}.py`: Class defining the task. Rewards, observations, actions are all defined here. | ||
- `tasks/{task_name}/assets/`: URDF and meshes should be placed here. | ||
- `cfg/task/{TaskName}.yaml`: Config file defining environment parameters and domain randomization | ||
- `cfg/train/{TaskName}PPO.yaml`: Config file defining hyperparameters for training | ||
- execute`python newton.py` and select `Exporting`. | ||
- Model is exported to `runs/{checkpoint_name}/nn/{task_name}.pth.onnx` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
enabled: true | ||
namespace: sim | ||
domain_id: 25 | ||
|
||
defaults: | ||
qos: | ||
history: 0 # 0: system default, 1: keep last, 2: keep all, 3: unknown | ||
depth: 5 # number of samples in history | ||
reliability: 0 # 0: system default, 1: reliable, 2: best effort, 3: unknown | ||
durability: 0 # 0: system default, 1: transient_local, 2: volatile, 3: unknown | ||
lifespan: | ||
seconds: 0 | ||
nanoseconds: 0 | ||
deadline: | ||
seconds: 0 | ||
nanoseconds: 0 | ||
liveliness: 0 # 0: system default, 1: automatic, 2: manual_by_topic, 3: unknown | ||
liveliness_lease_duration: | ||
seconds: 0 | ||
nanoseconds: 0 | ||
|
||
nodes: | ||
imu: | ||
name: imu_node | ||
pub_sim_topic: /sim/imu | ||
pub_real_topic: /imu | ||
pub_period: 5 | ||
pub_qos: None | ||
|
||
contact: | ||
name: contact_node | ||
pub_sim_topic: /sim/contact | ||
pub_real_topic: /contact | ||
pub_period: 10 | ||
pub_qos: None | ||
|
||
joints_controller: | ||
name: joints_controller_node | ||
pub_sim_topic: /sim/joints | ||
pub_real_topic: /joints | ||
pub_period: 5 | ||
pub_qos: None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from .base_actuator import BaseActuator | ||
from .dc_actuator import DCActuator |
Oops, something went wrong.