spec cleanup

This commit is contained in:
Oleksandr Bezdieniezhnykh
2025-11-30 19:08:40 +02:00
parent b12f37ab01
commit 3d034e27ee
10 changed files with 270 additions and 152 deletions
@@ -61,8 +61,8 @@ class IFactorGraphOptimizer(ABC):
pass
@abstractmethod
def merge_chunk_subgraphs(self, flight_id: str, source_chunk_id: str, target_chunk_id: str, transform: Sim3Transform) -> bool:
"""Merges source_chunk INTO target_chunk. Source chunk subgraph is merged into target."""
def merge_chunk_subgraphs(self, flight_id: str, new_chunk_id: str, main_chunk_id: str, transform: Sim3Transform) -> bool:
"""Merges new_chunk INTO main_chunk. Extends main_chunk with new_chunk's subgraph."""
pass
@abstractmethod
@@ -523,18 +523,18 @@ bool: True if anchor added
---
### `merge_chunks(chunk_id_1: str, chunk_id_2: str, transform: Sim3Transform) -> bool`
### `merge_chunk_subgraphs(flight_id: str, new_chunk_id: str, main_chunk_id: str, transform: Sim3Transform) -> bool`
**Description**: Merges two chunks using Sim(3) similarity transformation.
**Description**: Merges new_chunk INTO main_chunk using Sim(3) similarity transformation. Extends main_chunk with new_chunk's frames.
**Called By**:
- F11 Failure Recovery Coordinator (after chunk matching)
- Background optimization task
- F12 Route Chunk Manager (via merge_chunks method)
**Input**:
```python
chunk_id_1: str # Source chunk (typically newer)
chunk_id_2: str # Target chunk (typically older, merged into)
flight_id: str # Flight identifier
new_chunk_id: str # New chunk being merged (source, typically newer/recently anchored)
main_chunk_id: str # Main chunk being extended (destination, typically older/established)
transform: Sim3Transform:
translation: np.ndarray # (3,)
rotation: np.ndarray # (3, 3) or quaternion
@@ -547,11 +547,11 @@ bool: True if merge successful
```
**Processing Flow**:
1. Verify both chunks exist and chunk_id_1 is anchored
2. Apply Sim(3) transform to all poses in chunk_id_1
3. Merge chunk_id_1's subgraph into chunk_id_2's subgraph
4. Update frame-to-chunk mapping
5. Mark chunk_id_1 as merged
1. Verify both chunks exist and new_chunk is anchored
2. Apply Sim(3) transform to all poses in new_chunk
3. Merge new_chunk's subgraph into main_chunk's subgraph
4. Update frame-to-chunk mapping (new_chunk frames now belong to main_chunk)
5. Mark new_chunk subgraph as merged (F12 handles state updates)
6. Optimize merged graph globally
**Sim(3) Transformation**:
@@ -560,7 +560,7 @@ bool: True if merge successful
- Preserves internal consistency of both chunks
**Test Cases**:
1. **Merge anchored chunks**: Chunks merged successfully
1. **Merge anchored chunks**: new_chunk merged into main_chunk successfully
2. **Merge unanchored chunk**: Returns False
3. **Global consistency**: Merged trajectory is globally consistent