Header-only C++ library for managing asynchronous, delayed, and out-of-order measurements in estimation pipelines.
- Delayed or out-of-order measurement handling via buffering
- Easy integration with existing filters through generic function and state interfaces
The library revolves around a few key user-defined types and functions:
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).
This represents time durations and timestamps and must be a std::chrono::duration
.
You provide the logic for how your state behaves:
-
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).
- Parameters:
-
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.
- Parameters:
-
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.
- Parameters:
-
Construct with:
reset
:ResetFn
predict
:PredictFn
init_state
,init_time
, andmax_buffer_length
.
-
Add measurements with:
bool add_measurement(DurationT timestamp, ApplyFn apply);
-
Update state to target time:
StateT update_to_time(DurationT time);
- Find earliest unprocessed measurement.
- Reset to latest valid prior state.
- Predict and apply queued measurements in order up to target time.
- Discard states/measurements outside buffer window.
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
MIT License © 2025 Ethan Brown