This repository integrates reinforcement learning (RL), navigation, and simulation to enable autonomous navigation for the Unitree Go2 and Go2W quadruped robots in Gazebo.
This project follows a Sim-to-Sim approach, executing controllers trained in Isaac Lab within the Gazebo simulator. The virtual Unitree Go2 and Go2W robots are equipped with a Livox Mid-360 LiDAR. The mounting position of the LiDAR is based on the Unitree developer documentation.
Before you begin, ensure you have the following dependencies installed:
-
ROS 2 Humble: Please follow the official installation instructions.
-
Livox SDK2:
git clone https://github.com/Livox-SDK/Livox-SDK2.git cd Livox-SDK2 mkdir build && cd build cmake .. && make sudo make install
-
Required ROS 2 Packages:
sudo apt update && sudo apt install -y \ ros-humble-teleop-twist-keyboard \ ros-humble-ros2-control \ ros-humble-ros2-controllers \ ros-humble-control-toolbox \ ros-humble-robot-state-publisher \ ros-humble-joint-state-publisher-gui \ ros-humble-gazebo-ros2-control \ ros-humble-gazebo-ros-pkgs \ ros-humble-xacro \ ros-humble-navigation2 \ ros-humble-octomap-ros\ ros-humble-octomap-rviz-plugins\
-
LibTorch (C++):
# Choose a directory to store the library mkdir -p ~/libs && cd ~/libs wget https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-2.0.1%2Bcpu.zip unzip libtorch-cxx11-abi-shared-with-deps-2.0.1+cpu.zip rm libtorch-cxx11-abi-shared-with-deps-2.0.1+cpu.zip echo 'export Torch_DIR=$HOME/libs/libtorch' >> ~/.bashrc source ~/.bashrc
-
yaml-cpp and lcm:
sudo apt install -y liblcm-dev libyaml-cpp-dev
-
Clone the Repository: Create a ROS 2 workspace and clone this repository recursively.
mkdir -p ~/ros2_ws/src && cd ~/ros2_ws/src git clone https://github.com/RCILab/RCI_quadruped_robot_navigation --recursive
-
Build the Workspace: Install dependencies and build the packages.
cd ~/ros2_ws colcon build --symlink-install
-
Source the Environment: Source the workspace's setup file to make the packages available in your environment.
echo "source ~/ros2_ws/install/setup.bash" >> ~/.bashrc source ~/.bashrc
Follow these steps to launch the simulation and control the robot. Each command should be run in a new terminal.
-
Launch Gazebo & RViz2: This command starts the Gazebo simulation with the robot model and launches RViz2 for visualization.
- Default robot is
go2
. - Use the
rname
argument to switch to another robot likego2w
.
# Launch with the default Go2 robot ros2 launch rl_sar gazebo.launch.py # Launch with the Go2W robot ros2 launch rl_sar gazebo.launch.py rname:="go2w"
- Default robot is
-
Run the RL Controller: This node is responsible for the robot's locomotion control.
ros2 run rl_sar rl_sim
-
Run the Action Client: This client sends high-level commands or goals to the controller.
ros2 run rl_action command
This example demonstrates how to control the robot's movement using keyboard commands.
-
Activate the Robot: In the terminal where you launched the
rl_action command
node, enter the following commands to activate the robot and enable navigation mode:(csuite) activation true (csuite) navigation true
-
Launch Keyboard Teleoperation: Open a new terminal and run the
teleop_twist_keyboard
node to control the robot with your keyboard.ros2 run teleop_twist_keyboard teleop_twist_keyboard
You can now move the robot using the capital keys displayed in the terminal (e.g.,
U
,I
,O
,J
,K
,L
,M
,<
,>
) -
Deactivate the Robot: When you are finished, deactivate the robot and exit the command interface by returning to the
rl_action
terminal and entering:(csuite) activation false (csuite) quit
-
Navigation integration
- Add navigation capability using either the
Nav2
package or by integrating with unitree_go2_nav
- Add navigation capability using either the
-
OpenRMF support
- Incorporate Open-RMF functionality for fleet and task management
-
Minor bug fixes
- Verify and correct PCD positioning
- Hot Fix! To minimize distortion of the Livox Mid-360, set
min_range = 0
.
See the discussion here: Livox-SDK/livox_laser_simulation#19
-
RL model update
- Modify reinforcement learning to account for LiDAR weight
This project is licensed under the MIT License. See the LICENSE file for details.
In addition, the following components are based on forked repositories with modifications:
- Controller module is forked and adapted from fan-ziqi/rl_sar
- Gazebo simulation for the Livox Mid-360 is forked and adapted from LCAS/livox_laser_simulation_ros2
Each of these components follows the respective license of the original repository.
Maintainer: Sanghyun Kim ([email protected]
)