Technical Documentation: Mapping Screen
Architecture


This screen manages the state of the robot's SLAM engine. It relies heavily on the OccupancyGrid data type and Lidar scan feedback.
Technical Details
- File Path: lib/screens/mapping_screen.dart
- ROS Integration:
- Subscriber: /map (Type: nav_msgs/OccupancyGrid) - Receives the live SLAM map.
- Subscriber: /scan (Type: sensor_msgs/LaserScan) - Receives Lidar data for visualization.
- Services: /save_map, /start_mapping, /stop_mapping.
- Database Integration: Uses ros.storeCurrentMapToDb to trigger the backend conversion of the ROS OccupancyGrid into the permanent .yaml and .pgm formats.
Map Rendering
- Grid Processing: The MapView widget converts the OccupancyGrid (values 0 to 100) into grayscale pixels:
- 0: White (Free Space)
- 100: Black (Obstacle)
- -1: Grey (Unknown)
- Coordinate Sync: Ensures map coordinates are aligned with the Odom frame so the robot's path is drawn correctly over the scanned area.
SLAM Control
- Lifecycle Management: Commands are sent via ROS Services to the backend bridge, which manages the launch/shutdown of SLAM nodes on the robot's Linux OS (Ubuntu/ROS 2).