add carParams.passive (#30594)

pull/30595/head
Adeeb Shihadeh 1 year ago committed by GitHub
parent 5ccff25d88
commit bd0ab957b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      cereal
  2. 14
      selfdrive/controls/controlsd.py

@ -1 +1 @@
Subproject commit 033dad2b370dac411479de19381f6e0253e51e01
Subproject commit 4fb8352484c4ef074bee775975c0d1d1e8f57a78

@ -113,8 +113,8 @@ class Controls:
car_recognized = self.CP.carName != 'mock'
controller_available = self.CI.CC is not None and not passive and not self.CP.dashcamOnly
self.read_only = not car_recognized or not controller_available or self.CP.dashcamOnly
if self.read_only:
self.CP.passive = not car_recognized or not controller_available or self.CP.dashcamOnly
if self.CP.passive:
safety_config = car.CarParams.SafetyConfig.new_message()
safety_config.safetyModel = car.CarParams.SafetyModel.noOutput
self.CP.safetyConfigs = [safety_config]
@ -189,7 +189,7 @@ class Controls:
set_offroad_alert("Offroad_CarUnrecognized", True)
else:
set_offroad_alert("Offroad_NoFirmware", True)
elif self.read_only:
elif self.CP.passive:
self.events.add(EventName.dashcamMode, static=True)
elif self.joystick_mode:
self.events.add(EventName.joystickDebug, static=True)
@ -225,7 +225,7 @@ class Controls:
return
# no more events while in dashcam mode
if self.read_only:
if self.CP.passive:
return
# Block resume if cruise never previously enabled
@ -440,7 +440,7 @@ class Controls:
if VisionStreamType.VISION_STREAM_WIDE_ROAD not in available_streams:
self.sm.ignore_alive.append('wideRoadCameraState')
if not self.read_only:
if not self.CP.passive:
self.CI.init(self.CP, self.can_sock, self.pm.sock['sendcan'])
self.initialized = True
@ -745,7 +745,7 @@ class Controls:
if current_alert:
hudControl.visualAlert = current_alert.visual_alert
if not self.read_only and self.initialized:
if not self.CP.passive and self.initialized:
# send car controls over can
now_nanos = self.can_log_mono_time if REPLAY else int(time.monotonic() * 1e9)
self.last_actuators, can_sends = self.CI.apply(CC, now_nanos)
@ -860,7 +860,7 @@ class Controls:
self.update_events(CS)
cloudlog.timestamp("Events updated")
if not self.read_only and self.initialized:
if not self.CP.passive and self.initialized:
# Update control state
self.state_transition(CS)
self.prof.checkpoint("State transition")

Loading…
Cancel
Save