Search docs...
K

Technical Documentation: Map Editor (Masking)

Architecture

map_editor_list (Light Theme)map_editor_list (Dark Theme)
map_editor_edit (Light Theme)map_editor_edit (Dark Theme)

The Masking Screen utilizes a drawing canvas overlayed on the MapView. It manages a list of Shape objects that are converted into a binary mask for the ROS navigation stack.

Technical Details

  • File Path: lib/screens/mask_screen.dart
  • Data Models:
    • MaskShape: Stores type (Rect/Circle/Poly), origin coordinates, dimensions, and rotation.
  • Coordinate System:
    • Screen Pixels: Where the user touches.
    • Map Data Space: The actual index in the OccupancyGrid.
    • ROS World Space: Transformed meters (Mers) using the map resolution and origin offset.

Implementation Logic

  • Shape Drawing: The MaskPainter class uses CustomPainter to render the user's shapes in real-time.
  • Mask Generation:
    • When saved, the system iterates through every cell in the OccupancyGrid.
    • It performs a "Point-in-Shape" test for each cell.
    • If a cell falls inside a "No-Go" shape, its value is set to 100 (Obstacle).
  • Backend Sync: The final modified OccupancyGrid is sent to the /api/map/mask endpoint, which generates a new .pgm file on the filesystem and reloads the ROS map server.

Performance

  • Tiling: For large maps (4K+), the masking logic utilizes tiling to process sections in parallel, preventing UI freezes during the "Apply" phase.
© 2026 Robotoai. All rights reserved.