locationd: ignore empty sensorEvents (#20887)

pull/68/head
Willem Melching 4 years ago committed by GitHub
parent f59c6d379d
commit 65ab98a6c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      selfdrive/locationd/locationd.cc

@ -180,6 +180,12 @@ void Localizer::handle_sensors(double current_time, const capnp::List<cereal::Se
// TODO does not yet account for double sensor readings in the log // TODO does not yet account for double sensor readings in the log
for (int i = 0; i < log.size(); i++) { for (int i = 0; i < log.size(); i++) {
const cereal::SensorEventData::Reader& sensor_reading = log[i]; const cereal::SensorEventData::Reader& sensor_reading = log[i];
// Ignore empty readings (e.g. in case the magnetometer had no data ready)
if (sensor_reading.getTimestamp() == 0){
continue;
}
double sensor_time = 1e-9 * sensor_reading.getTimestamp(); double sensor_time = 1e-9 * sensor_reading.getTimestamp();
// sensor time and log time should be close // sensor time and log time should be close

Loading…
Cancel
Save