Skip to content

C++ header-only library for synchronizing out-of-order, delayed, and asynchronous measurements in sensor fusion pipelines (e.g., Kalman or Particle Filters).

License

Notifications You must be signed in to change notification settings

brow1633/measurement_manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Measurement Manager CI

Header-only C++ library for managing asynchronous, delayed, and out-of-order measurements in estimation pipelines.

Core Features

  • Delayed or out-of-order measurement handling via buffering
  • Easy integration with existing filters through generic function and state interfaces

Core Concepts

The library revolves around a few key user-defined types and functions:

StateT

This is your custom state type. It can be any C++ struct or class that represents the state of your estimation filter (e.g., position, velocity, orientation).

DurationT

This represents time durations and timestamps and must be a std::chrono::duration.

User-Defined Functions

You provide the logic for how your state behaves:

  1. ResetFn: Resets your filter to a specific prior state.

    using ResetFn = std::function<void(const StateT& /* new_state */)>;
    • Parameters:
      • new_state: The state to which your filter should be set (often includes covariance, etc).
  2. PredictFn: Propagates your filter's state forward by a given duration.

    using PredictFn = std::function<StateT(DurationT /* dt */)>;
    • Parameters:
      • dt: The duration by which to predict the state forward.
    • Returns: The new StateT after prediction.
  3. ApplyFn: Applies a measurement to modify the current state. This function is associated with a specific timestamp when added to the manager.

    using ApplyFn = std::function<bool(const StateT& /* current_state */)>;
    • Parameters:
      • current_state: The state before this measurement is applied. In most applications, this is redundant, as your filter is already at this state.
    • Returns: true if the measurement was successfully applied, false otherwise.

Example Flow

  1. Construct with:

    • reset: ResetFn
    • predict: PredictFn
    • init_state, init_time, and max_buffer_length.
  2. Add measurements with:

    bool add_measurement(DurationT timestamp, ApplyFn apply);
  3. Update state to target time:

    StateT update_to_time(DurationT time);

Algorithm Summary

  1. Find earliest unprocessed measurement.
  2. Reset to latest valid prior state.
  3. Predict and apply queued measurements in order up to target time.
  4. Discard states/measurements outside buffer window.

Getting Started

See the example for a very simple demonstration of the features. You can build and run this example with:

git clone https://github.com/brow1633/measurement_manager.git
mkdir -p measurement_manager/build && cd measurement_manager/build
cmake .. && make
./example

License

MIT License © 2025 Ethan Brown

About

C++ header-only library for synchronizing out-of-order, delayed, and asynchronous measurements in sensor fusion pipelines (e.g., Kalman or Particle Filters).

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published