Skip to content

Commit

Permalink
Merge pull request #32 from abizovnuralem/fix_speed
Browse files Browse the repository at this point in the history
fix speed
  • Loading branch information
abizovnuralem authored Sep 2, 2024
2 parents 01d07f0 + 2dd1119 commit 040b833
Show file tree
Hide file tree
Showing 26 changed files with 99 additions and 2,278 deletions.
97 changes: 0 additions & 97 deletions Isaac_sim/extension.toml

This file was deleted.

45 changes: 30 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@

# Welcome to the Unitree Go2/G1 Digital Twins Project!

[![IsaacSim](https://img.shields.io/badge/IsaacSim-4.0-silver.svg)](https://docs.omniverse.nvidia.com/isaacsim/latest/overview.html)
[![IsaacSim](https://img.shields.io/badge/IsaacSim-orbit-gold.svg)](https://docs.omniverse.nvidia.com/isaacsim/latest/overview.html)
[![Python](https://img.shields.io/badge/python-3.10-blue.svg)](https://docs.python.org/3/whatsnew/3.10.html)
[![Linux platform](https://img.shields.io/badge/platform-linux--64-orange.svg)](https://releases.ubuntu.com/22.04/)
[![License](https://img.shields.io/badge/license-BSD--2-yellow.svg)](https://opensource.org/licenses/BSD-2-Clause)

We are thrilled to announce that the Unitree Go2/G1 robot has now been integrated with the Nvidia Isaac Sim 4.0 (Isaac Lab), marking a major step forward in robotics research and development. The combination of these two cutting-edge technologies opens up a world of possibilities for creating and testing algorithms in a variety of simulated environments.
We are thrilled to announce that the Unitree Go2/G1 robot has now been integrated with the Nvidia Isaac Sim (Orbit), marking a major step forward in robotics research and development. The combination of these two cutting-edge technologies opens up a world of possibilities for creating and testing algorithms in a variety of simulated environments.

Get ready to take your research to the next level with this powerful new resource at your fingertips!

Expand Down Expand Up @@ -101,22 +101,35 @@ Together, let's push the boundaries of what's possible with the Unitree Go2/G1 a
## System requirements
You need to install:
1. Ubuntu 22.04
2. Nvidia Isaac Sim 4.0
3. Nvidia Isaac Lab
2. Nvidia Isaac Sim 2023.1.1
3. Nvidia Orbit 0.3.0
4. Ros2 Humble


Full instruction:
```
https://isaac-sim.github.io/IsaacLab/source/setup/installation/binaries_installation.html
1. Use this specific IsaacLab repo version: https://github.com/isaac-sim/IsaacLab/releases/tag/v0.3.1
2. execute in ubuntu terminal:
export ISAACSIM_PATH="${HOME}/.local/share/ov/pkg/isaac-sim-2023.1.1"
export ISAACSIM_PYTHON_EXE="${ISAACSIM_PATH}/python.sh"
and also put it inside .bashrc file
3. Inside the root folder of Orbit repo (https://github.com/isaac-sim/IsaacLab/releases/tag/v0.3.1) execute ln -s ${ISAACSIM_PATH} _isaac_sim
4. ./orbit.sh --conda
5. conda activate orbit
6. sudo apt install cmake build-essential
7. ./orbit.sh --install
8. ./orbit.sh --extra rsl_rl
9. verify the installation using "python source/standalone/tutorials/00_sim/create_empty.py" You should be inside conda env.
10. You need to check that you have "Isaac Sim Python 2023.1.1 - New Stage*" on the top of the window.
11. go to the current repo project (this repo)
12. execute ./run_sim.sh
```

Some suggestions:
1. You need to check nvidia-smi, it should work, before installing Isaac Sim 4.0
1. You need to check nvidia-smi, it should work, before installing Isaac Sim (Orbit)
2. You need to install Miniconda and execute: conda config --set auto_activate_base false
3. Install Omniverse launcher and then install Isaac Sim 4.0.
4. Create conda env then activate it, also execute ./isaaclab.sh --install
Also, you need to install ROS2 on your system and configure it:
3. Install Omniverse launcher and then install Isaac Sim (Orbit).
4. You need to install ROS2 on your system and configure it:

```
https://docs.omniverse.nvidia.com/isaacsim/latest/installation/install_ros.html#isaac-sim-app-install-ros
Expand All @@ -136,13 +149,11 @@ git clone https://github.com/abizovnuralem/go2_omniverse/ --recurse-submodules -
First, you need to copy files from Isaac Sim folder to your local Isaac Sim installation in order to use Unitree L1 lidar inside Orbit.

```
1. You need to replace original file that located in ~/.local/share/ov/pkg/isaac-sim-4.0.0/exts/omni.isaac.sensor/config/extrensiom.toml
with Isaac_sim/extension.toml in this repo.
2. You need to add Unitree_L1.json to IsaacLab repo folder, where IsaacLab/source/exts/omni.isaac.sensor/data/lidar_configs/Unitree/Unitree_L1.json will be the final path (If it doesnt exists, create it)
1. You need to add Unitree_L1.json to IsaacLab (Orbit) repo folder, where IsaacLab-0.3.1/source/data/sensors/lidar/Unitree/Unitree_L1.json will be the final path (If it doesnt exists, create it)
```

## Usage
The current project was tested on Ubuntu 22.04, IsaacSim 4.0 with Isaac Lab and Nvidia Driver Version: 545.
The current project was tested on Ubuntu 22.04, IsaacSim 2023.1.1 with Orbit 0.3.0 and Nvidia Driver Version: 545.
To start the project with Unitree GO2, execute:

```
Expand All @@ -165,7 +176,7 @@ You can use https://github.com/abizovnuralem/go2_ros2_sdk as a basement for your
## Select custom env

To use predifined custom envs, you need to download files from https://drive.google.com/drive/folders/1vVGuO1KIX1K6mD6mBHDZGm9nk2vaRyj3?usp=sharing and place them to /envs folder.
Then you can execute it via python main.py --custom_env=office or python main.py --custom_env=warehouse commands (The whole cmd you can read from run_sim script). If you are doing it first time, it will take 2-3 minutes to configure the env. Please, wait.
Then you can execute it modifying run_sim.sh script with --custom_env=office and --terrain flat commands. If you are doing it first time, it will take 2-3 minutes to configure the env. Please, wait.


## Development
Expand All @@ -183,8 +194,12 @@ I have tested it on:
5. Execute IsaacSim, Go to Window -> Extensions, find STEAMVR INPUT/OUTPUT then enable it and enable AutoLoad. Reopen IsaacSim. Use OpenXR mode.
6. Enjoy Omniverse in VR mode!


## Thanks
Special thanks to Leul Tesfaye for his expertise in Orbit lidars and Tamas @tfoldi for contributing to this project.
Special thanks to
1. Leul Tesfaye for his expertise in Orbit lidars;
2. Tamas @tfoldi for contributing to this project;
3. @ShaoshuSu for his hardwork in investigating the speed issues with new version of Orbit (IsaacLab 4.0 and 4.1);


## License
Expand Down
4 changes: 2 additions & 2 deletions cli_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from omni.isaac.lab_tasks.utils.wrappers.rsl_rl import RslRlOnPolicyRunnerCfg
from omni.isaac.orbit_tasks.utils.wrappers.rsl_rl import RslRlOnPolicyRunnerCfg


def add_rsl_rl_args(parser: argparse.ArgumentParser):
Expand Down Expand Up @@ -48,7 +48,7 @@ def parse_rsl_rl_cfg(task_name: str, args_cli: argparse.Namespace) -> RslRlOnPol
Returns:
The parsed configuration for RSL-RL agent based on inputs.
"""
from omni.isaac.lab_tasks.utils.parse_cfg import load_cfg_from_registry
from omni.isaac.orbit_tasks.utils.parse_cfg import load_cfg_from_registry

# load the default configuration
rslrl_cfg: RslRlOnPolicyRunnerCfg = load_cfg_from_registry(task_name, "rsl_rl_cfg_entry_point")
Expand Down
76 changes: 47 additions & 29 deletions custom_rl_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,36 +26,39 @@
import torch
from dataclasses import MISSING
from typing import Literal


from omni.isaac.lab.envs import ManagerBasedRLEnvCfg
from omni.isaac.lab.utils import configclass

import omni.isaac.lab.sim as sim_utils
from omni.isaac.lab.assets import ArticulationCfg, AssetBaseCfg
from omni.isaac.lab.scene import InteractiveSceneCfg
from omni.isaac.lab.sensors import ContactSensorCfg, RayCasterCfg, patterns
from omni.isaac.lab.terrains import TerrainImporterCfg
from omni.isaac.lab.utils import configclass
from omni.isaac.lab_assets.unitree import UNITREE_GO2_CFG
from omni.isaac.lab.managers import EventTermCfg as EventTerm
from omni.isaac.lab.managers import ObservationGroupCfg as ObsGroup
from omni.isaac.lab.managers import ObservationTermCfg as ObsTerm
from omni.isaac.lab.managers import RewardTermCfg as RewTerm
from omni.isaac.lab.managers import SceneEntityCfg
from omni.isaac.lab.managers import TerminationTermCfg as DoneTerm
from omni.isaac.lab.utils import configclass
from omni.isaac.lab.utils.noise import AdditiveUniformNoiseCfg as Unoise
import omni.isaac.lab_tasks.manager_based.locomotion.velocity.mdp as mdp


import argparse


from omni.isaac.orbit.envs import RLTaskEnvCfg
from omni.isaac.orbit.utils import configclass

import omni.isaac.orbit.sim as sim_utils
from omni.isaac.orbit.assets import ArticulationCfg, AssetBaseCfg
from omni.isaac.orbit.scene import InteractiveSceneCfg
from omni.isaac.orbit.sensors import ContactSensorCfg, RayCasterCfg, patterns
from omni.isaac.orbit.terrains import TerrainImporterCfg
from omni.isaac.orbit.utils import configclass
from omni.isaac.orbit_assets.unitree import UNITREE_GO2_CFG
from omni.isaac.orbit.managers import EventTermCfg as EventTerm
from omni.isaac.orbit.managers import ObservationGroupCfg as ObsGroup
from omni.isaac.orbit.managers import ObservationTermCfg as ObsTerm
from omni.isaac.orbit.managers import RewardTermCfg as RewTerm
from omni.isaac.orbit.managers import SceneEntityCfg
from omni.isaac.orbit.managers import TerminationTermCfg as DoneTerm
from omni.isaac.orbit.utils import configclass
from omni.isaac.orbit.utils.noise import AdditiveUniformNoiseCfg as Unoise
import omni.isaac.orbit_tasks.locomotion.velocity.mdp as mdp

from terrain_cfg import ROUGH_TERRAINS_CFG
from robots.g1.config import G1_CFG

from omniverse_sim import args_cli


base_command = {}


def constant_commands(env: ManagerBasedRLEnvCfg) -> torch.Tensor:
def constant_commands(env: RLTaskEnvCfg) -> torch.Tensor:
global base_command
"""The generated command from the command generator."""
tensor_lst = torch.tensor([0, 0, 0], device=env.device).repeat(env.num_envs, 1)
Expand All @@ -68,12 +71,27 @@ def constant_commands(env: ManagerBasedRLEnvCfg) -> torch.Tensor:
class MySceneCfg(InteractiveSceneCfg):
"""Configuration for the terrain scene with a legged robot."""

# ground terrain
terrain = TerrainImporterCfg(
if args_cli.terrain == "flat":

# flat terrain
terrain = TerrainImporterCfg(
prim_path="/World/ground",
terrain_type="plane",
debug_vis=False,
)
else:
terrain = TerrainImporterCfg(
prim_path="/World/ground",
terrain_type="plane",
terrain_type="generator",
terrain_generator=ROUGH_TERRAINS_CFG,
physics_material=sim_utils.RigidBodyMaterialCfg(
friction_combine_mode="multiply",
restitution_combine_mode="multiply",
static_friction=1.0,
dynamic_friction=1.0,
),
debug_vis=False,
)
)

# robots
robot: ArticulationCfg = MISSING
Expand Down Expand Up @@ -238,7 +256,7 @@ class EventCfg:


@configclass
class LocomotionVelocityRoughEnvCfg(ManagerBasedRLEnvCfg):
class LocomotionVelocityRoughEnvCfg(RLTaskEnvCfg):
"""Configuration for the locomotion velocity-tracking environment."""
# Scene settings
scene: MySceneCfg = MySceneCfg(num_envs=4096, env_spacing=2.5)
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 040b833

Please sign in to comment.