mirror of
https://github.com/azaion/gps-denied-desktop.git
synced 2026-04-22 22:46:36 +00:00
component assesment and fixes done
This commit is contained in:
@@ -10,6 +10,12 @@
|
||||
class IResultManager(ABC):
|
||||
@abstractmethod
|
||||
def update_frame_result(self, flight_id: str, frame_id: int, result: FrameResult) -> bool:
|
||||
"""
|
||||
Atomic update:
|
||||
1. Saves result to frame_results table.
|
||||
2. Updates waypoint in waypoints table.
|
||||
3. All within a single transaction via F03.
|
||||
"""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
@@ -36,13 +42,8 @@ class IResultManager(ABC):
|
||||
## Component Description
|
||||
|
||||
### Responsibilities
|
||||
- Manage trajectory results per flight
|
||||
- Track frame refinements and changes
|
||||
- Store waypoint updates via F03 Flight Database
|
||||
- Send incremental updates via F15 SSE Event Streamer
|
||||
- Maintain result versioning for audit trail
|
||||
|
||||
**Note**: F14 receives GPS coordinates directly from the caller (F02). F14 does NOT call F10 Factor Graph Optimizer or F13 Coordinate Transformer for pose retrieval/conversion. This ensures unidirectional data flow: F02 → F14 → F03/F15.
|
||||
- Result consistency and publishing.
|
||||
- **Atomic Updates**: Ensures consistency between normalized `waypoints` and denormalized `frame_results` via transaction requests to F03.
|
||||
|
||||
### Scope
|
||||
- Result state management
|
||||
@@ -55,7 +56,7 @@ class IResultManager(ABC):
|
||||
|
||||
### `update_frame_result(flight_id: str, frame_id: int, result: FrameResult) -> bool`
|
||||
|
||||
**Description**: Updates result for a processed frame.
|
||||
**Description**: Persists and publishes the result of a processed frame.
|
||||
|
||||
**Called By**:
|
||||
- Main processing loop (after each frame)
|
||||
@@ -78,10 +79,12 @@ result: FrameResult:
|
||||
**Output**: `bool` - True if updated
|
||||
|
||||
**Processing Flow**:
|
||||
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
|
||||
1. Construct DB transaction:
|
||||
- Insert/Update `frame_results`.
|
||||
- Update `waypoints` (latest position).
|
||||
2. Call `F03.execute_transaction()`.
|
||||
3. If success: call `F15.send_frame_result()`.
|
||||
4. Update flight statistics.
|
||||
|
||||
**Test Cases**:
|
||||
1. New frame result → stored and published
|
||||
@@ -91,7 +94,7 @@ result: FrameResult:
|
||||
|
||||
### `publish_waypoint_update(flight_id: str, frame_id: int) -> bool`
|
||||
|
||||
**Description**: Updates waypoint in Flight Database via F03.
|
||||
**Description**: Specifically triggers an update for the waypoint visualization.
|
||||
|
||||
**Called By**:
|
||||
- Internal (after update_frame_result)
|
||||
@@ -105,10 +108,9 @@ frame_id: int
|
||||
**Output**: `bool` - True if updated successfully
|
||||
|
||||
**Processing Flow**:
|
||||
1. Get result for frame_id
|
||||
2. Convert to Waypoint format
|
||||
3. Call F03 Flight Database.update_waypoint()
|
||||
4. Handle errors (retry if transient)
|
||||
1. Fetch latest data.
|
||||
2. Call `F15.send_frame_result()` (or a specific lightweight event).
|
||||
3. Handle errors (retry if transient)
|
||||
|
||||
**Test Cases**:
|
||||
1. Successful update → Waypoint stored in database
|
||||
@@ -141,7 +143,7 @@ FlightResults:
|
||||
|
||||
### `mark_refined(flight_id: str, frame_ids: List[int]) -> bool`
|
||||
|
||||
**Description**: Marks frames as refined after batch optimization.
|
||||
**Description**: Updates results for frames that have been retrospectively improved (e.g., after loop closure or chunk merge).
|
||||
|
||||
**Called By**:
|
||||
- F10 Factor Graph (after asynchronous refinement)
|
||||
@@ -154,16 +156,16 @@ frame_ids: List[int] # Frames with updated poses
|
||||
|
||||
**Output**: `bool`
|
||||
|
||||
**Note**: F14 does NOT call F10 or F13. The caller (F02) performs the following steps before calling mark_refined():
|
||||
1. F02 gets refined poses from F10.get_trajectory(flight_id)
|
||||
2. F02 converts ENU to GPS via F13.enu_to_gps(flight_id, enu_tuple)
|
||||
3. F02 calls F14.mark_refined() with the GPS-converted results
|
||||
**Note**: F14 does NOT call F10 or F13. The caller (F02.2) performs the following steps before calling mark_refined():
|
||||
1. F02.2 gets refined poses from F10.get_trajectory(flight_id)
|
||||
2. F02.2 converts ENU to GPS via F13.enu_to_gps(flight_id, enu_tuple)
|
||||
3. F02.2 calls F14.mark_refined() with the GPS-converted results
|
||||
|
||||
**Processing Flow**:
|
||||
1. For each frame_id in frame_ids:
|
||||
- Receive GPS coordinates from caller (already converted)
|
||||
- Update result with refined=True via F03 Flight Database.save_frame_result()
|
||||
- Update waypoint via F03 Flight Database.update_waypoint()
|
||||
- Update result with refined=True via F03 Flight Database (part of transaction)
|
||||
- Update waypoint via F03 Flight Database (part of transaction)
|
||||
- Call F15 SSE Event Streamer.send_refinement()
|
||||
|
||||
**Test Cases**:
|
||||
@@ -194,11 +196,11 @@ since: datetime
|
||||
|
||||
### `update_results_after_chunk_merge(flight_id: str, merged_frames: List[int]) -> bool`
|
||||
|
||||
**Description**: Updates frame results after chunk merging changes frame poses.
|
||||
**Description**: Handling specific to chunk merging events.
|
||||
|
||||
**Triggered By**:
|
||||
- `ChunkMerged` event from F11 (F14 subscribes to this event)
|
||||
- Alternative: F02 Flight Processor can coordinate this call after receiving ChunkMerged event
|
||||
- Alternative: F02.2 Flight Processing Engine can coordinate this call after receiving ChunkMerged event
|
||||
|
||||
**Input**:
|
||||
```python
|
||||
@@ -208,19 +210,9 @@ merged_frames: List[int] # Frames whose poses changed due to chunk merge
|
||||
|
||||
**Output**: `bool` - True if updated successfully
|
||||
|
||||
**Note**: F14 does NOT call F10 or F13. The caller (F02) performs these steps before calling update_results_after_chunk_merge():
|
||||
1. F02 receives ChunkMerged event from F11 with merged_frames list
|
||||
2. F02 gets updated poses from F10.get_trajectory(flight_id)
|
||||
3. F02 converts ENU to GPS via F13.enu_to_gps(flight_id, enu_tuple) for each frame
|
||||
4. F02 calls F14.update_results_after_chunk_merge() with GPS-converted results
|
||||
|
||||
**Processing Flow**:
|
||||
1. For each frame_id in merged_frames:
|
||||
- Receive GPS coordinates from caller (already converted)
|
||||
- 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
|
||||
1. Similar to `mark_refined` but triggered by `ChunkMerged` event context.
|
||||
2. Ensures all frames in the merged chunk are updated to the global coordinate system.
|
||||
|
||||
**Test Cases**:
|
||||
1. **Chunk merge updates**: All merged frames updated and published
|
||||
@@ -263,10 +255,10 @@ merged_frames: List[int] # Frames whose poses changed due to chunk merge
|
||||
## Dependencies
|
||||
|
||||
### Internal Components
|
||||
- **F03 Flight Database**: For waypoint and frame result persistence
|
||||
- **F15 SSE Event Streamer**: For real-time result streaming
|
||||
- **F03 Flight Database**: Must support transactional updates.
|
||||
- **F15 SSE Event Streamer**: For real-time result streaming.
|
||||
|
||||
**Note**: F14 does NOT depend on F10, F13, or F11. The caller (F02) coordinates with those components and provides GPS-converted results to F14. This ensures unidirectional data flow and eliminates circular dependencies.
|
||||
**Note**: F14 does NOT depend on F10, F13, or F11. The caller (F02.2) coordinates with those components and provides GPS-converted results to F14. This ensures unidirectional data flow and eliminates circular dependencies.
|
||||
|
||||
### External Dependencies
|
||||
- None
|
||||
@@ -308,4 +300,3 @@ class FlightResults(BaseModel):
|
||||
frames: List[FrameResult]
|
||||
statistics: FlightStatistics
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user