ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

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

asked 2018-12-06 03:31:56 -0500

gaochao_hit gravatar image

updated 2018-12-06 03:33:21 -0500

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);//
}
edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by gaochao_hit
close date 2019-01-29 23:39:45.698994

1 Answer

Sort by ยป oldest newest most voted
2

answered 2018-12-07 19:03:50 -0500

Tom Moore gravatar image

updated 2019-01-28 02:32:51 -0500

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.

edit flag offensive delete link more

Comments

Thank you for your answer. I get it .

gaochao_hit gravatar image gaochao_hit  ( 2018-12-10 19:04:09 -0500 )edit

@gaochao_hit would you mind accepting the answer?

Tom Moore gravatar image Tom Moore  ( 2019-01-28 02:32:26 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2018-12-06 03:31:56 -0500

Seen: 321 times

Last updated: Jan 28 '19