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




The image below shows the robot and its attachments.


Software Requirement



In the previous project (SLAM project page), the /odom and /map topics were published by RTAB-Map. Nav2 subscribes to these topics to:

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:

Nav2’s configuration file was modified to work with Unitree Go2, specifically adjusting:

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:

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:

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.