Project files
- docs21 files
- hardware1 file
- mechanism25 files
- software1666 files
- .gitattributes1 KB
- .gitignore1 KB
- .gitmodules1 KB
- LICENSE35 KB
- README.md11 KB
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
| Component | Requirement |
|---|---|
| Operating System (LubanCat/Development Machine) | Ubuntu 22.04 LTS |
| Development Environment | ROS2 Humble, MicroROS for STM32, Python 3.10, gcc-13, CLion, STM32CubeMX |
| Simulation Environment | Gazebo 11 |
| 3D Printing | Bambu 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
| Component | Specifications |
|---|---|
| LubanCat Zero | RK3566, ARM Cortex-A55 quad-core 1.8GHz, 4GB RAM, 32GB TF Card |
| LubanCat Zero Expansion Board | UART ร3, UART to USB-C, USB2.0 ร3, TF SD, 10M/100M RJ45, SPI, I2C, etc. |
| STM32F405RGT6 | Cortex-M4 168MHz, 1MB Flash, 192KB SRAM, SPI, I2C, UART, GPIO, USB-C 2.0, USB-C PD input |
Peripherals and Sensors
| Component | Description | Interface |
|---|---|---|
| UBTECH Servo ร18 | 6 legs ร 3 joints, serial bus servo | UART4 |
| YDLIDAR X2 | 2D 360ยฐ laser radar | UART8 |
| MPU6500 | 6-axis IMU (accelerometer + gyroscope) | SPI |
| BQ40Z50 | Battery fuel gauge + protection (overcharge/overdischarge/overcurrent/short circuit) | SMBus |
| BQ24725 | Battery charging management IC, up to 100W input | SMBus |
| CH339F | USB 2.0 Hub + Ethernet + TF Card expansion | USB-C |
Power System
| Parameter | Value |
|---|---|
| Battery | 4S Li-ion battery (nominal 14.8V), ~5000mAh, 21700 cell |
| Charging | BQ24725, max 100W, SMBus programmable |
| Protection | BQ40Z50, overcharge/discharge/overcurrent/short-circuit protection |
| Servo Power | TPS40305 Buck DC-DC, battery voltage stepped down to ~8.4V |
| LubanCat Power | 5V output from power board |
| STM32 Power | 3.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/datatopic) - Publish battery status from the BQ40Z50 (
/battery/statustopic) - Collect and publish onboard temperature, voltage data, and charging status from the BQ24725 via ADC (
/sensor/board_statetopic)
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
| Package | Description |
|---|---|
| hexapod_bringup | Launch 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_description | RDF/Xacro robot model, mesh files, TF coordinate systems, and RViz visualization configurations. Defines an 18-DOF kinematic structure. |
| hexapod_interface | Defines the msg/service/action files for communication between hexapod nodes. |
| hexapod_sensor_interface | Defines the msg files for communication with the STM32. |
| hexapod_test_ubtech_servo | Node for testing whether the Ubtech servos work correctly using ros2_control. |
| hexapod_test_ubtech_servo_interface | Defines the service files used for testing Ubtech servos. |
| hexapod_ubtech_ros2_control | Controls Ubtech servos using ros2_control. Can be replaced with other servos by implementing the corresponding ros2_control package. |
| ydlidar_ros2_driver | ROS2 driver for the YDLIDAR X2 laser radar. |
| hexapod_controller | Converts 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
- ROS2 (opens in a new tab) โ Robot Operating System 2
- Xiaomi MiMo Token Plan (opens in a new tab) โ Xiaomi MiMo Large Model Token Subscription Plan
- CLion (opens in a new tab) โ Cross-platform C/C++ integrated development environment designed for smooth workflows and efficient development
- MicroROS (opens in a new tab) โ ROS2 for microcontrollers
- Navigation2 (opens in a new tab) โ ROS2 navigation framework
- YDLIDAR (opens in a new tab) โ LiDAR SDK
- LubanCat (opens in a new tab) โ LubanCat Zero single-board computer
- JLCEDA (opens in a new tab) โ PCB design tool (LCEDA)
- Bambu Lab (opens in a new tab) โ 3D printing platform
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.