Robotics StackExchange | Archived questions

confused by robott_localization by the process of predict and correct in filter?

Hello, I am confused by the processMeasurement() function in filter_base.cpp . Both predict and correct use the same measurement ? In normal EKF, I think one measurement is used for predict, another for correct.

 // If we've had a previous reading, then go through the predict/update
// cycle. Otherwise, set our state and covariance to whatever we get
// from this measurement.
if (initialized_)
{
  // Determine how much time has passed since our last measurement
  delta = measurement.time_ - lastMeasurementTime_;

  FB_DEBUG("Filter is already initialized. Carrying out predict/correct loop...\n"
           "Measurement time is " << std::setprecision(20) << measurement.time_ <<
           ", last measurement time is " << lastMeasurementTime_ << ", delta is " << delta << "\n");

  // Only want to carry out a prediction if it's
  // forward in time. Otherwise, just correct.todo  a little confused here, both predict and correct use the same measurement ?
  if (delta > 0)
  {
    validateDelta(delta);
    predict(measurement.time_, delta);

    // Return this to the user
    predictedState_ = state_;//
  }

  correct(measurement);//
}

Asked by gaochao_hit on 2018-12-06 04:31:56 UTC

Comments

Answers

In Kalman filters, there are two stages to fusing every measurement: prediction and correction.

During the prediction stage, we predict from the current time to the time of the next measurement. The prediction uses the filter's kinematic model. Then, we correct the predicted state with the measurement data.

What you see is reflected in the code you posted. The prediction stage isn't using the measurement itself, but the measurement's time (measurement.time_). Then we correct the filter with the actual measurement itself.

Asked by Tom Moore on 2018-12-07 20:03:50 UTC

Comments

Thank you for your answer. I get it .

Asked by gaochao_hit on 2018-12-10 20:04:09 UTC

@gaochao_hit would you mind accepting the answer?

Asked by Tom Moore on 2019-01-28 03:32:26 UTC