← All Projects
ROS2 RedBot Mobile Robot Platform
ROS2
Python
C++
Arduino
Raspberry Pi
CycloneDDS
RViz2
Ubuntu
systemd
OpenCV
picamera2
Long Description (Detailed Technical Overview)
Project Overview
This project demonstrates a complete robotics system built by integrating embedded hardware (Arduino-based RedBot) with modern robotics middleware (ROS2 Humble) on a Raspberry Pi. The robot bridges low-level sensor/actuator control with high-level navigation and perception capabilities, providing a foundation for autonomous navigation, computer vision, and advanced robotics applications.
System Architecture
The robot employs a layered architecture separating hardware control, communication, and intelligence:
Hardware Layer (Arduino ATmega328P):
Direct control of motors via TB6612FNG H-bridge driver
Real-time sensor acquisition at 20Hz including wheel encoders (192 ticks/revolution), 3-axis MMA8452Q accelerometer, dual IR line-following sensors, mechanical bumper switches, and piezo buzzer
Custom serial communication protocol (115200 baud) publishing sensor telemetry and accepting velocity commands
Differential drive kinematics implementation for precise motor control
Communication Layer (Serial Bridge):
Python ROS2 node translating between Arduino serial protocol and ROS2 publish/subscribe topics
Bidirectional data flow: sensor streams published to standard ROS2 message types, velocity commands subscribed from /cmd_vel topic
Designed for reliability with error handling and data validation
Perception Layer (Camera Integration):
Raspberry Pi Camera Module v1 (OV5647 sensor) integrated via picamera2 library
Real-time image streaming at 640x480 resolution to ROS2 image topics
Foundation for computer vision applications including line following, object detection, and visual SLAM
Odometry Layer (Position Tracking):
Dead reckoning implementation calculating robot pose (x, y, θ) from wheel encoder data
Differential drive kinematics accounting for wheel diameter (65mm) and wheelbase (150mm)
Motor command integration for directional accuracy (encoders count magnitude only, motor signs provide direction)
TF (transform) broadcasting providing coordinate frame relationships for navigation stack compatibility
Publishes to standard nav_msgs/Odometry topic at 20Hz
System Services:
Systemd service configuration for automatic startup on boot
Launch file orchestrating all nodes (serial bridge, odometry, camera) as a coordinated system
Network-transparent operation via CycloneDDS middleware enabling remote development and visualization
Development Workflow
The project showcases professional robotics development practices:
Version Control: Complete Git repository with comprehensive documentation, changelog tracking, and systematic commit history
Cross-Platform Development: Code developed on Windows desktop (WSL2 + PyCharm/CLion) and deployed to Raspberry Pi via Git pull
Remote Visualization: ROS2 network discovery configured for WSL2 mirrored networking, enabling RViz visualization of robot state, sensor data, and camera feed from development machine
Modular Design: Separate nodes for distinct responsibilities (hardware interface, odometry, camera) following ROS2 best practices
Documentation: README with installation instructions, pin configurations, serial protocol specification, troubleshooting guides, and system setup documentation
Technical Challenges Solved
Pin Constraints: RedBot hardware reserves Arduino interrupt pins for motor control, requiring alternative encoder pins (A2, A3) and careful sensor remapping
Encoder Directionality: Implemented motor command tracking to apply correct signs to encoder deltas (encoders count magnitude only)
Network Discovery: Configured CycloneDDS peer discovery to enable ROS2 communication between WSL2 (Windows desktop) and Raspberry Pi over WiFi
Camera Integration: Navigated Ubuntu Server's lack of raspi-config, built libcamera and rpicam-apps from source, worked around pykms dependencies with dummy module to enable picamera2 operation
Power Management: Designed electrically isolated power systems (USB battery for Pi, AA batteries for RedBot) preventing ground loops and voltage issues
Capabilities Demonstrated
Manual Control: Keyboard teleoperation via standard teleop_twist_keyboard package
Autonomous Readiness: Standard /cmd_vel interface compatible with ROS2 navigation stack (Nav2)
Sensor Fusion: Multiple sensor streams available for behavior implementation (line following, obstacle avoidance, etc.)
Remote Monitoring: Full system state visible via RViz including robot pose, odometry path, TF frames, and live camera feed
Reliability: Auto-recovery from node crashes, systematic error handling, graceful shutdown procedures
Future Expansion Potential
The architecture supports straightforward additions:
Autonomous Navigation: Integration with Nav2 stack for SLAM and path planning
Computer Vision: OpenCV/TensorFlow integration for object detection, line following algorithms
Multi-Robot Systems: ROS2's DDS foundation enables fleet coordination
Sensor Upgrades: LiDAR, IMU, GPS integration via additional ROS2 nodes
Simulation: URDF robot description for Gazebo simulation before hardware deployment
Tech Stack
Hardware
Robot Platform: SparkFun RedBot Mainboard with Shadow Chassis
Microcontroller: ATmega328P (Arduino Uno compatible)
Compute: Raspberry Pi 3 Model B (ARM Cortex-A53, 1GB RAM)
Camera: Raspberry Pi Camera Module v1 (OV5647, 5MP)
Sensors:
-Wheel Encoders: 192 ticks/revolution (magnetic hall effect)
-Accelerometer: MMA8452Q (3-axis, I2C)
-Line Sensors: 2x IR reflectance sensors (analog)
-Bumpers: 2x mechanical switches (digital)
-Buzzer: Piezo speaker (PWM)
Motor Driver: Toshiba TB6612FNG dual H-bridge
Power: Isolated dual-power design (4x AA for RedBot, USB battery for Pi)
Software - Embedded:
-Arduino IDE: 1.8.x
-Language: C++ (Arduino framework)
-Libraries: SparkFun RedBot Library
-Communication: Hardware serial (UART) at 115200 baud
Protocol: Custom CSV-based command/telemetry format
Software - Robot (Raspberry Pi):
-OS: Ubuntu 22.04 Server (64-bit ARM)
-Middleware: ROS2 Humble Hawksbill
-DDS Implementation: Eclipse CycloneDDS
-Language: Python 3.10
Key Libraries:
-rclpy (ROS2 Python client)
-pyserial (serial communication)
-picamera2 (camera interface)
-cv_bridge (image format conversion)
-python-opencv (image processing)
System Services: systemd for auto-start
Software - Development (Desktop):
-OS: Windows 11 + WSL2 (Ubuntu 24.04)
-ROS2: Jazzy Jalisco (cross-compatible with Humble)
-IDEs: PyCharm, CLion, VS Code
-Visualization: RViz2
-Version Control: Git + GitHub
ROS2 Architecture
Nodes:
-redbot_bridge (serial communication)
-odometry_node (position tracking)
-camera_node (image acquisition)
Topics:
-Publishers: /odom, /image_raw, /camera_info, /encoders, /line_sensors, /accelerometer, /bumper/left, /bumper/right
-Subscribers: /cmd_vel, /motor_commands
Coordinate Frames: odom → base_link (TF broadcast)
Message Types: geometry_msgs, sensor_msgs, nav_msgs, std_msgs
Networking:
-Protocol: DDS (Data Distribution Service)
-Discovery: CycloneDDS with static peer configuration
-Topology: WSL2 mirrored networking mode for transparent host network access
-Bandwidth: WiFi 802.11n (2.4GHz)
Build & Deploy:
-Build System: colcon (ROS2 standard)
-Package Format: ament_python
-Deployment: Git-based workflow (develop on desktop, pull to robot)
-Launch System: Python launch files
Documentation & Project Management:
-Repository: GitHub (public)
-Documentation: Markdown (README, CHANGELOG, system setup guides)
-Diagrams: Pin configuration tables, architecture overviews
-Configuration Management: Launch files, RViz configs, systemd service files