2024-10-10 21:22:58 +08:00
|
|
|
# RL Quadruped Controller
|
2024-10-03 20:51:33 +08:00
|
|
|
|
|
|
|
This repository contains the reinforcement learning based controllers for the quadruped robot.
|
|
|
|
|
2024-11-06 20:07:48 +08:00
|
|
|
[![](http://i0.hdslb.com/bfs/archive/9886e7f9ed06d7f880b5614cb2f4c3ec1d7bf85f.jpg)](https://www.bilibili.com/video/BV1QP1pYBE47/)
|
|
|
|
|
2024-10-03 20:51:33 +08:00
|
|
|
Tested environment:
|
2024-11-06 20:07:48 +08:00
|
|
|
|
2024-10-03 20:51:33 +08:00
|
|
|
* Ubuntu 24.04
|
|
|
|
* ROS2 Jazzy
|
2024-11-06 20:07:48 +08:00
|
|
|
* Ubuntu 22.04
|
|
|
|
* ROS2 Humble
|
2024-10-03 20:51:33 +08:00
|
|
|
|
|
|
|
## 2. Build
|
2024-11-06 20:07:48 +08:00
|
|
|
|
2024-10-03 20:51:33 +08:00
|
|
|
### 2.1 Installing libtorch
|
2024-11-06 20:07:48 +08:00
|
|
|
|
2024-10-03 20:51:33 +08:00
|
|
|
```bash
|
|
|
|
cd ~/CLionProjects/
|
2024-10-24 21:02:55 +08:00
|
|
|
wget https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-2.5.0%2Bcpu.zip
|
|
|
|
unzip unzip libtorch-cxx11-abi-shared-with-deps-2.5.0+cpu.zip
|
2024-10-07 11:57:32 +08:00
|
|
|
```
|
2024-11-06 20:07:48 +08:00
|
|
|
|
2024-10-07 11:57:32 +08:00
|
|
|
```bash
|
|
|
|
cd ~/CLionProjects/
|
2024-10-24 21:02:55 +08:00
|
|
|
rm -rf libtorch-cxx11-abi-shared-with-deps-2.5.0+cpu.zip
|
2024-10-03 20:51:33 +08:00
|
|
|
echo 'export Torch_DIR=~/CLionProjects/libtorch' >> ~/.bashrc
|
2024-10-24 21:02:55 +08:00
|
|
|
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/CLionProjects/libtorch/lib' >> ~/.bashrc
|
2024-10-03 20:51:33 +08:00
|
|
|
```
|
|
|
|
|
2024-10-10 21:22:58 +08:00
|
|
|
### 2.2 Build Controller
|
2024-11-06 20:07:48 +08:00
|
|
|
|
2024-10-03 20:51:33 +08:00
|
|
|
```bash
|
|
|
|
cd ~/ros2_ws
|
2024-10-10 21:22:58 +08:00
|
|
|
colcon build --packages-up-to rl_quadruped_controller
|
2024-10-03 20:51:33 +08:00
|
|
|
```
|
2024-10-04 20:14:34 +08:00
|
|
|
|
|
|
|
## 3. Launch
|
2024-10-24 21:02:55 +08:00
|
|
|
|
|
|
|
### 3.1 Mujoco Simulation
|
2024-11-06 20:07:48 +08:00
|
|
|
> **Warm Reminder**: You need to launch [Unitree Mujoco C++ Simulation](https://github.com/legubiao/unitree_mujoco) before launch the controller.
|
2024-10-24 21:02:55 +08:00
|
|
|
```bash
|
|
|
|
source ~/ros2_ws/install/setup.bash
|
|
|
|
ros2 launch rl_quadruped_controller mujoco.launch.py pkg_description:=go2_description
|
|
|
|
```
|
|
|
|
|
2024-10-25 12:47:03 +08:00
|
|
|
### 3.2 Gazebo Classic 11 (ROS2 Humble)
|
2024-11-06 20:07:48 +08:00
|
|
|
|
2024-10-25 12:47:03 +08:00
|
|
|
```bash
|
|
|
|
source ~/ros2_ws/install/setup.bash
|
|
|
|
ros2 launch rl_quadruped_controller gazebo_classic.launch.py pkg_description:=a1_description
|
|
|
|
```
|
|
|
|
|
2024-10-24 21:02:55 +08:00
|
|
|
### 3.3 Gazebo Harmonic (ROS2 Jazzy)
|
2024-11-06 20:07:48 +08:00
|
|
|
|
2024-10-24 21:02:55 +08:00
|
|
|
```bash
|
|
|
|
source ~/ros2_ws/install/setup.bash
|
|
|
|
ros2 launch rl_quadruped_controller gazebo.launch.py pkg_description:=go2_description
|
|
|
|
```
|