Technical Documentation: System Alarms
Architecture


The Alarms system unifies real-time ROS bitcodes with historical data from a relational database. It relies on the RosProvider for live state and DashboardService for historical persistence.
Technical Details
- File Path: lib/screens/alarm_screen.dart
- Data Model: _AlarmRow (tracks Source, Robot, Wheel, Alarm Bit, and Time).
- Update Frequency: Live ROS data (immediate); Backend history (30s polling).
Error Mapping Logic
- Bitwise Decoding: ROS publishes motor alarms as 32-bit integers. The UI uses the motorAlarmDescriptionMap to perform bitwise & operations and extract individual fault labels.
- Classification Engine:
- SOFTWARE: Bits 0, 1, 2, 19, etc.
- COMMUNICATION: Bits 10, 27, 30.
- HARDWARE: All other bits.
Data Integration
- Source Merging:
- liveRows: Derived from ros.leftWheelAlarm and ros.rightWheelAlarm bitmasks.
- historyRows: Fetched from the /api/dashboard/history/motor_alarms endpoint.
- Pagination: Uses local state to manage large history sets, with configurable rows-per-page (10, 25, 50).
UI Elements
- Table: Built with standard DataTable for data-rich representation.
- Filtering: State-based filtering for wheel type and rangeHours (24h, 7d, 30d).