ros2_control Concepts & Simulation
ros2_control Concepts & Simulation
Intro
ros2_control on the real robot
ROS2_Control
DiffBot
DiffBot, or ”Differential Mobile Robot”, is a simple mobile base with differential drive. The robot is basically a box moving according to differential drive kinematics.
diffdrive_arduino
This node is designed to provide a ros2_control hardware interface for an Arduino running firmware from ros_arduino_bridge. It is designed to be used with a diff_drive_controller from ros2_control. It is expected to communicate via serial and to have two motors, each with velocity control and position/velocity feedback.
This node is designed to provide an interface between a diff_drive_controller from ros_control and an Arduino running firmware from ros_arduino_bridge
This means that the node (a ROS software component) serves as a communication bridge between:
- A differential drive controller (
diff_drive_controller
) fromros_control
diff_drive_controller
is a ROS package used to control differential drive robots (robots with two wheels that can move independently).- It sends velocity commands (linear and angular speed) to the motors.
- An Arduino running
ros_arduino_bridge
firmware
ros_arduino_bridge
is firmware for an Arduino that allows it to communicate with ROS over a serial connection.- It reads commands from ROS and sends them to the motor driver (e.g., an L293D or L298N).
- It can also send sensor data back to ROS (e.g., encoders, IMU, etc.).
How It Works:
- The ROS node receives velocity commands (
cmd_vel
) from ROS (e.g., frommove_base
or a joystick).- It converts those commands into motor speeds and sends them to the Arduino via
ros_arduino_bridge
.- The Arduino controls the motors through an H-Bridge like L293D.
- If the Arduino has encoders, it can send back wheel odometry data to ROS for localization.
Why Use This Setup?
- Allows ROS to control an Arduino-powered robot running differential drive.
- Uses
ros_control
, which provides PID control, odometry, and smoother motion.- The Arduino handles low-level motor control, reducing load on the Raspberry Pi/PC running ROS.
Other Resources
I’m not a big fan of the L293D Motor DriverL298N, so I modified the ROS_ARDUINO_BRIDGE from Josh’s project to support the TB6612FNG Motor Driver TB06612FNG H-bridge module. You can find it here: