mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-09-30 19:13:43 +08:00
@@ -15,7 +15,6 @@ from openpilot.selfdrive.boardd.boardd import can_list_to_can_capnp
|
|||||||
from openpilot.selfdrive.car.car_helpers import get_car, get_one_can
|
from openpilot.selfdrive.car.car_helpers import get_car, get_one_can
|
||||||
from openpilot.selfdrive.car.interfaces import CarInterfaceBase
|
from openpilot.selfdrive.car.interfaces import CarInterfaceBase
|
||||||
|
|
||||||
|
|
||||||
REPLAY = "REPLAY" in os.environ
|
REPLAY = "REPLAY" in os.environ
|
||||||
|
|
||||||
|
|
||||||
@@ -28,7 +27,7 @@ class CarD:
|
|||||||
self.sm = messaging.SubMaster(['pandaStates'])
|
self.sm = messaging.SubMaster(['pandaStates'])
|
||||||
self.pm = messaging.PubMaster(['sendcan', 'carState', 'carParams', 'carOutput'])
|
self.pm = messaging.PubMaster(['sendcan', 'carState', 'carParams', 'carOutput'])
|
||||||
|
|
||||||
self.can_rcv_timeout_counter = 0 # conseuctive timeout count
|
self.can_rcv_timeout_counter = 0 # consecutive timeout count
|
||||||
self.can_rcv_cum_timeout_counter = 0 # cumulative timeout count
|
self.can_rcv_cum_timeout_counter = 0 # cumulative timeout count
|
||||||
|
|
||||||
self.CC_prev = car.CarControl.new_message()
|
self.CC_prev = car.CarControl.new_message()
|
||||||
@@ -54,12 +53,11 @@ class CarD:
|
|||||||
if not disengage_on_accelerator:
|
if not disengage_on_accelerator:
|
||||||
self.CP.alternativeExperience |= ALTERNATIVE_EXPERIENCE.DISABLE_DISENGAGE_ON_GAS
|
self.CP.alternativeExperience |= ALTERNATIVE_EXPERIENCE.DISABLE_DISENGAGE_ON_GAS
|
||||||
|
|
||||||
car_recognized = self.CP.carName != 'mock'
|
|
||||||
openpilot_enabled_toggle = self.params.get_bool("OpenpilotEnabledToggle")
|
openpilot_enabled_toggle = self.params.get_bool("OpenpilotEnabledToggle")
|
||||||
|
|
||||||
controller_available = self.CI.CC is not None and openpilot_enabled_toggle and not self.CP.dashcamOnly
|
controller_available = self.CI.CC is not None and openpilot_enabled_toggle and not self.CP.dashcamOnly
|
||||||
|
|
||||||
self.CP.passive = not car_recognized or not controller_available or self.CP.dashcamOnly
|
self.CP.passive = not controller_available or self.CP.dashcamOnly
|
||||||
if self.CP.passive:
|
if self.CP.passive:
|
||||||
safety_config = car.CarParams.SafetyConfig.new_message()
|
safety_config = car.CarParams.SafetyConfig.new_message()
|
||||||
safety_config.safetyModel = car.CarParams.SafetyModel.noOutput
|
safety_config.safetyModel = car.CarParams.SafetyModel.noOutput
|
||||||
@@ -139,4 +137,3 @@ class CarD:
|
|||||||
self.pm.send('sendcan', can_list_to_can_capnp(can_sends, msgtype='sendcan', valid=self.CS.canValid))
|
self.pm.send('sendcan', can_list_to_can_capnp(can_sends, msgtype='sendcan', valid=self.CS.canValid))
|
||||||
|
|
||||||
self.CC_prev = CC
|
self.CC_prev = CC
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ class CarInterface(CarInterfaceBase):
|
|||||||
ret.wheelbase = 2.70
|
ret.wheelbase = 2.70
|
||||||
ret.centerToFront = ret.wheelbase * 0.5
|
ret.centerToFront = ret.wheelbase * 0.5
|
||||||
ret.steerRatio = 13.
|
ret.steerRatio = 13.
|
||||||
|
ret.dashcamOnly = True
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
def _update(self, c):
|
def _update(self, c):
|
||||||
|
|||||||
@@ -111,7 +111,6 @@ class Controls:
|
|||||||
if not self.CP.openpilotLongitudinalControl:
|
if not self.CP.openpilotLongitudinalControl:
|
||||||
self.params.remove("ExperimentalMode")
|
self.params.remove("ExperimentalMode")
|
||||||
|
|
||||||
self.CC = car.CarControl.new_message()
|
|
||||||
self.CS_prev = car.CarState.new_message()
|
self.CS_prev = car.CarState.new_message()
|
||||||
self.AM = AlertManager()
|
self.AM = AlertManager()
|
||||||
self.events = Events()
|
self.events = Events()
|
||||||
@@ -805,9 +804,6 @@ class Controls:
|
|||||||
cc_send.carControl = CC
|
cc_send.carControl = CC
|
||||||
self.pm.send('carControl', cc_send)
|
self.pm.send('carControl', cc_send)
|
||||||
|
|
||||||
# copy CarControl to pass to CarInterface on the next iteration
|
|
||||||
self.CC = CC
|
|
||||||
|
|
||||||
def step(self):
|
def step(self):
|
||||||
start_time = time.monotonic()
|
start_time = time.monotonic()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user