NOTE: This hexapod project is still under development and may not be fully functional. So, please wait for an official release is coming soon!
A comprehensive control system for a six-legged robot (hexapod) using BeagleBone AI (or Black), featuring both kernel-space drivers and user-space applications with reinforcement learning capabilities.
This project implements a complete software stack for controlling a 6-legged robot with 18 servo motors (3 per leg), including:
-
Kernel-Space Components:
- Linux kernel driver for servo control (PCA9685 PWM controllers)
- IMU sensor driver (MPU6050) for orientation sensing
- Hardware abstraction layer for unified device access
-
User-Space Components:
- Kinematics library for precise leg positioning
- Gait generation for various walking patterns
- Calibration system for mechanical offset compensation
- Interactive control interface
-
Reinforcement Learning:
- TD3 (Twin Delayed Deep Deterministic Policy Gradient) implementation
- Hardware acceleration via TIDL and OpenCL
- Simulation-to-real transfer capabilities
- On-robot inference engine
The system follows a layered architecture with hardware abstraction. For visual reference, see the architecture diagrams in the /docs/diagrams/image
directory:
- Deployment Diagram: Hardware and software deployment
- Component Diagram: Hardware component interactions
- Sequence Diagram: Runtime interactions
- State Diagram: Hardware state transitions
- Class Diagram: Software class structure
- Building Process: Build and deployment process
.
├── driver/ # Linux kernel device drivers
├── app/ # User applications and libraries
├── docs/ # Documentation
└── scripts/ # Build and utility scripts
- Multiple gait patterns (tripod, wave, ripple)
- Real-time IMU feedback
- Inverse kinematics for precise leg control
- Hardware abstraction layer
- Comprehensive test suite
- Interactive debugging tools
- BeagleBone AI (or Black) running Linux 4.14+
- I2C enabled (bus 3)
- 18x servo motors (MG996R recommended)
- 1x MPU6050 IMU sensor
- 2x PCA9685 PWM controllers
-
Build the kernel module:
./scripts/build.sh -b driver
-
Install the kernel module on BeagleBone AI:
./install.sh
-
Build user-space applications:
./scripts/build.sh -b app
-
Run the test utility on BeagleBone AI:
./test_servo
See individual README files in subdirectories for detailed development guides:
- Kernel Driver README
- User Space README
- Hardware Overview README
- Cross-compile Environment README
- Documentation
Individual tests:
./test_servo # Test servo control
./test_mpu6050 # Test IMU sensor
./test_movement # Test movements like tripod, ripple, ...
./test_calibration # Test servos offset for each leg
./test_hcsr04 # Test HC-SR04 sensor
- Zero IMU readings: The MPU6050 enters sleep mode to save power. The driver now automatically wakes it before readings.
- Erratic IMU behavior: Check I2C connections and ensure proper power supply voltage.
- Servos not moving: Check power supply and ensure driver is properly loaded
- Erratic movement: Verify calibration settings and check for loose connections
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is licensed under the terms of the GNU General Public License v2.0.
- StrongFood - I mean "TrongPhuc"
- BeagleBoard.org
- Linux Kernel Community