Technical Documentation: Diagnostics Screen
Architecture


The Diagnostics module utilizes the RosProvider and AppStatusProvider to unify disparate data streams from ROS 2 and the Go Backend into a centralized UI. It employs a responsive grid layout that adapts to various screen aspect ratios.
Technical Details
- File Path: lib/screens/diagnostics_screen.dart
- Data Sources:
- REST API: Fetches static system info and historical stats from /api/dashboard/stats.
- Socket.IO: Receives real-time telemetry updates.
- ROS 2: Listens to /battery_status, /robot_pose, and /nav_status topics.
- Animation: Uses an AnimationController for the connectivity "pulse" effect, reflecting the current WebSocket heartbeat.
Data Integration
- Battery Tracking: Logic in DashboardService calculates estimated remaining runtime based on current dishcharge rates.
- Connectivity: Status is derived from rosProvider.isConnected state, which monitors the health of the ROS bridge.
Performance Optimization
- Lazy Loading: Map tiles and heavy charts are only initialized when the component enters the viewport.
- Stream Throttling: Incoming telemetry data (pose/battery) is throttled to 5Hz for the UI to prevent excessive re-renders while maintaining smooth movement.