locationd: improve circular buffer handling with np.roll (#33470)

improve circular buffer handling
pull/33602/head
Dean Lee 7 months ago committed by GitHub
parent 34f5ba46b3
commit 7a11d0180b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 6
      selfdrive/locationd/locationd.py

@ -49,7 +49,7 @@ class LocationEstimator:
self.debug = debug self.debug = debug
self.posenet_stds = [POSENET_STD_INITIAL_VALUE] * (POSENET_STD_HIST_HALF * 2) self.posenet_stds = np.array([POSENET_STD_INITIAL_VALUE] * (POSENET_STD_HIST_HALF * 2))
self.car_speed = 0.0 self.car_speed = 0.0
self.camodo_yawrate_distribution = np.array([0.0, 10.0]) # mean, std self.camodo_yawrate_distribution = np.array([0.0, 10.0]) # mean, std
self.device_from_calib = np.eye(3) self.device_from_calib = np.eye(3)
@ -168,8 +168,8 @@ class LocationEstimator:
if np.linalg.norm(rot_calib_std) > 10 * ROTATION_SANITY_CHECK or np.linalg.norm(trans_calib_std) > 10 * TRANS_SANITY_CHECK: if np.linalg.norm(rot_calib_std) > 10 * ROTATION_SANITY_CHECK or np.linalg.norm(trans_calib_std) > 10 * TRANS_SANITY_CHECK:
return HandleLogResult.INPUT_INVALID return HandleLogResult.INPUT_INVALID
self.posenet_stds.pop(0) self.posenet_stds = np.roll(self.posenet_stds, -1)
self.posenet_stds.append(trans_calib_std[0]) self.posenet_stds[-1] = trans_calib_std[0]
# Multiply by N to avoid to high certainty in kalman filter because of temporally correlated noise # Multiply by N to avoid to high certainty in kalman filter because of temporally correlated noise
rot_calib_std *= 10 rot_calib_std *= 10

Loading…
Cancel
Save