fix timestamps (#20029)

* fix timestamps

* nanoseconds

* update refs
old-commit-hash: b3a868103a
vw-mqb-aeb
HaraldSchafer 4 years ago committed by GitHub
parent ccdcbea799
commit 0e6e652521
  1. 5
      selfdrive/locationd/locationd.py
  2. 2
      selfdrive/test/process_replay/ref_commit

@ -240,6 +240,7 @@ class Localizer():
def handle_sensors(self, current_time, log): def handle_sensors(self, current_time, log):
# 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 sensor_reading in log: for sensor_reading in log:
sensor_time = 1e-9 * sensor_reading.timestamp
# TODO: handle messages from two IMUs at the same time # TODO: handle messages from two IMUs at the same time
if sensor_reading.source == SensorSource.lsm6ds3: if sensor_reading.source == SensorSource.lsm6ds3:
continue continue
@ -249,7 +250,7 @@ class Localizer():
self.gyro_counter += 1 self.gyro_counter += 1
if self.gyro_counter % SENSOR_DECIMATION == 0: if self.gyro_counter % SENSOR_DECIMATION == 0:
v = sensor_reading.gyroUncalibrated.v v = sensor_reading.gyroUncalibrated.v
self.update_kalman(current_time, ObservationKind.PHONE_GYRO, [-v[2], -v[1], -v[0]]) self.update_kalman(sensor_time, ObservationKind.PHONE_GYRO, [-v[2], -v[1], -v[0]])
# Accelerometer # Accelerometer
if sensor_reading.sensor == 1 and sensor_reading.type == 1: if sensor_reading.sensor == 1 and sensor_reading.type == 1:
@ -260,7 +261,7 @@ class Localizer():
self.acc_counter += 1 self.acc_counter += 1
if self.acc_counter % SENSOR_DECIMATION == 0: if self.acc_counter % SENSOR_DECIMATION == 0:
v = sensor_reading.acceleration.v v = sensor_reading.acceleration.v
self.update_kalman(current_time, ObservationKind.PHONE_ACCEL, [-v[2], -v[1], -v[0]]) self.update_kalman(sensor_time, ObservationKind.PHONE_ACCEL, [-v[2], -v[1], -v[0]])
def handle_live_calib(self, current_time, log): def handle_live_calib(self, current_time, log):
if len(log.rpyCalib): if len(log.rpyCalib):

@ -1 +1 @@
defb3dc7205a3d501829f4a780241dfb97132025 0e2d73270816b93dfbd4c2f673591a7ba492edac
Loading…
Cancel
Save