autobaud-core: Rust library for zero-allocation serial baud and protocol detection
Detects baud rates and protocols like MAVLink and NMEA without user intervention.
Integrating unknown serial hardware—such as a custom 1D LiDAR, decades-old telemetry radios, or mysterious motor controllers—into a ROS2 companion computer often devolves into manual baud-rate trial and error. Existing autobaud solutions rely on human-readable ASCII, making them useless for binary streams. To solve this, developer Tanmayhere built autobaud-core, a cross-platform Rust library and CLI daemon that programmatically detects baud rates and protocols without user interaction. The tool avoids brute-force cycling through possible rates by employing a two-tier strategy: first, hardware framing validation using Linux’s termios PARMRK flags (via the nix crate) to instantly reject incorrect baud rates at the electrical level; then, zero-allocation heuristics that scan the raw byte buffer for protocol-specific “magic” bytes—0xFD for MAVLink v2, 0x59 0x59 for TFmini LiDAR, and $GPGGA for NMEA.
Beyond the CLI, Tanmayhere envisions a ROS2 node called “Dynamic Serial Bridge” that would autobaud the connection, detect the protocol, and immediately begin publishing raw binary data on a dedicated topic for downstream parsing. This would enable seamless, plug-and-play integration of legacy hardware into modern robotics stacks. The tool is extensible, and the author invites the community to suggest additional raw serial protocols common in ROS ecosystems. Current candidates include MAVLink, NMEA, and TFmini, but protocols used by motor controllers, GPS modules, and industrial sensors could also be added. autobaud-core represents a practical step toward reducing friction when adding new physical devices to a ROS2 system.
- Two-tier detection: hardware framing validation via termios PARMRK then zero-allocation byte matching for protocol magic bytes.
- Supports MAVLink v2 (0xFD), TFmini LiDAR (0x59 0x59), NMEA ($GPGGA), and is extensible to other binary protocols.
- Planned ROS2 integration as a 'Dynamic Serial Bridge' node to autobaud, detect protocol, and publish raw data automatically.
Why It Matters
Eliminates manual baud-rate hunting, enabling seamless integration of legacy hardware into modern ROS2 robotics systems.