# Feature: Frame Processing Loop

## Description
Core frame-by-frame processing orchestration that runs the main visual odometry pipeline. Manages the continuous loop of fetching images, computing poses, updating the factor graph, and publishing results. Includes flight state machine management (Processing, Blocked, Recovering, Completed).

## Component APIs Implemented
- `start_processing(flight_id: str) -> None` - Starts the main processing loop in a background thread/task
- `stop_processing(flight_id: str) -> None` - Stops the processing loop gracefully
- `process_frame(flight_id: str, frame_id: int) -> FrameResult` - Processes a single frame through the pipeline

## External Dependencies
- **F05 Image Input Pipeline**: `get_next_image()` - Image source
- **F06 Image Rotation Manager**: `requires_rotation_sweep()` - Pre-processing checks
- **F07 Sequential Visual Odometry**: `compute_relative_pose()` - Motion estimation
- **F09 Metric Refinement**: `align_to_satellite()` - Drift correction
- **F10 Factor Graph Optimizer**: `add_relative_factor()`, `optimize_chunk()` - State estimation
- **F14 Result Manager**: `update_frame_result()` - Saving results

## Internal Methods
- `run_processing_loop(flight_id: str)` - Main loop: while images available, process each frame
- `_process_single_frame(flight_id: str, image: Image) -> FrameResult` - Single frame processing pipeline
- `_check_tracking_status(vo_result: VOResult) -> bool` - Determines if tracking is good or lost
- `_update_flight_status(flight_id: str, status: FlightStatus)` - Updates state machine
- `_get_flight_status(flight_id: str) -> FlightStatus` - Gets current flight status
- `_is_processing_active(flight_id: str) -> bool` - Checks if processing should continue

## Unit Tests
- Test `start_processing` initiates background loop
- Test `stop_processing` gracefully terminates active processing
- Test `process_frame` returns valid FrameResult with pose
- Test flight status transitions: Processing -> Completed on last frame
- Test flight status transitions: Processing -> Blocked on tracking loss
- Test processing stops when `stop_processing` called mid-flight
- Test processing handles empty image queue gracefully
- Test state machine rejects invalid transitions

## Integration Tests
- Test full pipeline: F05 -> F06 -> F07 -> F10 -> F14 flow
- Test processing 10 consecutive frames with good tracking
- Test real-time result publishing to F14/F15
- Test concurrent access to flight status from multiple threads
- Test processing resumes after Blocked -> Processing transition

