mirror of
https://github.com/azaion/gps-denied-onboard.git
synced 2026-04-23 02:06:36 +00:00
add chunking
This commit is contained in:
@@ -0,0 +1,172 @@
|
||||
# Configuration Manager
|
||||
|
||||
## Interface Definition
|
||||
|
||||
**Interface Name**: `IConfigurationManager`
|
||||
|
||||
### Interface Methods
|
||||
|
||||
```python
|
||||
class IConfigurationManager(ABC):
|
||||
@abstractmethod
|
||||
def load_config(self, config_path: str) -> SystemConfig:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def get_camera_params(self, camera_id: Optional[str] = None) -> CameraParameters:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def validate_config(self, config: SystemConfig) -> ValidationResult:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def get_flight_config(self, flight_id: str) -> FlightConfig:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def update_config(self, section: str, key: str, value: Any) -> bool:
|
||||
pass
|
||||
```
|
||||
|
||||
## Component Description
|
||||
|
||||
### Responsibilities
|
||||
- Load system configuration from files/environment
|
||||
- Provide camera parameters (focal length, sensor size, resolution)
|
||||
- Manage flight-specific configurations
|
||||
- Validate configuration integrity
|
||||
- Support configuration updates at runtime
|
||||
|
||||
### Scope
|
||||
- System-wide configuration
|
||||
- Camera parameter management
|
||||
- Operational area bounds
|
||||
- Model paths and settings
|
||||
- Database connections
|
||||
- API endpoints
|
||||
|
||||
## API Methods
|
||||
|
||||
### `load_config(config_path: str) -> SystemConfig`
|
||||
|
||||
**Description**: Loads system configuration.
|
||||
|
||||
**Called By**: System startup
|
||||
|
||||
**Input**: `config_path: str` - Path to config file (YAML/JSON)
|
||||
|
||||
**Output**: `SystemConfig` - Complete configuration
|
||||
|
||||
**Test Cases**:
|
||||
1. Load valid config → succeeds
|
||||
2. Missing file → uses defaults
|
||||
3. Invalid config → raises error
|
||||
|
||||
---
|
||||
|
||||
### `get_camera_params(camera_id: Optional[str] = None) -> CameraParameters`
|
||||
|
||||
**Description**: Gets camera parameters.
|
||||
|
||||
**Called By**: All processing components
|
||||
|
||||
**Output**:
|
||||
```python
|
||||
CameraParameters:
|
||||
focal_length: float
|
||||
sensor_width: float
|
||||
sensor_height: float
|
||||
resolution_width: int
|
||||
resolution_height: int
|
||||
principal_point: Tuple[float, float]
|
||||
distortion_coefficients: List[float]
|
||||
```
|
||||
|
||||
**Test Cases**:
|
||||
1. Get default camera → returns params
|
||||
2. Get specific camera → returns params
|
||||
|
||||
---
|
||||
|
||||
### `validate_config(config: SystemConfig) -> ValidationResult`
|
||||
|
||||
**Description**: Validates configuration.
|
||||
|
||||
**Called By**: After load_config
|
||||
|
||||
**Validation Rules**:
|
||||
- Camera parameters sensible
|
||||
- Paths exist
|
||||
- Operational area valid
|
||||
- Database connection string valid
|
||||
|
||||
**Test Cases**:
|
||||
1. Valid config → passes
|
||||
2. Invalid focal length → fails
|
||||
|
||||
---
|
||||
|
||||
### `get_flight_config(flight_id: str) -> FlightConfig`
|
||||
|
||||
**Description**: Gets flight-specific configuration.
|
||||
|
||||
**Called By**: F02 Flight Manager
|
||||
|
||||
**Output**:
|
||||
```python
|
||||
FlightConfig:
|
||||
camera_params: CameraParameters
|
||||
altitude: float
|
||||
operational_area: OperationalArea
|
||||
```
|
||||
|
||||
**Test Cases**:
|
||||
1. Get flight config → returns params
|
||||
|
||||
---
|
||||
|
||||
### `update_config(section: str, key: str, value: Any) -> bool`
|
||||
|
||||
**Description**: Updates config at runtime.
|
||||
|
||||
**Called By**: Admin tools
|
||||
|
||||
**Test Cases**:
|
||||
1. Update value → succeeds
|
||||
2. Invalid key → fails
|
||||
|
||||
## Data Models
|
||||
|
||||
### SystemConfig
|
||||
```python
|
||||
class SystemConfig(BaseModel):
|
||||
camera: CameraParameters
|
||||
operational_area: OperationalArea
|
||||
models: ModelPaths
|
||||
database: DatabaseConfig
|
||||
api: APIConfig
|
||||
```
|
||||
|
||||
### CameraParameters
|
||||
```python
|
||||
class CameraParameters(BaseModel):
|
||||
focal_length: float # mm
|
||||
sensor_width: float # mm
|
||||
sensor_height: float # mm
|
||||
resolution_width: int
|
||||
resolution_height: int
|
||||
principal_point: Tuple[float, float]
|
||||
distortion_coefficients: List[float]
|
||||
```
|
||||
|
||||
### OperationalArea
|
||||
```python
|
||||
class OperationalArea(BaseModel):
|
||||
name: str = "Eastern Ukraine"
|
||||
min_lat: float = 45.0
|
||||
max_lat: float = 52.0
|
||||
min_lon: float = 22.0
|
||||
max_lon: float = 40.0
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user