Skip to content

Commit

Permalink
AbsolutePosition: Enable for UKF
Browse files Browse the repository at this point in the history
  • Loading branch information
rpavlik committed Nov 8, 2019
1 parent feef33c commit e1c8ed8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
14 changes: 11 additions & 3 deletions generated/FlexKalman.h
Original file line number Diff line number Diff line change
Expand Up @@ -2358,7 +2358,16 @@ class AbsolutePositionMeasurementBase {
MeasurementMatrix getCovariance(State const &) const {
return m_covariance;
}

template <typename State>
MeasurementVector predictMeasurement(State const &s) const {
return s.position();
}
template <typename State>
MeasurementVector getResidual(MeasurementVector const &prediction,
State const &s) const {
MeasurementVector residual = m_pos - prediction;
return residual;
}
/*!
* Gets the measurement residual, also known as innovation: predicts
* the measurement from the predicted state, and returns the
Expand All @@ -2368,8 +2377,7 @@ class AbsolutePositionMeasurementBase {
*/
template <typename State>
MeasurementVector getResidual(State const &s) const {
MeasurementVector residual = m_pos - s.position();
return residual;
return getResidual(predictMeasurement(s), s);
}

//! Convenience method to be able to store and re-use measurements.
Expand Down
14 changes: 11 additions & 3 deletions inc/FlexKalman/AbsolutePositionMeasurement.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,16 @@ class AbsolutePositionMeasurementBase {
MeasurementMatrix getCovariance(State const &) const {
return m_covariance;
}

template <typename State>
MeasurementVector predictMeasurement(State const &s) const {
return s.position();
}
template <typename State>
MeasurementVector getResidual(MeasurementVector const &prediction,
State const &s) const {
MeasurementVector residual = m_pos - prediction;
return residual;
}
/*!
* Gets the measurement residual, also known as innovation: predicts
* the measurement from the predicted state, and returns the
Expand All @@ -62,8 +71,7 @@ class AbsolutePositionMeasurementBase {
*/
template <typename State>
MeasurementVector getResidual(State const &s) const {
MeasurementVector residual = m_pos - s.position();
return residual;
return getResidual(predictMeasurement(s), s);
}

//! Convenience method to be able to store and re-use measurements.
Expand Down

0 comments on commit e1c8ed8

Please sign in to comment.