Technical Documentation: Route Editor
Architecture


The Route Editor is a graph-based design system implemented with a custom Canvas engine. It manages a complex state of interrelated nodes and edges.
Technical Details
- File Path: lib/screens/route_editor_screen.dart
- State Management: RouteEditorProvider manages the graph data structure.
- Output Format: Generates a standardized JSON "Route Graph" compatible with the robot's trajectory-following service.
Core Components
- Nodes: Objects representing $(x, y)$ coordinates in the Map Frame. They serve as graph vertices.
- Edges: Objects linking two Node IDs. They represent traversal paths and store metadata like directionality (Single/Dual) and speed limits.
- Actions: Optional payloads attached to nodes, executed by the robot's state machine when the node is reached.
Interaction Engine
- Canvas Math: Implements coordinate transformations between the Offset (UI pixels) and Point (Map Meters). It uses a MapScale factor derived from the underlying map's resolution.
- Snapping Logic: When a user drags a node near another, the engine calculates the Euclidean distance and "snaps" to existing vertices if within a 10px threshold for clean graph building.
- Intersection Detection: Prevents creating edges that cross restricted "No-Go" zones predefined in the Map Editor.
Performance
Uses RepaintBoundary around the canvas and its background map to ensure that dragging a node doesn't re-render the entire 4K map image, maintaining 60 FPS performance.