refactor dm pitch/yaw thresholding (#22191)

* use indiviual pitch/yaw instead of norm

* update process replay
old-commit-hash: dac8597a08097235cc63a77e025043f618878d6f
This commit is contained in:
ZwX1616
2021-09-13 18:05:42 -05:00
committed by GitHub
parent 00e02325ab
commit 0e661532a2
2 changed files with 6 additions and 9 deletions
+5 -8
View File
@@ -1,4 +1,4 @@
from math import atan2, sqrt
from math import atan2
from cereal import car
from common.numpy_fast import interp
@@ -40,7 +40,6 @@ class DRIVER_MONITOR_SETTINGS():
self._METRIC_THRESHOLD = 0.55 if TICI else 0.48
self._METRIC_THRESHOLD_SLACK = 0.75 if TICI else 0.66
self._METRIC_THRESHOLD_STRICT = 0.55 if TICI else 0.48
self._PITCH_POS_ALLOWANCE = 0.12 # rad, to not be too sensitive on positive pitch
self._PITCH_NATURAL_OFFSET = 0.02 # people don't seem to look straight when they drive relaxed, rather a bit up
self._YAW_NATURAL_OFFSET = 0.08 # people don't seem to look straight when they drive relaxed, rather a bit to the right (center of car)
@@ -170,13 +169,11 @@ class DriverStatus():
pitch_error = pose.pitch - self.pose.pitch_offseter.filtered_stat.mean()
yaw_error = pose.yaw - self.pose.yaw_offseter.filtered_stat.mean()
# positive pitch allowance
if pitch_error > 0.:
pitch_error = max(pitch_error - self.settings._PITCH_POS_ALLOWANCE, 0.)
pitch_error *= self.settings._PITCH_WEIGHT
pose_metric = sqrt(yaw_error**2 + pitch_error**2)
pitch_error = 0 if pitch_error > 0 else abs(pitch_error) # no positive pitch limit
yaw_error = abs(yaw_error)
if pose_metric > self.settings._METRIC_THRESHOLD*pose.cfactor:
if pitch_error*self.settings._PITCH_WEIGHT > self.settings._METRIC_THRESHOLD*pose.cfactor or \
yaw_error > self.settings._METRIC_THRESHOLD*pose.cfactor:
return DistractedType.BAD_POSE
elif (blink.left_blink + blink.right_blink)*0.5 > self.settings._BLINK_THRESHOLD*blink.cfactor:
return DistractedType.BAD_BLINK
+1 -1
View File
@@ -1 +1 @@
0ab64a741a496f0bc7351d0e95364e8a192a87e9
0ada8ee251248f041ed8092abd9b5368f57bbf6e