mirror of
https://github.com/azaion/gps-denied-desktop.git
synced 2026-04-23 05:56:36 +00:00
@@ -13,7 +13,7 @@ class IResultManager(ABC):
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def publish_to_route_api(self, flight_id: str, frame_id: int) -> bool:
|
||||
def publish_waypoint_update(self, flight_id: str, frame_id: int) -> bool:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
@@ -34,14 +34,14 @@ class IResultManager(ABC):
|
||||
### Responsibilities
|
||||
- Manage trajectory results per flight
|
||||
- Track frame refinements and changes
|
||||
- Trigger per-frame Route API updates via G03
|
||||
- Send incremental updates via F14 SSE
|
||||
- Store waypoint updates via F03 Flight Database
|
||||
- Send incremental updates via F15 SSE Event Streamer
|
||||
- Maintain result versioning for audit trail
|
||||
- Convert optimized poses to GPS coordinates
|
||||
|
||||
### Scope
|
||||
- Result state management
|
||||
- Route API integration
|
||||
- Flight Database integration (waypoint storage)
|
||||
- SSE event triggering
|
||||
- Incremental update detection
|
||||
- Result persistence
|
||||
@@ -73,9 +73,9 @@ result: FrameResult:
|
||||
**Output**: `bool` - True if updated
|
||||
|
||||
**Processing Flow**:
|
||||
1. Store result in memory/database
|
||||
2. Call publish_to_route_api()
|
||||
3. Call G14.send_frame_result()
|
||||
1. Store result via F03 Flight Database.save_frame_result()
|
||||
2. Call publish_waypoint_update()
|
||||
3. Call F15 SSE Event Streamer.send_frame_result()
|
||||
4. Update flight statistics
|
||||
|
||||
**Test Cases**:
|
||||
@@ -84,9 +84,9 @@ result: FrameResult:
|
||||
|
||||
---
|
||||
|
||||
### `publish_to_route_api(flight_id: str, frame_id: int) -> bool`
|
||||
### `publish_waypoint_update(flight_id: str, frame_id: int) -> bool`
|
||||
|
||||
**Description**: Sends frame GPS to Route API via G03 client.
|
||||
**Description**: Updates waypoint in Flight Database via F03.
|
||||
|
||||
**Called By**:
|
||||
- Internal (after update_frame_result)
|
||||
@@ -97,17 +97,17 @@ flight_id: str
|
||||
frame_id: int
|
||||
```
|
||||
|
||||
**Output**: `bool` - True if published successfully
|
||||
**Output**: `bool` - True if updated successfully
|
||||
|
||||
**Processing Flow**:
|
||||
1. Get result for frame_id
|
||||
2. Convert to Waypoint format
|
||||
3. Call G03.update_route_waypoint()
|
||||
3. Call F03 Flight Database.update_waypoint()
|
||||
4. Handle errors (retry if transient)
|
||||
|
||||
**Test Cases**:
|
||||
1. Successful publish → Route API updated
|
||||
2. Route API unavailable → logs error, continues
|
||||
1. Successful update → Waypoint stored in database
|
||||
2. Database unavailable → logs error, continues
|
||||
|
||||
---
|
||||
|
||||
@@ -151,11 +151,11 @@ frame_ids: List[int] # Frames with updated poses
|
||||
|
||||
**Processing Flow**:
|
||||
1. For each frame_id:
|
||||
- Get refined pose from F10
|
||||
- Convert to GPS via G12
|
||||
- Update result with refined=True
|
||||
- publish_to_route_api()
|
||||
- Call G14.send_refinement()
|
||||
- Get refined pose from F10 Factor Graph Optimizer → ENU pose
|
||||
- Convert ENU pose to GPS via F13 Coordinate Transformer.enu_to_gps(flight_id, enu_pose)
|
||||
- Update result with refined=True via F03 Flight Database.save_frame_result()
|
||||
- Update waypoint via F03 Flight Database.update_waypoint()
|
||||
- Call F15 SSE Event Streamer.send_refinement()
|
||||
|
||||
**Test Cases**:
|
||||
1. Batch refinement → all frames updated and published
|
||||
@@ -167,7 +167,7 @@ frame_ids: List[int] # Frames with updated poses
|
||||
**Description**: Gets frames changed since timestamp (for incremental updates).
|
||||
|
||||
**Called By**:
|
||||
- F14 SSE Event Streamer (for reconnection replay)
|
||||
- F15 SSE Event Streamer (for reconnection replay)
|
||||
|
||||
**Input**:
|
||||
```python
|
||||
@@ -181,19 +181,49 @@ since: datetime
|
||||
1. Get changes → returns only modified frames
|
||||
2. No changes → returns empty list
|
||||
|
||||
---
|
||||
|
||||
### `update_results_after_chunk_merge(flight_id: str, merged_frames: List[int]) -> bool`
|
||||
|
||||
**Description**: Updates frame results after chunk merging changes frame poses.
|
||||
|
||||
**Called By**:
|
||||
- F11 Failure Recovery Coordinator (after chunk merging)
|
||||
|
||||
**Input**:
|
||||
```python
|
||||
flight_id: str
|
||||
merged_frames: List[int] # Frames whose poses changed due to chunk merge
|
||||
```
|
||||
|
||||
**Output**: `bool` - True if updated successfully
|
||||
|
||||
**Processing Flow**:
|
||||
1. For each frame_id in merged_frames:
|
||||
- Get updated pose from F10 Factor Graph Optimizer.get_trajectory() → ENU pose
|
||||
- Convert ENU pose to GPS via F13 Coordinate Transformer.enu_to_gps(flight_id, enu_pose)
|
||||
- Update frame result via F03 Flight Database.save_frame_result()
|
||||
- Update waypoint via F03 Flight Database.update_waypoint()
|
||||
- Send refinement event via F15 SSE Event Streamer.send_refinement()
|
||||
2. Return True
|
||||
|
||||
**Test Cases**:
|
||||
1. **Chunk merge updates**: All merged frames updated and published
|
||||
2. **GPS accuracy**: Updated GPS matches optimized poses
|
||||
|
||||
## Integration Tests
|
||||
|
||||
### Test 1: Per-Frame Processing
|
||||
1. Process frame 237
|
||||
2. update_frame_result() → stores result
|
||||
3. Verify publish_to_route_api() called
|
||||
4. Verify F14 SSE event sent
|
||||
3. Verify publish_waypoint_update() called (F03.update_waypoint())
|
||||
4. Verify F15 SSE event sent
|
||||
|
||||
### Test 2: Batch Refinement
|
||||
1. Process 100 frames
|
||||
2. Factor graph refines frames 10-50
|
||||
3. mark_refined([10-50]) → updates all
|
||||
4. Verify Route API updated
|
||||
4. Verify Flight Database updated (F03.batch_update_waypoints())
|
||||
5. Verify SSE refinement events sent
|
||||
|
||||
### Test 3: Incremental Updates
|
||||
@@ -207,22 +237,22 @@ since: datetime
|
||||
|
||||
### Performance
|
||||
- **update_frame_result**: < 50ms
|
||||
- **publish_to_route_api**: < 100ms (non-blocking)
|
||||
- **publish_waypoint_update**: < 100ms (non-blocking)
|
||||
- **get_flight_results**: < 200ms for 2000 frames
|
||||
|
||||
### Reliability
|
||||
- Result persistence survives crashes
|
||||
- Guaranteed at-least-once delivery to Route API
|
||||
- Guaranteed at-least-once delivery to Flight Database
|
||||
- Idempotent updates
|
||||
|
||||
## Dependencies
|
||||
|
||||
### Internal Components
|
||||
- G03 Route API Client
|
||||
- F10 Factor Graph Optimizer
|
||||
- F12 Coordinate Transformer
|
||||
- F14 SSE Event Streamer
|
||||
- F17 Database Layer
|
||||
- **F03 Flight Database**: For waypoint and frame result persistence
|
||||
- **F10 Factor Graph Optimizer**: For refined pose retrieval
|
||||
- **F13 Coordinate Transformer**: For ENU to GPS conversion
|
||||
- **F15 SSE Event Streamer**: For real-time result streaming
|
||||
- **F11 Failure Recovery Coordinator**: Triggers chunk merge result updates
|
||||
|
||||
### External Dependencies
|
||||
- None
|
||||
|
||||
Reference in New Issue
Block a user