Skip to content

saqib736/Buraq_4WD_Mobile_Robot

Repository files navigation

Buraq 4WD Mobile Robot

A complete ROS2-based mobile robot platform with hardware interface, navigation, SLAM, and firmware components.

Overview

The Buraq 4WD Mobile Robot is a four-wheel-drive mobile robot platform built on ROS2. The name "Buraq" means "lightning horse" - though ironically, this robot moves at a more... contemplative pace. Despite not living up to its speedy namesake (yet!), it features a comprehensive software stack including hardware interface, motor control, SLAM, navigation, and visualization components. The robot uses a Teensy microcontroller for low-level motor control and sensor integration, communicating with a Raspberry Pi running ROS2.

Hardware Components

  • 4 DC motors with encoders
  • Teensy microcontroller for motor control and sensor integration
  • IMU (Inertial Measurement Unit)
  • LDLiDAR SL sensor
  • Raspberry Pi (running ROS2)

Software Architecture

The project is organized into several ROS2 packages:

1. teensy_firmware

Firmware for the Teensy microcontroller that handles:

  • Motor control with PID feedback
  • Encoder reading
  • IMU data processing
  • Serial communication with ROS2

Key Features:

  • Multi-threaded design for real-time control
  • Motor calibration system to normalize performance across all motors
  • Serial communication protocol for interfacing with ROS2
  • IMU integration for orientation and acceleration data

2. buraq_hw

Hardware interface package that bridges the Teensy firmware with ROS2 control system.

Key Features:

  • Custom hardware interface implementation
  • Serial communication with the Teensy microcontroller
  • Integration with ROS2 control system

3. buraq_description

URDF description of the robot for visualization and simulation.

Key Features:

  • Complete URDF model of the robot
  • Launch files for visualization
  • Integration with RViz

4. buraq_bringup

Main launch package for bringing up the robot's core functionality.

Key Features:

  • Controller configuration
  • Robot state publisher
  • Hardware interface initialization
  • Robot localization setup

5. buraq_navigation

Navigation package based on Nav2.

Key Features:

  • Navigation configuration
  • Path planning
  • Obstacle avoidance
  • Map integration

6. buraq_slam

SLAM (Simultaneous Localization and Mapping) package using SLAM Toolbox.

Key Features:

  • Real-time mapping
  • Localization
  • Map saving and loading

7. ldlidar_sl_ros2

ROS2 driver for the LDLiDAR SL sensor.

Key Features:

  • LiDAR data acquisition
  • Point cloud processing
  • Integration with ROS2 navigation and SLAM

Motor Calibration System

The robot features a sophisticated motor calibration system to address differences in motor performance:

  1. Each motor has slightly different performance characteristics in forward and backward directions
  2. The calibration program tests each motor at different PWM values and calculates calibration factors
  3. These factors are stored as constants in the config.h file
  4. The CalibratedMotor class extends the base Motor class to apply these calibration factors
  5. This ensures consistent robot movement regardless of motor variations

Serial Communication Protocol

The Teensy firmware implements a simple yet robust serial communication protocol:

  • e: Request encoder ticks (Response: "e FL FR RL RR\n")
  • r: Reset all motor encoders (No response)
  • m FL FR RL RR: Set target speeds (m/s) for FrontLeft, FrontRight, RearLeft, RearRight motors (No response)
  • i: Request IMU data (Response: "i qw qx qy qz gx gy gz ax ay az\n" or "i IMU_NOT_READY\n")

Getting Started

Prerequisites

  • ROS2 Humble or later
  • Arduino IDE with Teensyduino for firmware development
  • Required ROS2 packages:
    • controller_manager
    • diff_drive_controller
    • joint_state_broadcaster
    • imu_sensor_broadcaster
    • robot_state_publisher
    • robot_localization
    • nav2_bringup
    • slam_toolbox

Installation

  1. Clone this repository into your ROS2 workspace:

    cd ~/ros2_ws/src
    git clone https://github.com/yourusername/Buraq_4WD_Mobile_Robot.git
  2. Install dependencies:

    cd ~/ros2_ws
    rosdep install --from-paths src --ignore-src -r -y
  3. Build the workspace:

    cd ~/ros2_ws
    colcon build
  4. Upload the Teensy firmware:

    • Open teensy_firmware/teensy_firmware.ino in Arduino IDE
    • Select Teensy board from Tools > Board menu
    • Upload the firmware

Usage

Bringing up the robot

  1. Source your ROS2 workspace:

    source ~/ros2_ws/install/setup.bash
  2. Launch the robot bringup:

    ros2 launch buraq_bringup robot.launch.py

Running SLAM

ros2 launch buraq_slam online_async_launch.py

Running Navigation

ros2 launch buraq_navigation navigation.launch.py map:=/path/to/your/map.yaml

License

This project is licensed under the Apache License 2.0 - see the individual package files for details.

Author

Saqib Mehmood (saqibmehmood736@gmail.com)

About

Ros2 stack and teensy firmware for a 4W diff-Drive mobile robot.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors