# Feature: Confidence Assessment

## Description

Assesses tracking confidence from VO and LiteSAM results and determines when tracking is lost. This is the foundation for all recovery decisions - every frame's results pass through confidence assessment to detect degradation.

## Component APIs Implemented

- `check_confidence(vo_result: RelativePose, litesam_result: Optional[AlignmentResult]) -> ConfidenceAssessment`
- `detect_tracking_loss(confidence: ConfidenceAssessment) -> bool`

## External Tools and Services

None - pure computation based on input metrics.

## Internal Methods

| Method | Purpose |
|--------|---------|
| `_compute_vo_confidence(vo_result)` | Calculates confidence from VO inlier count and ratio |
| `_compute_litesam_confidence(litesam_result)` | Calculates confidence from LiteSAM match score |
| `_compute_overall_confidence(vo_conf, litesam_conf)` | Weighted combination of confidence scores |
| `_determine_tracking_status(overall_conf, inlier_count)` | Maps confidence to "good"/"degraded"/"lost" |

## Thresholds

- **Good**: VO inliers > 50, LiteSAM confidence > 0.7
- **Degraded**: VO inliers 20-50
- **Lost**: VO inliers < 20

## Unit Tests

1. **Good tracking metrics** → Returns "good" status with high confidence
2. **Low VO inliers (25)** → Returns "degraded" status
3. **Very low VO inliers (10)** → Returns "lost" status
4. **High VO, low LiteSAM** → Returns appropriate degraded assessment
5. **LiteSAM result None** → Confidence based on VO only
6. **Edge case at threshold boundary (20 inliers)** → Correct status determination

## Integration Tests

1. **Normal flight sequence** → Confidence remains "good" throughout
2. **Low overlap frame** → Confidence drops to "degraded", recovers
3. **Sharp turn sequence** → Confidence drops to "lost", triggers recovery flow

