A working ROS2 Jazzy implementation for controlling a differential drive robot with encoder feedback.
For C Arduino code check: https://github.com/rainingmp3/ros_arduino_bridge For related simulation work in Gazebo check: https://github.com/rainingmp3/differential_drive
robot.mov
- Raspberry Pi 4B
- Arduino Nano (clone)
- L298N motor driver
- IR encoders
- 4× AA batteries
Getting ros2_control working on real hardware is notoriously difficult:
- Fragmented documentation - Information is scattered across multiple ROS2 distributions with breaking changes between versions
- Complex debugging - Issues can originate from hardware, firmware, drivers, or any layer of the ros2_control stack
- Large codebase - Tracing problems through controllers, hardware interfaces, and lifecycle management is time-consuming
- Simultaneous failures - Hardware and software issues often occur together, making root cause analysis challenging
This repository provides a complete, tested implementation for the hardware mentioned above with ROS2 Jazzy.
This project combines work from:
- Josh Newans - hardware package (hardware interface and Arduino code)
- Edouard Renard - all other packages (basic structure of the project, main configuration and bringup files)
- Aleksandar Haber - hardware assembly
- Josh Newans YouTube Series
- Edouard Renard's YouTube Channel
- Aleksandar Haber PhD YouTube
- ROS2 Control Documentation
- ros2_control_demos
- Buy list, electronics, etc.
- Differential drive control working
- Encoder feedback integrated
- Tested on real hardware
- Polishing
- Tuning
- Combining low level control with higher level navigation
- Behavior trees, obstacle avoidance, and general "higher level" tasks