improving components consistency

This commit is contained in:
Oleksandr Bezdieniezhnykh
2025-11-30 08:44:28 +02:00
parent 310cf78ee7
commit 700d00a1bc
16 changed files with 186 additions and 102 deletions
@@ -137,19 +137,20 @@ class IFlightProcessor(ABC):
- **Background task management for each flight**
- **Event subscription for F11 recovery events**
### Event-Based Communication
### Direct Call Communication
F02 subscribes to events from F11 Failure Recovery Coordinator instead of F11 directly calling F02's status update methods. This decouples recovery logic from flight state management.
F02 calls F11 methods directly and F11 returns results synchronously. This provides clear data flow and simpler debugging compared to event-based patterns.
**Events Subscribed (from F11)**:
- `RecoveryStarted`: Update flight status to "recovering"
- `RecoverySucceeded`: Update flight status to "processing", resume processing loop
- `RecoveryFailed`: Update flight status to "blocked", blocked=True
- `UserInputNeeded`: Update flight status to "blocked", blocked=True, await user fix
- `UserFixApplied`: Update flight status to "processing", resume processing loop
- `ChunkCreated`: Log chunk creation, update internal tracking
- `ChunkAnchored`: Log chunk anchor, update statistics
- `ChunkMerged`: Trigger result updates via F14
**F02 calls F11 for recovery operations**:
- `F11.start_search()` → returns `SearchSession` (F02 updates status to "recovering")
- `F11.try_current_grid()` → returns `Optional[AlignmentResult]`
- `F11.mark_found()` → F02 updates status to "processing"
- `F11.create_user_input_request()` → F02 updates status to "blocked"
- `F11.apply_user_anchor()` → returns success, F02 updates status to "processing"
- `F11.create_chunk_on_tracking_loss()` → returns `ChunkHandle`
- `F11.try_chunk_semantic_matching()` → returns candidates
- `F11.try_chunk_litesam_matching()` → returns `Optional[ChunkAlignmentResult]`
- `F11.merge_chunk_to_trajectory()` → F02 then calls F14.update_results_after_chunk_merge()
### Background Task Management
@@ -755,18 +756,22 @@ FrameResult:
- F06.try_rotation_steps() → establish heading
5. Else:
- Pre-rotate image to current heading
6. Compute relative pose via F07 Sequential VO (chunk-aware)
6. Compute relative pose via F07 Sequential VO (chunk-agnostic - returns RelativePose)
7. Add frame to chunk via F12 Route Chunk Manager.add_frame_to_chunk() (F12 handles F10 internally)
9. Get satellite tile from F04 Satellite Data Manager
8. Get satellite tile from F04 Satellite Data Manager
9. Get tile_bounds via F04.compute_tile_bounds(tile_coords)
10. Align to satellite via F09 Metric Refinement (with tile_bounds)
11. If alignment successful:
- Add chunk anchor via F10.add_chunk_anchor()
- Update heading via F06
12. Optimize chunk locally via F10.optimize_chunk()
13. Transform to GPS via F13 Coordinate Transformer
14. Update waypoint via update_waypoint()
15. Publish result via F14 Result Manager → F15 SSE Event Streamer
16. Periodically attempt global optimization and chunk merging
- Update heading via F06.update_heading()
- **Persist heading**: Call F03.save_heading(flight_id, frame_id, heading, timestamp)
12. **Add altitude prior**: Call F10.add_altitude_prior(flight_id, frame_id, altitude, covariance) for scale resolution
13. Optimize chunk locally via F10.optimize_chunk()
14. Get optimized pose from F10.get_trajectory(flight_id)
15. Transform ENU to GPS via F13.enu_to_gps(flight_id, enu_point)
16. Update waypoint via update_waypoint()
17. Publish result via F14.update_frame_result() → F15 SSE Event Streamer
18. Periodically attempt global optimization and chunk merging
**Error Conditions**:
- `TrackingLossError`: Triggers handle_tracking_loss()