|
|
|
@ -22,8 +22,9 @@ from openpilot.common.prefix import OpenpilotPrefix |
|
|
|
|
from openpilot.common.timeout import Timeout |
|
|
|
|
from openpilot.common.realtime import DT_CTRL |
|
|
|
|
from panda.python import ALTERNATIVE_EXPERIENCE |
|
|
|
|
from openpilot.selfdrive.car.card import can_comm_callbacks |
|
|
|
|
from openpilot.selfdrive.car.card import can_comm_callbacks, convert_to_capnp |
|
|
|
|
from openpilot.selfdrive.car.car_helpers import get_car, interfaces |
|
|
|
|
from openpilot.selfdrive.car.data_structures import CarParams |
|
|
|
|
from openpilot.system.manager.process_config import managed_processes |
|
|
|
|
from openpilot.selfdrive.test.process_replay.vision_meta import meta_from_camera_state, available_streams |
|
|
|
|
from openpilot.selfdrive.test.process_replay.migration import migrate_all |
|
|
|
@ -349,8 +350,8 @@ def get_car_params_callback(rc, pm, msgs, fingerprint): |
|
|
|
|
sendcan = DummySocket() |
|
|
|
|
|
|
|
|
|
canmsgs = [msg for msg in msgs if msg.which() == "can"] |
|
|
|
|
cached_params = params.get("CarParamsCache") |
|
|
|
|
has_cached_cp = cached_params is not None |
|
|
|
|
cached_params_raw = params.get("CarParamsCache") |
|
|
|
|
has_cached_cp = cached_params_raw is not None |
|
|
|
|
assert len(canmsgs) != 0, "CAN messages are required for fingerprinting" |
|
|
|
|
assert os.environ.get("SKIP_FW_QUERY", False) or has_cached_cp, \ |
|
|
|
|
"CarParamsCache is required for fingerprinting. Make sure to keep carParams msgs in the logs." |
|
|
|
@ -358,13 +359,19 @@ def get_car_params_callback(rc, pm, msgs, fingerprint): |
|
|
|
|
for m in canmsgs[:300]: |
|
|
|
|
can.send(m.as_builder().to_bytes()) |
|
|
|
|
can_callbacks = can_comm_callbacks(can, sendcan) |
|
|
|
|
# TODO: clean this up a bit |
|
|
|
|
cached_params = None |
|
|
|
|
if has_cached_cp: |
|
|
|
|
with car.CarParams.from_bytes(cached_params_raw) as _cached_params: |
|
|
|
|
# TODO: even more generic? |
|
|
|
|
cached_params = CarParams(carName=_cached_params.carName, carFw=_cached_params.carFw, carVin=_cached_params.carVin) |
|
|
|
|
CP = get_car(*can_callbacks, lambda obd: None, Params().get_bool("ExperimentalLongitudinalEnabled"), cached_params=cached_params).CP |
|
|
|
|
|
|
|
|
|
if not params.get_bool("DisengageOnAccelerator"): |
|
|
|
|
CP.alternativeExperience |= ALTERNATIVE_EXPERIENCE.DISABLE_DISENGAGE_ON_GAS |
|
|
|
|
|
|
|
|
|
params.put("CarParams", CP.to_bytes()) |
|
|
|
|
return CP |
|
|
|
|
params.put("CarParams", convert_to_capnp(CP).to_bytes()) |
|
|
|
|
# return CP # TODO: this isn't used? |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def controlsd_rcv_callback(msg, cfg, frame): |
|
|
|
|