src/ukf.cpp
/**
 * @param {MeasurementPackage} meas_package The latest measurement data of
 * either radar or laser.
 */
@param {MeasurementPackage} meas_package The latest measurement data of
either radar or laser.
@param { MeasurementPackage } meas_package The latest measurement data of either radar or laser .
void UKF::ProcessMeasurement(MeasurementPackage meas_package) {
  constexpr double DTMAX = 0.2;
  double dt = (meas_package.timestamp_ - time_us_) / 1000000.0;
  if (!is_initialized_ || abs(dt) > DTMAX) {
    InitFilter(meas_package);
  } else {
    if (meas_package.timestamp_ >= time_us_) {
      time_us_ = meas_package.timestamp_;
      MatrixXd Xsig_pred = Prediction(dt);
      if (meas_package.sensor_type_ == MeasurementPackage::LASER) {
        if (use_lidar_) {
          UpdateLidar(meas_package, dt);
        }
      } else {
        if (use_radar_) {
          if (!v_initialized_) {
            MatrixXd R = radar_measurement_.R();
            x_(2) = meas_package.raw_measurements_(2);
            P_(2, 2) = R(2);
            v_initialized_ = true;
          }
          UpdateRadar(meas_package, Xsig_pred, dt);
        }
      }
    } else {
    }
  }
}
void UKF :: ProcessMeasurement ( MeasurementPackage meas_package ) { constexpr double DTMAX = 0.2 ; double dt = ( meas_package . timestamp_ - time_us_ ) / 1000000.0 ; if ( ! is_initialized_ || abs ( dt ) > DTMAX ) { InitFilter ( meas_package ) ; } else { if ( meas_package . timestamp_ >= time_us_ ) { time_us_ = meas_package . timestamp_ ; MatrixXd Xsig_pred = Prediction ( dt ) ; if ( meas_package . sensor_type_ == MeasurementPackage :: LASER ) { if ( use_lidar_ ) { UpdateLidar ( meas_package , dt ) ; } } else { if ( use_radar_ ) { if ( ! v_initialized_ ) { MatrixXd R = radar_measurement_ . R ( ) ; x_ ( 2 ) = meas_package . raw_measurements_ ( 2 ) ; P_ ( 2 , 2 ) = R ( 2 ) ; v_initialized_ = true ; } UpdateRadar ( meas_package , Xsig_pred , dt ) ; } } } else { } } }
@param {MeasurementPackage} meas_package The latest measurement data of
 either radar or laser.
@param { MeasurementPackage } meas_package The latest measurement data of either radar or laser .
// if the time between two measurements is too high the state can't be // predicted precise enough // LIDAR measuement // RADAR measurement // discard measurements with timestamps in the past