Skip to content

README.md

Machine-translated by Robotheca from the original in Chinese (opens in a new tab). License: GPL-3.0-only (opens in a new tab).

Hexapod-ROS

Introduction

Project Overview

Hexapod-ROS is an open-source hexapod robot platform (currently under development in spare time). The robot uses a dual-processor architectureโ€”LubanCat Zero (RK3566) running ROS2 Humble, responsible for high-level perception, path planning, and motion control; STM32F405RGT6 running FreeRTOS with MicroROS, responsible for real-time IMU data publishing, charging control, temperature monitoring, and publishing battery and other hardware information. The 18 servos directly controlled by LubanCat use disassembled servos from UBTECH, and details about the servos can be found in "Cheap Servo from Taobao (opens in a new tab)".

Main features include:

  • 18 degrees-of-freedom motion control, supporting inverse kinematics calculations and multiple gait patterns
  • SLAM mapping and autonomous navigation (Navigation2) based on a 360ยฐ 2D LiDAR
  • Real-time IMU attitude estimation and battery management
System Architecture

The system is divided into three layers: software layer, hardware layer, and power layer. The following architecture diagram provides a complete system overview.

Hardware Architecture

The source file for the architecture diagram is located at docs/diagrams/hardware_architecture.drawio.

Software Architecture

TODO: Awaiting full development completion

Power Architecture

The source file for the architecture diagram is located at docs/diagrams/power_architecture.drawio.

Quick Start

Environment Dependencies
ComponentRequirement
Operating System (LubanCat/Development Machine)Ubuntu 22.04 LTS
Development EnvironmentROS2 Humble, MicroROS for STM32, Python 3.10, gcc-13, CLion, STM32CubeMX
Simulation EnvironmentGazebo 11
3D PrintingBambu Lab A1, PETG Filament (tested)
Compiling the Project

1. Clone the Repository

git https://github.com/greenhand520/hexapod_ros.git
cd hexapod_ros
git submodule init
git submodule update --remote --checkout

2. Install Required Packages

# YDLIDAR SDK
git clone https://github.com/YDLIDAR/YDLidar-SDK.git
cd YDLidar-SDK
mkdir build
cd build
cmake ..
make
sudo make install

# microros agent
cd software/hexapod_ros_ws/
chmod +x ./install_microros_agent.sh
./install_microros_agent.sh

3. Compile the ROS2 Workspace

cd software/hexapod_ros_ws/
rosdep install --from-paths src --ignore-src -r -y
chmod +x ./colcon_build.sh
./colcon_build.sh
source install/setup.bash
# Start
ros2 launch hexapod_bringup start.launch.py
# Add auto-start service
TODO

4. Compile and Flash the STM32 Firmware

cd software/hexapod_ros_ws/
chmod +x lib_microros_generation.sh
# Compile the microros static library and copy related files to hexapod_stm32f405
./lib_microros_generation.sh -r

Open software/hexapod_stm32f405/ in CLion, compile the project, and flash it via ST-Link.

Hardware

Control Board
ComponentSpecifications
LubanCat ZeroRK3566, ARM Cortex-A55 quad-core 1.8GHz, 4GB RAM, 32GB TF Card
LubanCat Zero Expansion BoardUART ร—3, UART to USB-C, USB2.0 ร—3, TF SD, 10M/100M RJ45, SPI, I2C, etc.
STM32F405RGT6Cortex-M4 168MHz, 1MB Flash, 192KB SRAM, SPI, I2C, UART, GPIO, USB-C 2.0, USB-C PD input
Peripherals and Sensors
ComponentDescriptionInterface
UBTECH Servo ร—186 legs ร— 3 joints, serial bus servoUART4
YDLIDAR X22D 360ยฐ laser radarUART8
MPU65006-axis IMU (accelerometer + gyroscope)SPI
BQ40Z50Battery fuel gauge + protection (overcharge/overdischarge/overcurrent/short circuit)SMBus
BQ24725Battery charging management IC, up to 100W inputSMBus
CH339FUSB 2.0 Hub + Ethernet + TF Card expansionUSB-C
Power System
ParameterValue
Battery4S Li-ion battery (nominal 14.8V), ~5000mAh, 21700 cell
ChargingBQ24725, max 100W, SMBus programmable
ProtectionBQ40Z50, overcharge/discharge/overcurrent/short-circuit protection
Servo PowerTPS40305 Buck DC-DC, battery voltage stepped down to ~8.4V
LubanCat Power5V output from power board
STM32 Power3.3V LDO
PCB Design

All PCBs (main control board, expansion board, power board, and battery protection board) are designed using JLCEDA Pro (opens in a new tab). The corresponding project files are located in the hardware directory.

The latest PCB project files that can be viewed directly online are available at the oshwhub release page (opens in a new tab) (pending completion of all PCB tests).

3D Printing and Mechanical Structure

The body design is based on the classic hexapod project (opens in a new tab) structure. After referencing the STL files, it was completely rebuilt to accommodate UBTECH servos and 4S 21700 batteries. The parts are 3D printed, with modeling parameters optimized for PETG material and the Bambu Lab A1 printer. Other materials and printers have not been tested, so structural strength and dimensions cannot be guaranteed. The print files and bill of materials (BOM) are located in the mechanism directory:

mechanism/
โ”œโ”€โ”€ stl/                    # Latest printable STL files
โ”œโ”€โ”€ step/                   # STEP files for generating URDF
โ”œโ”€โ”€ BOM.md                  # Bill of Materials (fasteners, bearings, etc.) (TODO)
โ””โ”€โ”€ assembly_guide.md       # Assembly guide (TODO)

Access the latest print files on the Makeword release page (opens in a new tab) (coming soon).

Software

The software is divided into two main parts: the STM32 firmware handles real-time hardware driving, while the ROS2 workspace runs on LubanCat for perception, planning, and control.

STM32 Firmware (software/hexapod_stm32f405/)

The STM32 firmware runs on FreeRTOS and the STM32 HAL library, communicating with Lubancat via MicroROS over UART.

Main responsibilities:

  • Publish IMU data from the MPU6500 (/imu/data topic)
  • Publish battery status from the BQ40Z50 (/battery/status topic)
  • Collect and publish onboard temperature, voltage data, and charging status from the BQ24725 via ADC (/sensor/board_state topic)
ROS2 Workspace (software/hexapod_ros_ws/)

The ROS2 workspace contains all high-level packages running on LubanCat Zero (RK3566). The system is based on Ubuntu 22.04 + ROS2 Humble.

software/hexapod_ros_ws/
โ”œโ”€โ”€ src
โ”‚ย ย  โ”œโ”€โ”€ hexapod_bringup
โ”‚ย ย  โ”œโ”€โ”€ hexapod_description
โ”‚ย ย  โ”œโ”€โ”€ hexapod_interface
โ”‚ย ย  โ”œโ”€โ”€ hexapod_sensor_interface
โ”‚ย ย  โ”œโ”€โ”€ hexapod_test_ubtech_servo
โ”‚ย ย  โ”œโ”€โ”€ hexapod_test_ubtech_servo_interface
โ”‚ย ย  โ”œโ”€โ”€ hexapod_ubtech_ros2_control
โ”‚ย ย  โ””โ”€โ”€ ydlidar_ros2_driver
โ”œโ”€โ”€ CMakeLists.txt
โ”œโ”€โ”€ colcon_build.sh
โ”œโ”€โ”€ env.sh
โ””โ”€โ”€ generate_and_deploy_microros.sh
Package Descriptions
PackageDescription
hexapod_bringupLaunch files and configurations for system startup. Launches all hardware drivers, ros2_control controllers, sensor nodes, and the MicroROS Agent in the correct order. Includes configurations and launch files for visual odometry, mapping, and IMU fusion.
hexapod_descriptionRDF/Xacro robot model, mesh files, TF coordinate systems, and RViz visualization configurations. Defines an 18-DOF kinematic structure.
hexapod_interfaceDefines the msg/service/action files for communication between hexapod nodes.
hexapod_sensor_interfaceDefines the msg files for communication with the STM32.
hexapod_test_ubtech_servoNode for testing whether the Ubtech servos work correctly using ros2_control.
hexapod_test_ubtech_servo_interfaceDefines the service files used for testing Ubtech servos.
hexapod_ubtech_ros2_controlControls Ubtech servos using ros2_control. Can be replaced with other servos by implementing the corresponding ros2_control package.
ydlidar_ros2_driverROS2 driver for the YDLIDAR X2 laser radar.
hexapod_controllerConverts velocity/orientation commands into foot-end trajectories and joint angles for 18 servos. Transforms foot-end trajectories (x, y, z) into servo rotation angles for all 18 joints.

Development Progress and Roadmap

  • Hardware design (PCB, schematic)
  • 3D-printed body design (PETG, Bambu Lab A1)
  • Basic ROS2 bringup and ros2_control
  • STM32 firmware and MicroROS integration
  • Inverse kinematics and triangular gait
  • YDLIDAR X2 driver and SLAM integration
  • Navigation2 path planning
  • RL training environment (Gazebo + PyBullet)
  • RL motion strategy training (PPO / SAC)
  • Simulation-to-real policy deployment
  • Multi-gait RL switching (triangular gait, ripple gait, wave gait)
  • RL + Nav2 joint autonomous exploration
  • Documentation and assembly video tutorials

Contributing

Contributions are welcome! Please read the following guidelines:

TODO

Open Source License

This project is open-sourced under the GNU General Public License v3.0โ€”see the LICENSE file for details.

The hardware design (PCB schematics, 3D models) is open-sourced under the CERN Open Hardware Licence v2 (CERN-OHL-P-2.0).

Acknowledgments

No particular order

Files by @greenhand520, at commit 39a51e4, read from GitHub in your browser. Hardware license: GPL-3.0-only; software license: GPL-3.0-only. Robotheca doesn't review code: read it before running it.