initial structure implemented

docs -> _docs
This commit is contained in:
Oleksandr Bezdieniezhnykh
2025-12-01 14:20:56 +02:00
parent 9134c5db06
commit abc26d5c20
360 changed files with 3881 additions and 101 deletions
@@ -0,0 +1,5 @@
from .base import FactorGraphOptimizerBase
from .factor_graph_optimizer import FactorGraphOptimizer
__all__ = ["FactorGraphOptimizerBase", "FactorGraphOptimizer"]
+58
View File
@@ -0,0 +1,58 @@
from abc import ABC, abstractmethod
from typing import Optional
import numpy as np
from models.core import Pose, GPSPoint
from models.results import OptimizationResult, RefinedFrameResult
from models.processing import RelativePose
class FactorGraphOptimizerBase(ABC):
@abstractmethod
async def initialize_graph(self, flight_id: str) -> bool:
pass
@abstractmethod
async def add_odometry_factor(
self,
flight_id: str,
from_frame: int,
to_frame: int,
relative_pose: RelativePose,
) -> bool:
pass
@abstractmethod
async def add_gps_prior(
self,
flight_id: str,
frame_id: int,
gps: GPSPoint,
covariance: np.ndarray,
) -> bool:
pass
@abstractmethod
async def optimize(
self, flight_id: str, max_iterations: int = 100
) -> OptimizationResult:
pass
@abstractmethod
async def get_optimized_poses(
self, flight_id: str
) -> list[RefinedFrameResult]:
pass
@abstractmethod
async def get_pose(
self, flight_id: str, frame_id: int
) -> Optional[Pose]:
pass
@abstractmethod
async def marginalize_old_poses(
self, flight_id: str, keep_last_n: int
) -> bool:
pass
@@ -0,0 +1,51 @@
from typing import Optional
import numpy as np
from .base import FactorGraphOptimizerBase
from models.core import Pose, GPSPoint
from models.results import OptimizationResult, RefinedFrameResult
from models.processing import RelativePose
class FactorGraphOptimizer(FactorGraphOptimizerBase):
async def initialize_graph(self, flight_id: str) -> bool:
raise NotImplementedError
async def add_odometry_factor(
self,
flight_id: str,
from_frame: int,
to_frame: int,
relative_pose: RelativePose,
) -> bool:
raise NotImplementedError
async def add_gps_prior(
self,
flight_id: str,
frame_id: int,
gps: GPSPoint,
covariance: np.ndarray,
) -> bool:
raise NotImplementedError
async def optimize(
self, flight_id: str, max_iterations: int = 100
) -> OptimizationResult:
raise NotImplementedError
async def get_optimized_poses(
self, flight_id: str
) -> list[RefinedFrameResult]:
raise NotImplementedError
async def get_pose(
self, flight_id: str, frame_id: int
) -> Optional[Pose]:
raise NotImplementedError
async def marginalize_old_poses(
self, flight_id: str, keep_last_n: int
) -> bool:
raise NotImplementedError