The problem
Connecting custom hardware (a gripper, a sensor board, a microcontroller project) to ROS 2 usually means writing and maintaining a C++ hardware-interface plugin for every device.
What I built
hid_ros2 is one reusable ros2_control hardware interface for any device that speaks the standard USB-HID protocol:
- Configuration, not code: a YAML file describes the device's vendor/product IDs, which bytes of each HID report map to which joints or sensors, and the scaling.
- Plug and play: devices are found by ID and can be unplugged and reconnected while the system runs.
- Real-time friendly: kernel-level USB-HID access through
hidapi, pre-allocated memory, and polling rates up to 1 kHz on compatible hardware (about 1.2 ms typical latency in my benchmarks). - Standard ROS 2: works with the usual
ros2_controlcontrollers.
Outcome
- Presented at ROSCon FR 2025, where three custom devices were integrated live during the session.
- Open source (Apache 2.0): github.com/adnan-saood/hid_ros2. The full write-up is on the blog.
Stack: C++, ROS 2, ros2_control, hidapi, USB-HID, embedded firmware (Teensy, ESP32, STM32).