A complete ROS2-based mobile robot platform with hardware interface, navigation, SLAM, and firmware components.
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.
- 4 DC motors with encoders
- Teensy microcontroller for motor control and sensor integration
- IMU (Inertial Measurement Unit)
- LDLiDAR SL sensor
- Raspberry Pi (running ROS2)
The project is organized into several ROS2 packages:
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
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
URDF description of the robot for visualization and simulation.
Key Features:
- Complete URDF model of the robot
- Launch files for visualization
- Integration with RViz
Main launch package for bringing up the robot's core functionality.
Key Features:
- Controller configuration
- Robot state publisher
- Hardware interface initialization
- Robot localization setup
Navigation package based on Nav2.
Key Features:
- Navigation configuration
- Path planning
- Obstacle avoidance
- Map integration
SLAM (Simultaneous Localization and Mapping) package using SLAM Toolbox.
Key Features:
- Real-time mapping
- Localization
- Map saving and loading
ROS2 driver for the LDLiDAR SL sensor.
Key Features:
- LiDAR data acquisition
- Point cloud processing
- Integration with ROS2 navigation and SLAM
The robot features a sophisticated motor calibration system to address differences in motor performance:
- Each motor has slightly different performance characteristics in forward and backward directions
- The calibration program tests each motor at different PWM values and calculates calibration factors
- These factors are stored as constants in the config.h file
- The CalibratedMotor class extends the base Motor class to apply these calibration factors
- This ensures consistent robot movement regardless of motor variations
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")
- 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
-
Clone this repository into your ROS2 workspace:
cd ~/ros2_ws/src git clone https://github.com/yourusername/Buraq_4WD_Mobile_Robot.git
-
Install dependencies:
cd ~/ros2_ws rosdep install --from-paths src --ignore-src -r -y
-
Build the workspace:
cd ~/ros2_ws colcon build
-
Upload the Teensy firmware:
- Open
teensy_firmware/teensy_firmware.inoin Arduino IDE - Select Teensy board from Tools > Board menu
- Upload the firmware
- Open
-
Source your ROS2 workspace:
source ~/ros2_ws/install/setup.bash
-
Launch the robot bringup:
ros2 launch buraq_bringup robot.launch.py
ros2 launch buraq_slam online_async_launch.pyros2 launch buraq_navigation navigation.launch.py map:=/path/to/your/map.yamlThis project is licensed under the Apache License 2.0 - see the individual package files for details.
Saqib Mehmood (saqibmehmood736@gmail.com)