|
libstp
Robotics library for Botball
|
Thread-safe particle-filter localization service. More...
#include <localization.hpp>
Public Member Functions | |
| Localization (std::shared_ptr< libstp::odometry::IOdometry > odometry, LocalizationConfig config={}, std::optional< libstp::map::WorldMap > tableMap=std::nullopt) | |
| ~Localization () | |
| Localization (const Localization &)=delete | |
| Localization & | operator= (const Localization &)=delete |
| Localization (Localization &&)=delete | |
| Localization & | operator= (Localization &&)=delete |
| libstp::foundation::Pose | getPose () const |
| Snapshot of the current world pose. Thread-safe. | |
| void | observe (const Observation &obs) |
| Apply a sigma-weighted pose observation. Infinite-sigma axes are ignored. | |
| void | start () |
| Idempotent. The constructor already calls this; tests may re-call. | |
| void | stop () |
| Idempotent. Joins the worker thread. The destructor calls this. | |
| bool | enableRecording (RecorderConfig cfg) |
Thread-safe particle-filter localization service.
Owns a background thread that polls the supplied IOdometry at a fixed rate, propagates a particle cloud from the per-tick odometry delta, and exposes the estimated world pose via getPose(). observe() lets resync sites inject sigma-weighted absolute pose observations.
This Phase-6 increment keeps the existing IO contract but replaces the pass-through state with a low-variance-resampled particle filter. Explicit pose observations become functional; sensor/map likelihoods can plug into the same particle representation later.
Lifecycle:
Definition at line 76 of file localization.hpp.
| libstp::localization::Localization::Localization | ( | std::shared_ptr< libstp::odometry::IOdometry > | odometry, |
| LocalizationConfig | config = {}, | ||
| std::optional< libstp::map::WorldMap > | tableMap = std::nullopt ) |
| libstp::localization::Localization::~Localization | ( | ) |
|
delete |
|
delete |
| bool libstp::localization::Localization::enableRecording | ( | RecorderConfig | cfg | ) |
Enable post-run JSONL recording. Constructs the recorder and starts its writer thread; opening failures leave Localization fully functional but cause this method to return false. Idempotent: a second call replaces the previous recorder. Thread-safe.
|
nodiscard |
Snapshot of the current world pose. Thread-safe.
| void libstp::localization::Localization::observe | ( | const Observation & | obs | ) |
Apply a sigma-weighted pose observation. Infinite-sigma axes are ignored.
|
delete |
|
delete |
| void libstp::localization::Localization::start | ( | ) |
Idempotent. The constructor already calls this; tests may re-call.
| void libstp::localization::Localization::stop | ( | ) |
Idempotent. Joins the worker thread. The destructor calls this.