      else:
        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)
  
      if pose_metric > 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
 
</s> remove     self._PITCH_POS_ALLOWANCE = 0.12  # rad, to not be too sensitive on positive pitch
 </s> add  </s> remove     if pose_metric > self.settings._METRIC_THRESHOLD*pose.cfactor:
 </s> add     if pitch_error*self.settings._PITCH_WEIGHT > self.settings._METRIC_THRESHOLD*pose.cfactor or \
       yaw_error > self.settings._METRIC_THRESHOLD*pose.cfactor: </s> remove from math import atan2, sqrt
 </s> add from math import atan2
    pitch_error = 0 if pitch_error > 0 else abs(pitch_error) # no positive pitch limit
    yaw_error = abs(yaw_error)
      else:
        pitch_error = pose.pitch - self.pose.pitch_offseter.filtered_stat.mean()
        yaw_error = pose.yaw - self.pose.yaw_offseter.filtered_stat.mean()
  
    pitch_error = 0 if pitch_error > 0 else abs(pitch_error) # no positive pitch limit
    yaw_error = abs(yaw_error)
    pitch_error = 0 if pitch_error > 0 else abs(pitch_error) # no positive pitch limit
    yaw_error = abs(yaw_error)
    pitch_error = 0 if pitch_error > 0 else abs(pitch_error) # no positive pitch limit
    yaw_error = abs(yaw_error)
    pitch_error = 0 if pitch_error > 0 else abs(pitch_error) # no positive pitch limit
    yaw_error = abs(yaw_error)
    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:
        return DistractedType.BAD_POSE
      elif (blink.left_blink + blink.right_blink)*0.5 > self.settings._BLINK_THRESHOLD*blink.cfactor:
        return DistractedType.BAD_BLINK
keep keep keep keep replace replace replace replace replace keep keep keep keep keep
 refactor dm pitch/yaw thresholding (#22191)

* use indiviual pitch/yaw instead of norm

* update process replay 
selfdrive/monitoring/driver_monitor.py