# Acceptance Test: Multi-Chunk Simultaneous Processing ## Summary Validate system's ability to process multiple chunks simultaneously, matching and merging them asynchronously. ## Linked Acceptance Criteria **AC-4**: Robust to sharp turns (<5% overlap) **AC-5**: Connect route chunks (multiple chunks) ## Preconditions 1. F02.2 Flight Processing Engine running 2. F10 Factor Graph Optimizer with native multi-chunk support (subgraph operations) 3. F11 Failure Recovery Coordinator (pure logic, returns status objects to F02.2) 4. F12 Route Chunk Manager functional (chunk lifecycle: `create_chunk()`, `add_frame_to_chunk()`, `mark_chunk_anchored()`, `merge_chunks()`) 5. F08 Global Place Recognition (chunk semantic matching via `retrieve_candidate_tiles_for_chunk()`) 6. F09 Metric Refinement (chunk LiteSAM matching) 7. Test dataset: Flight with 3 disconnected segments ## Test Description Test system's ability to handle multiple disconnected route segments simultaneously. The system should create chunks proactively, process them independently, and match/merge them asynchronously without blocking frame processing. ## Test Steps ### Step 1: Create Multi-Segment Flight - **Action**: Create flight with 3 disconnected segments: - Segment 1: AD000001-010 (10 frames, sequential) - Segment 2: AD000025-030 (6 frames, no overlap with Segment 1) - Segment 3: AD000050-055 (6 frames, no overlap with Segments 1 or 2) - **Expected Result**: Flight created with all 22 images ### Step 2: Process Segment 1 - **Action**: Process AD000001-010 - **Expected Result**: - Chunk_1 created (frames 1-10) - Sequential VO provides relative factors - Factors added to chunk_1's subgraph - Chunk_1 optimized independently - GPS anchors from LiteSAM matching - Chunk_1 anchored and merged to main trajectory ### Step 3: Detect Discontinuity (Segment 1 → 2) - **Action**: Process AD000025 after AD000010 - **Expected Result**: - Tracking lost detected (large displacement ~2km) - **Chunk_2 created proactively** (immediate, not reactive) - Processing continues immediately in chunk_2 - Chunk_1 remains in factor graph (not deleted) ### Step 4: Process Segment 2 Independently - **Action**: Process AD000025-030 - **Expected Result**: - Frames processed in chunk_2 context - Relative factors added to chunk_2's subgraph - Chunk_2 optimized independently - Chunk_1 and chunk_2 exist simultaneously - Chunk_2 matching attempted asynchronously (background) ### Step 5: Detect Discontinuity (Segment 2 → 3) - **Action**: Process AD000050 after AD000030 - **Expected Result**: - Tracking lost detected again - **Chunk_3 created proactively** - Processing continues in chunk_3 - Chunk_1, chunk_2, chunk_3 all exist simultaneously ### Step 6: Process Segment 3 Independently - **Action**: Process AD000050-055 - **Expected Result**: - Frames processed in chunk_3 context - Chunk_3 optimized independently - All 3 chunks exist simultaneously - Each chunk processed independently ### Step 7: Asynchronous Chunk Matching - **Action**: Background task attempts matching for unanchored chunks - **Expected Result**: - Chunk_2 semantic matching attempted - Chunk_2 LiteSAM matching attempted - Chunk_2 anchored when match found - Chunk_3 semantic matching attempted - Chunk_3 LiteSAM matching attempted - Chunk_3 anchored when match found - Matching happens asynchronously (doesn't block frame processing) ### Step 8: Chunk Merging - **Action**: Merge chunks as they become anchored - **Expected Result**: - Chunk_2 merged to chunk_1 when anchored - Chunk_3 merged to merged trajectory when anchored - Sim(3) transforms applied correctly - Global optimization performed - All chunks merged into single trajectory ### Step 9: Verify Final Trajectory - **Action**: Verify all 22 frames have GPS coordinates - **Expected Result**: - All frames have GPS coordinates - Trajectory globally consistent - No systematic bias between segments - Accuracy: 20/22 < 50m (90.9%) ## Success Criteria **Primary Criterion**: - Multiple chunks created simultaneously - Chunks processed independently - Chunks matched and merged asynchronously - Final trajectory globally consistent **Supporting Criteria**: - Chunk creation is proactive (immediate) - Frame processing continues during chunk matching - Chunk matching doesn't block processing - Sim(3) transforms computed correctly ## Expected Results ``` Multi-Chunk Simultaneous Processing: - Chunk_1: frames 1-10, anchored, merged - Chunk_2: frames 25-30, anchored asynchronously, merged - Chunk_3: frames 50-55, anchored asynchronously, merged - Simultaneous existence: All 3 chunks exist at same time - Independent processing: Each chunk optimized independently - Asynchronous matching: Matching doesn't block frame processing - Final trajectory: Globally consistent - Accuracy: 20/22 < 50m (90.9%) ``` ## Pass/Fail Criteria **TEST PASSES IF**: - Multiple chunks created simultaneously - Chunks processed independently - Chunks matched and merged asynchronously - Final trajectory globally consistent - Accuracy acceptable (≥ 80% < 50m) **TEST FAILS IF**: - Chunks not created simultaneously - Chunk processing blocks frame processing - Chunk matching blocks processing - Merging produces inconsistent trajectory - Final accuracy below threshold ## Architecture Elements **Multi-Chunk Support**: - F10 Factor Graph Optimizer supports multiple chunks via `create_chunk_subgraph()` - Each chunk has own subgraph, optimized independently via `optimize_chunk()` - F12 Route Chunk Manager owns chunk metadata (status, is_active, etc.) **Proactive Chunk Creation**: - F11 triggers chunk creation via `create_chunk_on_tracking_loss()` - F12.create_chunk() creates chunk and calls F10.create_chunk_subgraph() - Processing continues in new chunk immediately (not reactive) **Asynchronous Matching**: - F02.2 manages background task that calls F11.process_unanchored_chunks() - F11 calls F12.get_chunks_for_matching() to find ready chunks - F11.try_chunk_semantic_matching() → F11.try_chunk_litesam_matching() - Matching doesn't block frame processing **Chunk Merging**: - F11.merge_chunk_to_trajectory() coordinates merging - F12.merge_chunks() updates chunk state and calls F10.merge_chunk_subgraphs() - Sim(3) transform accounts for translation, rotation, scale - F10.optimize_global() runs after merging ## Notes - Multiple chunks can exist simultaneously - Chunk processing is independent and non-blocking - Asynchronous matching reduces user input requests - Sim(3) transform critical for scale ambiguity resolution