Technical Documentation: Settings - ROS Topics Explorer
Architecture


The Topics Explorer is a real-time introspection tool powered by the RosProvider. It acts as a lightweight version of the ros2 topic list and ros2 topic echo CLI tools.
Technical Details
- File Path: lib/screens/settings_screen.dart (ROS Topics Tab)
- Data Source: Socket.IO stream of ROS 2 metadata.
- Model: RosTopic (stores name, type, and current frequency).
Implementation Logic
- Discovery: The backend bridge periodically calls ros2 node list and parses the output into a JSON topic map.
- Dynamic Subscription:
- When a user selects a topic, the frontend sends a subscribe_topic event to the backend.
- The backend then attaches a dynamic subscriber to that specific topic and pipes the JSON-serialized messages over the WebSocket.
- Rate Calculation: The UI calculates the "Hz" by measuring the time interval between incoming messages on the active subscription.
Data Representation
- JSON Viewer: Deeply nested messages are rendered using a searchable, expandable JSON tree view.
- Filtering: Includes a live-filter bar to search specifically for topics containing certain keywords (e.g., cmd, nav, sensor).