Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doc/docker readme #56

Merged
merged 2 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Asset/docker_install/image-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions Asset/docker_install/image-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions Asset/docker_install/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
141 changes: 141 additions & 0 deletions DOCKER_INSTALL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
# StrideSim Docker Installation Guide

## Graphic Driver Installation

To install the NVIDIA graphic driver, execute the following commands:

```bash
sudo apt-get update
sudo apt install build-essential -y
wget https://us.download.nvidia.com/XFree86/Linux-x86_64/535.129.03/NVIDIA-Linux-x86_64-535.129.03.run
chmod +x NVIDIA-Linux-x86_64-535.129.03.run
sudo ./NVIDIA-Linux-x86_64-535.129.03.run
```

![alt text](Asset/docker_install/image-2.png)
> I tried to install *nvidia driver-550*, and it also works.

## Docker Installation

To install Docker, execute the following commands:

```bash
# Docker installation using the convenience script
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh

# Post-install steps for Docker
sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker

# Verify Docker
docker run hello-world
```

## Nvidia Container Toolkit Installation

```bash
#Configure the repository
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
&& curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list \
&& \
sudo apt-get update

#Install the NVIDIA Container Toolkit packages
sudo apt-get install -y nvidia-container-toolkit
sudo systemctl restart docker

#Configure the container runtime
sudo nvidia-ctk runtime configure --runtime=docker
sudo systemctl restart docker

#Verify NVIDIA Container Toolkit
docker run --rm --runtime=nvidia --gpus all ubuntu nvidia-smi
```

## Get NGC Key
You can follow this [official documentation](https://docs.nvidia.com/ngc/gpu-cloud/ngc-user-guide/index.html#generating-api-key) to get the NGC key.

1. Go to [NGC](https://ngc.nvidia.com/signin)

2. Click on the **Setup** button on the top right.

![alt text](Asset/docker_install/image.png)

3. Click on the **Generate API Key** button.

![alt text](Asset/docker_install/image-1.png)

4. Copy the API Key.

```bash
docker login nvcr.io
```

```bash
Username: $oauthtoken
Password: API키
```

## Get Isaac Sim Docker Image

```bash
docker pull nvcr.io/nvidia/isaac-sim:4.0.0
```

## Run StrideSim Docker Container

1. Build Docker Image

```bash
docker build -t stride-sim:v0.0.1 docker
```

2. Run Docker Container

```bash
docker run --name stride-sim-0.0.1 --entrypoint bash -it --runtime=nvidia --gpus all -e "ACCEPT_EULA=Y" --network=host --privileged \
-e "PRIVACY_CONSENT=Y" \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v ~/docker/isaac-sim/cache/kit:/isaac-sim/kit/cache:rw \
-v ~/docker/isaac-sim/cache/ov:/root/.cache/ov:rw \
-v ~/docker/isaac-sim/cache/pip:/root/.cache/pip:rw \
-v ~/docker/isaac-sim/cache/glcache:/root/.cache/nvidia/GLCache:rw \
-v ~/docker/isaac-sim/cache/computecache:/root/.nv/ComputeCache:rw \
-v ~/docker/isaac-sim/logs:/root/.nvidia-omniverse/logs:rw \
-v ~/docker/isaac-sim/data:/root/.local/share/ov/data:rw \
-v ~/docker/isaac-sim/documents:/root/Documents:rw \
-v /dev/shm:/dev/shm \
stride-sim:v0.0.1
```

Now you can run StrideSim Docker Container.

It contains the Isaac Sim, StrideSim, IsaacLab and ROS2 Humble!!

You can run the following command to run isaac-sim.

```bash
cd /isaac-sim
./isaac-sim.sh --allow-root
```

ENJOY!

## File Structure

- /isaac-sim
- /StrideSim
- /IsaacLab
- /opt/ros/humble

## Reference

- [Container Installation](https://docs.omniverse.nvidia.com/isaacsim/latest/installation/install_container.html)
- [NGC Key](https://docs.nvidia.com/ngc/gpu-cloud/ngc-user-guide/index.html#generating-api-key)

*Back to [README](README.md)*
147 changes: 69 additions & 78 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,125 +1,116 @@
# StrideSim

## Table of Contents

- [Overview](#overview)
- [Installation](#installation)
- [Docker Installation (Recommended)](#docker-installation-recommended)
- [Local Installation](#local-installation)
- [Tips](#tips)
- [Usage](#usage)


[![IsaacSim](https://img.shields.io/badge/IsaacSim-4.0.0-silver.svg)](https://docs.omniverse.nvidia.com/isaacsim/latest/overview.html)
[![Isaac Lab](https://img.shields.io/badge/IsaacLab-1.0.0-silver)](https://isaac-sim.github.io/IsaacLab)
[![Python](https://img.shields.io/badge/python-3.10-blue.svg)](https://docs.python.org/3/whatsnew/3.10.html)
[![License](https://img.shields.io/badge/license-MIT-yellow.svg)](https://opensource.org/license/mit)

## 개요
## Overview

StrideSim은 Isaac Lab을 기반으로 한 프로젝트입니다. 이 저장소는 Isaac Lab의 핵심 저장소 외부에서 독립적인 환경에서 개발할 수 있도록 설계되었습니다.
StrideSim is a project based on Isaac Lab. This repository is designed to allow development in an independent environment outside the core repository of Isaac Lab.

## 설치
## Docker Installation (Recommended)

1. Isaac Sim 4.0.0 설치: [설치 가이드](https://docs.omniverse.nvidia.com/isaacsim/latest/overview.html) 참조
You can build and run the container using the Dockerfile.

2. [Isaac Lab v1.0.0](https://github.com/isaac-sim/IsaacLab/tree/v1.0.0) 설치: [설치 가이드](https://isaac-sim.github.io/IsaacLab/source/setup/installation/index.html) 참조
[Docker Installation Guide](DOCKER_INSTALL.md)

3. StrideSim 설치
## Local Installation

```bash
git clone https://github.com/AuTURBO/StrideSim.git
```
1. Install Isaac Sim 4.0.0: Refer to the [Installation Guide](https://docs.omniverse.nvidia.com/isaacsim/latest/overview.html).

```bash
sudo apt-get install -y git-lfs
git lfs install
2. Install [Isaac Lab v1.0.0](https://github.com/isaac-sim/IsaacLab/tree/v1.0.0): Refer to the [Installation Guide](https://isaac-sim.github.io/IsaacLab/source/setup/installation/index.html).

cd StrideSim
git lfs pull
```
3. Install StrideSim:

## 꿀팁
```bash
git clone https://github.com/AuTURBO/StrideSim.git
```

1. 환경변수 설정
```bash
sudo apt-get install -y git-lfs
git lfs install

```bash
# Isaac Sim root directory
export ISAACSIM_PATH="${HOME}/.local/share/ov/pkg/isaac-sim-4.0.0"
# Isaac Sim python executable
alias ISAACSIM_PYTHON="${ISAACSIM_PATH}/python.sh"
# Isaac Sim app
alias ISAACSIM="${ISAACSIM_PATH}/isaac-sim.sh"
```
cd StrideSim
git lfs pull
```

## 사용법
## Tips

1. 강화학습 라이브러리 설치
1. Set environment variables:

```bash
cd rl
python -m pip install -e .
```
```bash
# Isaac Sim root directory
export ISAACSIM_PATH="${HOME}/.local/share/ov/pkg/isaac-sim-4.0.0"
# Isaac Sim python executable
alias ISAACSIM_PYTHON="${ISAACSIM_PATH}/python.sh"
# Isaac Sim app
alias ISAACSIM="${ISAACSIM_PATH}/isaac-sim.sh"
```

2. 강화학습 단독 실행
## Usage

```bash
python rl/train.py --task Template-Isaac-Velocity-Rough-Anymal-D-v0
```
1. Install the reinforcement learning library:

3. StrideSim 실행
```bash
cd rl
python -m pip install -e .
```

3-1. 프로그램 실행
2. Run reinforcement learning independently:

```bash
# 환경변수 설정 후
ISAACSIM
python rl/train.py --task Template-Isaac-Velocity-Rough-Anymal-D-v0
```

3-2. 확장 프로그램 설정
3. Run StrideSim:

3-1. Execute the program:

```bash
# After setting environment variables
ISAACSIM
```

3-2-1. window -> extension 창으로 이동
3-2-2. 삼지창 버튼을 눌러 확장 프로그램 경로 삽입 (본 프로젝트의 exts까지 넣으면 된다.)
![alt text](Asset/image.png)
3-2. Configure the extension program:

3-2-3. 좌측에 시뮬레이션 버튼을 클릭 (이때, AUTOLOAD를 활성화하면 편하다.)
- Navigate to window -> extension.
- Click the trident button to insert the extension program path (include up to the exts of this project).
- Click the simulation button on the left (enabling AUTOLOAD is convenient).

3-3. 확장 프로그램 실행
![alt text](Asset/image-1.png)
이제 Isaac Examples 탭에 StrideSim_AnymalD 탭이 나오는 것을 확인할 수 있다.
3-3. Run the extension program:
![Description of image](Asset/readme/image-1.png)
You can now see the StrideSim_AnymalD tab in the Isaac Examples tab.

![alt text](Asset/image-2.png)
버튼을 누르면 위와 같은 장면을 볼수 있고, anymalD를 부르는 것부터해서 학습 및 병렬 실행도 가능하다.
![Description of image](Asset/readme/image-2.png)
By clicking the button, you can view scenes like the one above, and perform tasks such as calling anymalD, training, and parallel execution.

## 코드 포맷팅
## Code Formatting

pre-commit 훅을 사용하여 코드 포맷팅을 자동화합니다.
pre-commit hook is used to automate code formatting.

pre-commit 설치:
Install pre-commit:

```bash
pip install pre-commit
```

pre-commit 실행:
Run pre-commit:

```bash
pre-commit run --all-files
```

## Docker

Dockerfile을 통해 컨테이너를 빌드하고 실행할 수 있습니다.

```bash
docker build -t stride-sim:v0.0.1 docker

docker run --name stride-sim-0.0.1 --entrypoint bash -it --runtime=nvidia --gpus all -e "ACCEPT_EULA=Y" --network=host --privileged \
-e "PRIVACY_CONSENT=Y" \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v ~/docker/isaac-sim/cache/kit:/isaac-sim/kit/cache:rw \
-v ~/docker/isaac-sim/cache/ov:/root/.cache/ov:rw \
-v ~/docker/isaac-sim/cache/pip:/root/.cache/pip:rw \
-v ~/docker/isaac-sim/cache/glcache:/root/.cache/nvidia/GLCache:rw \
-v ~/docker/isaac-sim/cache/computecache:/root/.nv/ComputeCache:rw \
-v ~/docker/isaac-sim/logs:/root/.nvidia-omniverse/logs:rw \
-v ~/docker/isaac-sim/data:/root/.local/share/ov/data:rw \
-v ~/docker/isaac-sim/documents:/root/Documents:rw \
-v /dev/shm:/dev/shm \
stride-sim:v0.0.1
```

## 라이선스
## License

이 프로젝트는 MIT 라이선스 하에 배포됩니다.
This project is distributed under the MIT license.
Loading
Loading