libstp
Robotics library for Botball
Loading...
Searching...
No Matches
libstp::localization::Localization Class Reference

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)

Detailed Description

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:

  • The constructor calls start(); the destructor calls stop() and joins.
  • start()/stop() are idempotent and may be called explicitly (tests).

Definition at line 76 of file localization.hpp.

Constructor & Destructor Documentation

◆ Localization() [1/3]

libstp::localization::Localization::Localization ( std::shared_ptr< libstp::odometry::IOdometry > odometry,
LocalizationConfig config = {},
std::optional< libstp::map::WorldMap > tableMap = std::nullopt )

◆ ~Localization()

libstp::localization::Localization::~Localization ( )

◆ Localization() [2/3]

libstp::localization::Localization::Localization ( const Localization & )
delete

◆ Localization() [3/3]

libstp::localization::Localization::Localization ( Localization && )
delete

Member Function Documentation

◆ enableRecording()

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.

◆ getPose()

libstp::foundation::Pose libstp::localization::Localization::getPose ( ) const
nodiscard

Snapshot of the current world pose. Thread-safe.

◆ observe()

void libstp::localization::Localization::observe ( const Observation & obs)

Apply a sigma-weighted pose observation. Infinite-sigma axes are ignored.

◆ operator=() [1/2]

Localization & libstp::localization::Localization::operator= ( const Localization & )
delete

◆ operator=() [2/2]

Localization & libstp::localization::Localization::operator= ( Localization && )
delete

◆ start()

void libstp::localization::Localization::start ( )

Idempotent. The constructor already calls this; tests may re-call.

◆ stop()

void libstp::localization::Localization::stop ( )

Idempotent. Joins the worker thread. The destructor calls this.


The documentation for this class was generated from the following file:
  • /home/runner/work/raccoon-lib/raccoon-lib/modules/libstp-localization/include/localization/localization.hpp