2024-09-20 15:29:44 +08:00
|
|
|
# Quadruped ROS2 Control
|
2024-09-11 20:41:12 +08:00
|
|
|
|
2024-10-28 10:26:18 +08:00
|
|
|
This repository contains the ros2-control based controllers for the quadruped robot.
|
|
|
|
|
|
|
|
* [Controllers](controllers): contains the ros2-control controllers
|
2024-09-20 15:29:44 +08:00
|
|
|
* [Commands](commands): contains command node used to send command to the controller
|
|
|
|
* [Descriptions](descriptions): contains the urdf model of the robot
|
|
|
|
* [Hardwares](hardwares): contains the ros2-control hardware interface for the robot
|
|
|
|
|
2024-09-20 17:56:00 +08:00
|
|
|
Todo List:
|
2024-10-28 10:26:18 +08:00
|
|
|
|
2024-09-30 20:02:56 +08:00
|
|
|
- [x] [Mujoco Simulation](hardwares/hardware_unitree_mujoco)
|
|
|
|
- [x] [Unitree Guide Controller](controllers/unitree_guide_controller)
|
|
|
|
- [x] [Gazebo Simulation](descriptions/quadruped_gazebo)
|
|
|
|
- [x] [Leg PD Controller](controllers/leg_pd_controller)
|
|
|
|
- [x] [Contact Sensor Simulation](https://github.com/legubiao/unitree_mujoco)
|
|
|
|
- [x] [OCS2 Quadruped Control](controllers/ocs2_quadruped_controller)
|
2024-10-10 21:22:58 +08:00
|
|
|
- [x] [Learning-based Controller](controllers/rl_quadruped_controller/)
|
|
|
|
- [ ] Fully understand the RL Workflow
|
2024-10-24 21:02:55 +08:00
|
|
|
- [x] ROS2 Humble Gazebo Classic Support
|
2024-09-20 17:56:00 +08:00
|
|
|
|
2024-09-30 17:48:59 +08:00
|
|
|
Video for Unitree Guide Controller:
|
2024-09-29 17:09:06 +08:00
|
|
|
[![](http://i1.hdslb.com/bfs/archive/310e6208920985ac43015b2da31c01ec15e2c5f9.jpg)](https://www.bilibili.com/video/BV1aJbAeZEuo/)
|
2024-09-20 15:29:44 +08:00
|
|
|
|
2024-10-01 19:10:23 +08:00
|
|
|
Video for OCS2 Quadruped Controller:
|
|
|
|
[![](http://i0.hdslb.com/bfs/archive/e758ce019587032449a153cf897a543443b64bba.jpg)](https://www.bilibili.com/video/BV1UcxieuEmH/)
|
2024-09-30 17:48:59 +08:00
|
|
|
|
2024-11-06 20:07:48 +08:00
|
|
|
Video for RL Quadruped Controller:
|
|
|
|
[![](http://i0.hdslb.com/bfs/archive/9886e7f9ed06d7f880b5614cb2f4c3ec1d7bf85f.jpg)](https://www.bilibili.com/video/BV1QP1pYBE47/)
|
|
|
|
|
2024-10-17 21:45:48 +08:00
|
|
|
## 1. Quick Start
|
2024-10-28 10:26:18 +08:00
|
|
|
|
2024-09-11 20:41:12 +08:00
|
|
|
* rosdep
|
2024-10-17 21:45:48 +08:00
|
|
|
```bash
|
|
|
|
cd ~/ros2_ws
|
|
|
|
rosdep install --from-paths src --ignore-src -r -y
|
|
|
|
```
|
2024-09-30 20:02:56 +08:00
|
|
|
* Compile the package
|
2024-10-17 21:45:48 +08:00
|
|
|
```bash
|
2024-10-28 10:55:35 +08:00
|
|
|
colcon build --packages-up-to unitree_guide_controller go2_description keyboard_input
|
2024-10-17 21:45:48 +08:00
|
|
|
```
|
|
|
|
|
|
|
|
### 1.1 Mujoco Simulator
|
2024-10-18 22:37:36 +08:00
|
|
|
|
2024-10-28 10:55:35 +08:00
|
|
|
Please use **C++ Simulation** in this [Mujoco Simulation](https://github.com/legubiao/unitree_mujoco) for more robot models and contact
|
2024-10-28 10:26:18 +08:00
|
|
|
sensor.
|
|
|
|
|
|
|
|
> **Warning:** CycloneDDS ROS2 RMW may conflict with unitree_sdk2. If you cannot launch unitree mujoco simulation
|
2024-11-06 20:07:48 +08:00
|
|
|
> without `sudo`, then you cannot used `unitree_mujoco_hardware`. This conflict could be solved by one of below two methods:
|
|
|
|
> 1. Uninstall CycloneDDS ROS2 RMW, or
|
|
|
|
> 2. Follow the guide in [unitree_ros2](https://github.com/unitreerobotics/unitree_ros2) to configure the ROS2 RMW by compiling cyclone dds.
|
2024-10-18 22:37:36 +08:00
|
|
|
|
2024-10-28 10:55:35 +08:00
|
|
|
* Compile Unitree Hardware Interfaces
|
|
|
|
```bash
|
|
|
|
cd ~/ros2_ws
|
|
|
|
colcon build --packages-up-to hardware_unitree_mujoco
|
|
|
|
```
|
2024-09-30 20:02:56 +08:00
|
|
|
* Launch the unitree mujoco go2 simulation
|
|
|
|
* Launch the ros2-control
|
2024-10-17 21:45:48 +08:00
|
|
|
```bash
|
|
|
|
source ~/ros2_ws/install/setup.bash
|
|
|
|
ros2 launch unitree_guide_controller mujoco.launch.py
|
|
|
|
```
|
|
|
|
* Run the keyboard control node
|
|
|
|
```bash
|
|
|
|
source ~/ros2_ws/install/setup.bash
|
|
|
|
ros2 run keyboard_input keyboard_input
|
|
|
|
```
|
|
|
|
|
2024-10-28 10:55:35 +08:00
|
|
|
![mujoco](.images/mujoco.png)
|
|
|
|
|
2024-10-17 21:45:48 +08:00
|
|
|
### 1.2 Gazebo Classic Simulator (ROS2 Humble)
|
2024-10-28 10:26:18 +08:00
|
|
|
* Install Gazebo Classic
|
|
|
|
```bash
|
|
|
|
sudo apt-get install ros-humble-gazebo-ros ros-humble-gazebo-ros2-control
|
|
|
|
```
|
2024-10-17 21:45:48 +08:00
|
|
|
* Compile Leg PD Controller
|
|
|
|
```bash
|
|
|
|
colcon build --packages-up-to leg_pd_controller
|
|
|
|
```
|
|
|
|
* Launch the ros2-control
|
|
|
|
```bash
|
|
|
|
source ~/ros2_ws/install/setup.bash
|
2024-10-28 10:26:18 +08:00
|
|
|
ros2 launch unitree_guide_controller gazebo_classic.launch.py
|
2024-10-17 21:45:48 +08:00
|
|
|
```
|
2024-09-30 20:02:56 +08:00
|
|
|
* Run the keyboard control node
|
2024-10-17 21:45:48 +08:00
|
|
|
```bash
|
|
|
|
source ~/ros2_ws/install/setup.bash
|
|
|
|
ros2 run keyboard_input keyboard_input
|
|
|
|
```
|
|
|
|
|
2024-10-28 10:26:18 +08:00
|
|
|
![gazebo classic](.images/gazebo_classic.png)
|
|
|
|
|
|
|
|
|
2024-10-17 21:45:48 +08:00
|
|
|
### 1.3 Gazebo Harmonic Simulator (ROS2 Jazzy)
|
2024-10-28 10:26:18 +08:00
|
|
|
|
|
|
|
* Install Gazebo
|
|
|
|
```bash
|
|
|
|
sudo apt-get install ros-jazzy-ros-gz ros-jazzy-gz-ros2-control
|
|
|
|
```
|
|
|
|
|
2024-10-17 21:45:48 +08:00
|
|
|
* Compile Leg PD Controller
|
|
|
|
```bash
|
|
|
|
colcon build --packages-up-to leg_pd_controller
|
|
|
|
```
|
|
|
|
* Launch the ros2-control
|
|
|
|
```bash
|
|
|
|
source ~/ros2_ws/install/setup.bash
|
2024-10-28 10:26:18 +08:00
|
|
|
ros2 launch unitree_guide_controller gazebo.launch.py
|
2024-10-17 21:45:48 +08:00
|
|
|
```
|
|
|
|
* Run the keyboard control node
|
|
|
|
```bash
|
|
|
|
source ~/ros2_ws/install/setup.bash
|
|
|
|
ros2 run keyboard_input keyboard_input
|
|
|
|
```
|
2024-10-28 10:55:35 +08:00
|
|
|
![gazebo](.images/gazebo.png)
|
2024-10-17 21:45:48 +08:00
|
|
|
|
2024-10-28 10:26:18 +08:00
|
|
|
For more details, please refer to the [unitree guide controller](controllers/unitree_guide_controller/)
|
|
|
|
and [go2 description](descriptions/unitree/go2_description/).
|
2024-10-03 19:26:54 +08:00
|
|
|
|
|
|
|
## Reference
|
|
|
|
|
|
|
|
### Conference Paper
|
2024-10-28 10:26:18 +08:00
|
|
|
|
|
|
|
[1] Liao, Qiayuan, et al. "Walking in narrow spaces: Safety-critical locomotion control for quadrupedal robots with
|
|
|
|
duality-based optimization." In *2023 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS)*, pp.
|
|
|
|
2723-2730. IEEE, 2023.
|
2024-10-03 19:26:54 +08:00
|
|
|
|
|
|
|
### Miscellaneous
|
|
|
|
|
2024-10-28 10:26:18 +08:00
|
|
|
[1] Unitree Robotics. *unitree\_guide: An open source project for controlling the quadruped robot of Unitree Robotics,
|
|
|
|
and it is also the software project accompanying 《四足机器人控制算法--建模、控制与实践》 published by Unitree
|
|
|
|
Robotics*. [Online].
|
|
|
|
Available: [https://github.com/unitreerobotics/unitree_guide](https://github.com/unitreerobotics/unitree_guide)
|
|
|
|
|
|
|
|
[2] Qiayuan Liao. *legged\_control: An open-source NMPC, WBC, state estimation, and sim2real framework for legged
|
|
|
|
robots*. [Online]. Available: [https://github.com/qiayuanl/legged_control](https://github.com/qiayuanl/legged_control)
|
2024-10-08 21:36:42 +08:00
|
|
|
|
2024-10-28 10:26:18 +08:00
|
|
|
[3] Ziqi Fan. *rl\_sar: Simulation Verification and Physical Deployment of Robot Reinforcement Learning Algorithm.*
|
|
|
|
2024. Available: [https://github.com/fan-ziqi/rl_sar](https://github.com/fan-ziqi/rl_sar)
|