diff --git a/cereal b/cereal index 89557c5a17..95f9fa186f 160000 --- a/cereal +++ b/cereal @@ -1 +1 @@ -Subproject commit 89557c5a178c2105e15c2b705395b535c7dcf371 +Subproject commit 95f9fa186fc48277acd4c2d7202765485a9fb1a8 diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index 46fa805839..9e1c675da1 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -9,7 +9,7 @@ from selfdrive.car.honda.values import CruiseButtons, VISUAL_HUD, HONDA_BOSCH, C from opendbc.can.packer import CANPacker VisualAlert = car.CarControl.HUDControl.VisualAlert - +LongCtrlState = car.CarControl.Actuators.LongControlState def compute_gb_honda_bosch(accel, speed): #TODO returns 0s, is unused @@ -172,11 +172,8 @@ class CarController(): can_sends.append(hondacan.create_steering_control(self.packer, apply_steer, lkas_active, CS.CP.carFingerprint, idx, CS.CP.openpilotLongitudinalControl)) - - - # TODO: pass in LoC.long_control_state and use that to decide starting/stoppping - stopping = accel < 0 and CS.out.vEgo < 0.3 - starting = accel > 0 and CS.out.vEgo < 0.3 + stopping = actuators.longControlState == LongCtrlState.stopping + starting = actuators.longControlState == LongCtrlState.starting # Prevent rolling backwards accel = -4.0 if stopping else accel diff --git a/selfdrive/controls/controlsd.py b/selfdrive/controls/controlsd.py index 312df7c14b..89cd1e62fd 100755 --- a/selfdrive/controls/controlsd.py +++ b/selfdrive/controls/controlsd.py @@ -1,6 +1,8 @@ #!/usr/bin/env python3 import os import math +from numbers import Number + from cereal import car, log from common.numpy_fast import clip from common.realtime import sec_since_boot, config_realtime_process, Priority, Ratekeeper, DT_CTRL @@ -507,7 +509,11 @@ class Controls: # Ensure no NaNs/Infs for p in ACTUATOR_FIELDS: - if not math.isfinite(getattr(actuators, p)): + attr = getattr(actuators, p) + if not isinstance(attr, Number): + continue + + if not math.isfinite(attr): cloudlog.error(f"actuators.{p} not finite {actuators.to_dict()}") setattr(actuators, p, 0.0) diff --git a/selfdrive/controls/lib/longcontrol.py b/selfdrive/controls/lib/longcontrol.py index f8694e45e3..28cd42b107 100644 --- a/selfdrive/controls/lib/longcontrol.py +++ b/selfdrive/controls/lib/longcontrol.py @@ -1,10 +1,10 @@ -from cereal import log +from cereal import car from common.numpy_fast import clip, interp from selfdrive.controls.lib.pid import PIController from selfdrive.controls.lib.drive_helpers import CONTROL_N from selfdrive.modeld.constants import T_IDXS -LongCtrlState = log.ControlsState.LongControlState +LongCtrlState = car.CarControl.Actuators.LongControlState STOPPING_EGO_SPEED = 0.5 STOPPING_TARGET_SPEED_OFFSET = 0.01