mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-06-24 23:42:05 +08:00
put LongControlState in CarControl.Actuators (#22154)
This commit is contained in:
+1
-1
Submodule cereal updated: 89557c5a17...95f9fa186f
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user