Autonomous Navigation and Obstacle Avoidance on Unitree Go2
Project Overview
This project enabled autonomous navigation and obstacle avoidance on the Unitree Go2 Edu robot using the Nav2 Stack and custom control nodes. The system allows the robot to explore unknown environments, dynamically avoid obstacles, and navigate to user-defined goals.
How It Works
After successfully implementing SLAM (see SLAM project page), we integrated the Nav2 Stack, which enables autonomous navigation, and obstacle avoidance on the robot. Nav2 subscribes to the /odom
and /map
topics, and send the velocity command to a custom control node. This node translates the commands into a format compatible with the Unitree SDK for movement execution. Additionally, a custom exploration node was developed to enable autonomous exploration.
The diagram below shows the building blocks of our system.
Project Architecture

Note: steps 1 and 2 are fully explained in the SLAM project page (see here), this page explains the next steps from 3 to 5.
Hardware Configuration
- Unitree Go2 Edu with Nvidia Jetson Nano
- Robosense RS-Helios-32 LiDAR
- Intel RealSense D345i RGB-D Camera
The image below shows the robot and its attachments.

Software Requirement
- ROS2 Foxy
- Ubuntu 20.04
- Unitree ROS2 SDK (Installation guide: Unitree ROS2 SDK)
Nav2 Integration
In the previous project (SLAM project page), the /odom
and /map
topics were published by RTAB-Map. Nav2 subscribes to these topics to:
- Generate navigation paths using its global and local planners.
- Avoid obstacles dynamically based on the costmaps.
- Send velocity commands (
/cmd_vel
) for movement.
Find the code for launch file, and configurations in the project Github Repository click here
Once Nav2 is successfully integrated, it publishes velocity commands on the /cmd_vel
topic. The lifecycle manager in Nav2 initializes key navigation components such as:
- Global and local planners
- Path following behavior tree
- Obstacle avoidance and costmap servers
- Waypoint follower for sequential goal tracking
Nav2’s configuration file was modified to work with Unitree Go2, specifically adjusting:
- Localization parameters to adapt AMCL for the robot.
- Navigation behavior for smooth path planning.
- Control settings for better speed and stability.
- Global and local costmaps for obstacle avoidance.
These modifications ensured that the robot effectively localized itself, planned efficient routes, and dynamically responded to environmental changes.
Custom Control Node
The custom control node plays a crucial role in translating Nav2’s velocity commands (/cmd_vel
) into commands that the Unitree SDK can interpret. This ensures smooth and accurate movement execution.
The control node performs the following tasks:
- Subscribes to
/cmd_vel
topic to receive movement commands. - Converts velocity commands into Unitree SDK-compatible instructions.
- Handles timeout conditions to stop the robot when no new commands are received.
- Supports custom actions such as standing up, laying down, and dancing using Unitree’s API.
Find the code for the node in the project Github Repository click here
With this setup, the robot successfully Navigates through an already mapped environment. See the video below:
Note: the video in the overview shows the robot after this stage.
Dynamic Obstacle Avoidance
In dynamic environments, the robot continuously updates its costmaps and navigation goals, adjusting its path to safely maneuver around obstacles. See the video below:
Exploration Node
To enable autonomous exploration, a frontier-based exploration is utilized for this project. This node identifies unmapped areas (frontiers), selects the best frontier based on distance and exploration efficiency, and publishes a goal pose to Nav2 for autonomous movement.
To improve standard frontier-based exploration, we added following adjustment to frontier based system:
- Farthest-frontier selection to encourage loop closure and full coverage.
- Intermediate goal planning to avoid small, inefficient movements.
- Dynamic frontier filtering to ensure valid exploration targets.
Find the code for the node in the project Github Repository click here
In another project, we went through different exploration nodes and study the behavior of them in a game-based environment in python. Take a look at this. a detailed breakdown of frontier exploration, see the Exploration Project Page.
GitHub Repository
The full project code, configurations are available at:
🔗 GitHub Repository
Acknowledgments
This project was inspired by the work of Nick Morales and Roy Rahul. Thanks to them for droping their code and knowledge online. This project wouldn’t exist without their awesome work.