Implementation of the Repredictor for fusing measurements with variable delays.
A standard state-space system model is assumed for the repredictor with system inputs and measurements, generated from the system state vector. The inputs and measurements may be delayed with varying durations (an older measurement may become available after a newer one). A typical use-case scenario is when you have one "fast" but imprecise sensor and one "slow" but precise sensor and you want to use them both to get a good prediction (eg. height from the Garmin LiDAR, which comes at 100Hz, and position from a SLAM, which comes at 10Hz with a long delay). If the slow sensor is significantly slower than the fast one, fusing its measurement at the time it arrives without taking into account the sensor's delay may significantly bias your latest estimate.
To accomodate this, the Repredictor keeps a buffer of N last inputs and measurements (N is specified in the constructor). This buffer is then used to re-predict the desired state to a specific time, as requested by the user. Note that the re-prediction is evaluated in a lazy manner only when the user requests it, so it goes through the whole history buffer every time a prediction is requested.
The Repredictor utilizes a fusion Model (specified as the template parameter), which should implement the predict() and correct() methods. This Model is used for fusing the system inputs and measurements as well as for predictions. Typically, this Model will be some kind of a Kalman Filter (LKF, UKF etc.).
Note
The Model should be able to accomodate predictions with varying time steps in order for the Repredictor to work correctly (see eg. the varstepLKF class).
Template Parameters
Model
the prediction and correction model (eg. a Kalman Filter).
disable_reprediction
if true, reprediction is disabled and the class will act like a dumb LKF (for evaluation purposes).
Adds one system input to the history buffer, removing the oldest element in the buffer if it is full.
Parameters
u
The system input vector to be added.
stamp
Time stamp of the input vector and covariance matrix.
model
Optional pointer to a specific Model to be used with this input (eg. mapping it to different states). If it equals to nullptr, the default model specified in the constructor will be used.
Note
The system input vector will not be added if it is older than the oldest element in the history buffer.
Adds one system input to the history buffer, removing the oldest element in the buffer if it is full.
Parameters
u
The system input vector to be added.
stamp
Time stamp of the input vector and covariance matrix.
model
Optional pointer to a specific Model to be used with this input (eg. mapping it to different states). If it equals to nullptr, the default model specified in the constructor will be used.
Note
This is the variant of the method when reprediction is disabled and will function like a dumb LKF.
Adds one system input to the history buffer, removing the oldest element in the buffer if it is full.
Parameters
u
The system input vector to be added.
Q
The process noise covariance matrix.
stamp
Time stamp of the input vector and covariance matrix.
model
Optional pointer to a specific Model to be used with this input (eg. mapping it to different states). If it equals to nullptr, the default model specified in the constructor will be used.
Note
The system input vector will not be added if it is older than the oldest element in the history buffer.
Adds one system input to the history buffer, removing the oldest element in the buffer if it is full.
Parameters
u
The system input vector to be added.
Q
The process noise covariance matrix.
stamp
Time stamp of the input vector and covariance matrix.
model
Optional pointer to a specific Model to be used with this input (eg. mapping it to different states). If it equals to nullptr, the default model specified in the constructor will be used.
Note
This is the variant of the method when reprediction is disabled and will function like a dumb LKF.
Adds one measurement to the history buffer, removing the oldest element in the buffer if it is full.
Parameters
z
The measurement vector to be added.
R
The measurement noise covariance matrix, corresponding to the measurement vector.
stamp
Time stamp of the measurement vector and covariance matrix.
model
Optional pointer to a specific Model to be used with this measurement (eg. mapping it from different states). If it equals to nullptr, the default model specified in the constructor will be used.
Note
The measurement vector will not be added if it is older than the oldest element in the history buffer.
Adds one measurement to the history buffer, removing the oldest element in the buffer if it is full.
Parameters
z
The measurement vector to be added.
R
The measurement noise covariance matrix, corresponding to the measurement vector.
stamp
Time stamp of the measurement vector and covariance matrix.
model
Optional pointer to a specific Model to be used with this measurement (eg. mapping it from different states). If it equals to nullptr, the default model specified in the constructor will be used.
Note
This is the variant of the method when reprediction is disabled and will function like a dumb LKF.
Adds one system input to the history buffer, removing the oldest element in the buffer if it is full.
Parameters
Q
The process noise covariance matrix.
stamp
Time stamp of the input vector and covariance matrix.
model
Optional pointer to a specific Model to be used with this covariance matrix (eg. mapping it to different states). If it equals to nullptr, the default model specified in the constructor will be used.
Note
The new element will not be added if it is older than the oldest element in the history buffer.
Adds one system input to the history buffer, removing the oldest element in the buffer if it is full.
Parameters
Q
The process noise covariance matrix.
stamp
Time stamp of the input vector and covariance matrix.
model
Optional pointer to a specific Model to be used with this covariance matrix (eg. mapping it to different states). If it equals to nullptr, the default model specified in the constructor will be used.
Note
This is the variant of the method when reprediction is disabled and will function like a dumb LKF.
Estimates the system state and covariance matrix at the specified time.
The measurement and system input histories are used to estimate the state vector and covariance matrix values at the specified time, which are returned.
Parameters
to_stamp
The desired time at which the state vector and covariance matrix should be estimated.
Returns
Returns the estimated state vector and covariance matrix in a single struct.
Estimates the system state and covariance matrix at the specified time.
The measurement and system input histories are used to estimate the state vector and covariance matrix values at the specified time, which are returned.
Parameters
to_stamp
The desired time at which the state vector and covariance matrix should be estimated.
Returns
Returns the estimated state vector and covariance matrix in a single struct.
Note
This is the variant of the method when reprediction is disabled and will function like a dumb LKF.
The documentation for this class was generated from the following file: