|
|
@ -39,7 +39,7 @@ class Car: |
|
|
|
|
|
|
|
|
|
|
|
self.last_actuators_output = car.CarControl.Actuators.new_message() |
|
|
|
self.last_actuators_output = car.CarControl.Actuators.new_message() |
|
|
|
|
|
|
|
|
|
|
|
self.params = Params() |
|
|
|
params = Params() |
|
|
|
|
|
|
|
|
|
|
|
if CI is None: |
|
|
|
if CI is None: |
|
|
|
# wait for one pandaState and one CAN packet |
|
|
|
# wait for one pandaState and one CAN packet |
|
|
@ -47,21 +47,18 @@ class Car: |
|
|
|
get_one_can(self.can_sock) |
|
|
|
get_one_can(self.can_sock) |
|
|
|
|
|
|
|
|
|
|
|
num_pandas = len(messaging.recv_one_retry(self.sm.sock['pandaStates']).pandaStates) |
|
|
|
num_pandas = len(messaging.recv_one_retry(self.sm.sock['pandaStates']).pandaStates) |
|
|
|
experimental_long_allowed = self.params.get_bool("ExperimentalLongitudinalEnabled") |
|
|
|
experimental_long_allowed = params.get_bool("ExperimentalLongitudinalEnabled") |
|
|
|
self.CI, self.CP = get_car(self.can_sock, self.pm.sock['sendcan'], experimental_long_allowed, num_pandas) |
|
|
|
self.CI, self.CP = get_car(self.can_sock, self.pm.sock['sendcan'], experimental_long_allowed, num_pandas) |
|
|
|
else: |
|
|
|
else: |
|
|
|
self.CI, self.CP = CI, CI.CP |
|
|
|
self.CI, self.CP = CI, CI.CP |
|
|
|
|
|
|
|
|
|
|
|
# read params |
|
|
|
|
|
|
|
self.is_metric = self.params.get_bool("IsMetric") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# set alternative experiences from parameters |
|
|
|
# set alternative experiences from parameters |
|
|
|
self.disengage_on_accelerator = self.params.get_bool("DisengageOnAccelerator") |
|
|
|
self.disengage_on_accelerator = params.get_bool("DisengageOnAccelerator") |
|
|
|
self.CP.alternativeExperience = 0 |
|
|
|
self.CP.alternativeExperience = 0 |
|
|
|
if not self.disengage_on_accelerator: |
|
|
|
if not self.disengage_on_accelerator: |
|
|
|
self.CP.alternativeExperience |= ALTERNATIVE_EXPERIENCE.DISABLE_DISENGAGE_ON_GAS |
|
|
|
self.CP.alternativeExperience |= ALTERNATIVE_EXPERIENCE.DISABLE_DISENGAGE_ON_GAS |
|
|
|
|
|
|
|
|
|
|
|
openpilot_enabled_toggle = self.params.get_bool("OpenpilotEnabledToggle") |
|
|
|
openpilot_enabled_toggle = 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 |
|
|
|
|
|
|
|
|
|
|
@ -72,15 +69,15 @@ class Car: |
|
|
|
self.CP.safetyConfigs = [safety_config] |
|
|
|
self.CP.safetyConfigs = [safety_config] |
|
|
|
|
|
|
|
|
|
|
|
# Write previous route's CarParams |
|
|
|
# Write previous route's CarParams |
|
|
|
prev_cp = self.params.get("CarParamsPersistent") |
|
|
|
prev_cp = params.get("CarParamsPersistent") |
|
|
|
if prev_cp is not None: |
|
|
|
if prev_cp is not None: |
|
|
|
self.params.put("CarParamsPrevRoute", prev_cp) |
|
|
|
params.put("CarParamsPrevRoute", prev_cp) |
|
|
|
|
|
|
|
|
|
|
|
# Write CarParams for controls and radard |
|
|
|
# Write CarParams for controls and radard |
|
|
|
cp_bytes = self.CP.to_bytes() |
|
|
|
cp_bytes = self.CP.to_bytes() |
|
|
|
self.params.put("CarParams", cp_bytes) |
|
|
|
params.put("CarParams", cp_bytes) |
|
|
|
self.params.put_nonblocking("CarParamsCache", cp_bytes) |
|
|
|
params.put_nonblocking("CarParamsCache", cp_bytes) |
|
|
|
self.params.put_nonblocking("CarParamsPersistent", cp_bytes) |
|
|
|
params.put_nonblocking("CarParamsPersistent", cp_bytes) |
|
|
|
|
|
|
|
|
|
|
|
self.events = Events() |
|
|
|
self.events = Events() |
|
|
|
|
|
|
|
|
|
|
|