Skip to content

NguyenTrongPhuc552003/reinforcement-automative-hexapod

Repository files navigation

Hexapod Robot Control System

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.

Hexapod Robot

Project Overview

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

System Architecture

The system follows a layered architecture with hardware abstraction. For visual reference, see the architecture diagrams in the /docs/diagrams/out directory:

.
├── driver/          # Linux kernel device drivers
├── app/             # User applications and libraries
├── docs/            # Documentation
└── scripts/         # Build and utility scripts

Features

  • 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

Prerequisites

  • BeagleBone AI (or Black) running Linux 4.14+
  • I2C enabled (bus 3)
  • 18x servo motors (MG996R recommended)
  • MPU6050 IMU sensor
  • 2x PCA9685 PWM controllers

Quick Start

  1. Build the kernel module:

    cd driver
    make
  2. Install the kernel module:

    sudo insmod hexapod_driver.ko
  3. Build user-space applications:

    cd app
    make
  4. Run the test utility:

    sudo ./test_servo

Development

See individual README files in subdirectories for detailed development guides:

Testing

Run the test suite:

cd app
make

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

Troubleshooting

Sensor Issues

  • 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.

Servo Issues

  • Servos not moving: Check power supply and ensure driver is properly loaded
  • Erratic movement: Verify calibration settings and check for loose connections

Documentation

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

License

This project is licensed under the GPL License - see the LICENSE file for details.

Authors

  • StrongFood - I mean "TrongPhuc"

Acknowledgments

  • BeagleBoard.org
  • Linux Kernel Community

About

Intelligent hexapod control system with AI-based adaptive gait, kernel drivers, and user-space coordination.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •