Embedded firmware for a four-wheel differential-drive robot using OpenCR/OpenCM, Dynamixel motors, and micro-ROS integration.
This repository contains the firmware stack for the Monster robot — a four-wheel drive mobile platform designed for experimentation with embedded control, sensing, and ROS 2 connectivity.
The system is built around:
- OpenCR/OpenCM controllers,
- Dynamixel smart servos in velocity mode,
- On-board IMU, sonar, LEDs, and user button,
- micro-ROS integration for command and telemetry exchange.
The firmware provides both a standalone (plain) mode and a ROS 2 integrated mode, with safety interlocks and diagnostic feedback.
- 🔧 Differential-drive kinematics with configurable wheel geometry
- ⚙️ Dynamixel motor driver (velocity mode, four motors, left/right control)
- 📡 Sensor integration:
- IMU (quaternion, gyro, accel, mag)
- Sonar (HC-SR04 style, TB3-compatible pins)
- Battery voltage monitoring
- User button
- LED cluster for motion intent
- 🟢 Diagnostics module:
- Heartbeat LED
- Error code blinking
- 🖥️ Controller modes:
- Plain mode: fixed-period loop, no ROS
- ROS 2 mode: subscribes to
cmd_vel(geometry_msgs/Twist) via micro-ROS, with safety checks
- 🛡️ Safety gates:
- Command timeout → stop
- Low battery cutoff
- Sonar-based obstacle stop
- Velocity clamping
Monster.h # High-level interface
monster_core.cpp # Bring-up, main loop, Plain/ROS2 integration
monster_config.h # Geometry, motor IDs, velocity limits, conversions
monster_controller.* # Motion controller (maps v,w -> wheel speeds
monster_motor.* # Dynamixel driver for 4 motors
monster_sensor.* # IMU, sonar, battery, LEDs, button
monster_diagnosis.* # LED heartbeat and error codes
- Arduino IDE or PlatformIO
- OpenCR board packages
- DynamixelWorkbench library
- micro-ROS Arduino library
- Clone this repository:
git clone https://github.com/your-username/monster-robot.git cd monster-robot
Open Monster.h (or a provided .ino sketch) in Arduino IDE.
Select OpenCR (or OpenCM) as the board.
Build and upload.