mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-10-14 02:03:41 +08:00
9241de2210
* add model years * update Focus steer ratio * Ford: add EU label to Focus Mk4 * add packages * add Ford Explorer 2020 Package: Co-Pilot 360 Assist+ Optional on XLT Standard on Limited, Limited Hybrid, ST and Platinum https://cdn.dealereprocess.org/cdn/brochures/ford/2020-explorer.pdf * Ford: steering control with path angle * Ford: add TJA toggle to buttons * add Ford Explorer 2021 `62241b0c7fea4589|2022-08-30--11-58-24--0` Package: Co-Pilot 360 Assist+ Optional on XLT Standard on Limited, Limited Hybrid, ST and Platinum (same as 2020) https://cdn.dealereprocess.org/cdn/brochures/ford/2021-explorer.pdf * Ford: add shiftByWire ECU fw * angle/steer refactor * try always stop and go for US models * no dashcam * car info * send resume button * skip explorer * escape and focus back in dashcam * passthru buttons * fordcan set bus for button message * toggle off stock traffic jam assist so camera does not enforce driver presence checks * not used * update ramp rate/precision notes * cleanup * bump steering pressed torque to 0.8 Nm * add standstill * bump steer ratio * try increasing delay? * fix docs * add kuga car info * maybe fix tja toggle? * compensate for ford roll compensation?? * oops * better ui * block non-adaptive * add note on ui warning for hands on wheel * try only checking/toggling TJA every 2 seconds * add car test route * dashcam only again * send buttons to camera * add process replay segment * cleanup * bump panda * add extra FW Co-authored-by: Cameron Clough <cameronjclough@gmail.com>
80 lines
2.6 KiB
Python
80 lines
2.6 KiB
Python
#!/usr/bin/env python3
|
|
from cereal import car
|
|
from common.conversions import Conversions as CV
|
|
from selfdrive.car import STD_CARGO_KG, scale_rot_inertia, scale_tire_stiffness, gen_empty_fingerprint, get_safety_config
|
|
from selfdrive.car.ford.values import CAR, Ecu, TransmissionType, GearShifter
|
|
from selfdrive.car.interfaces import CarInterfaceBase
|
|
|
|
|
|
EventName = car.CarEvent.EventName
|
|
|
|
|
|
class CarInterface(CarInterfaceBase):
|
|
@staticmethod
|
|
def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=None, experimental_long=False):
|
|
if car_fw is None:
|
|
car_fw = []
|
|
|
|
ret = CarInterfaceBase.get_std_params(candidate, fingerprint)
|
|
|
|
ret.carName = "ford"
|
|
ret.dashcamOnly = True
|
|
ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.ford)]
|
|
|
|
# Angle-based steering
|
|
ret.steerControlType = car.CarParams.SteerControlType.angle
|
|
ret.steerActuatorDelay = 0.4
|
|
ret.steerLimitTimer = 1.0
|
|
tire_stiffness_factor = 1.0
|
|
|
|
if candidate == CAR.ESCAPE_MK4:
|
|
ret.wheelbase = 2.71
|
|
ret.steerRatio = 14.3 # Copied from Focus
|
|
ret.mass = 1750 + STD_CARGO_KG
|
|
|
|
elif candidate == CAR.EXPLORER_MK6:
|
|
ret.wheelbase = 3.025
|
|
ret.steerRatio = 16.8 # learned
|
|
ret.mass = 2050 + STD_CARGO_KG
|
|
|
|
elif candidate == CAR.FOCUS_MK4:
|
|
ret.wheelbase = 2.7
|
|
ret.steerRatio = 13.8 # learned
|
|
ret.mass = 1350 + STD_CARGO_KG
|
|
|
|
else:
|
|
raise ValueError(f"Unsupported car: ${candidate}")
|
|
|
|
# Auto Transmission: 0x732 ECU or Gear_Shift_by_Wire_FD1
|
|
found_ecus = [fw.ecu for fw in car_fw]
|
|
if Ecu.shiftByWire in found_ecus or 0x5A in fingerprint[0]:
|
|
ret.transmissionType = TransmissionType.automatic
|
|
else:
|
|
ret.transmissionType = TransmissionType.manual
|
|
ret.minEnableSpeed = 20.0 * CV.MPH_TO_MS
|
|
|
|
# BSM: Side_Detect_L_Stat, Side_Detect_R_Stat
|
|
# TODO: detect bsm in car_fw?
|
|
ret.enableBsm = 0x3A6 in fingerprint[0] and 0x3A7 in fingerprint[0]
|
|
|
|
# LCA can steer down to zero
|
|
ret.minSteerSpeed = 0.
|
|
|
|
ret.autoResumeSng = ret.minEnableSpeed == -1.
|
|
ret.rotationalInertia = scale_rot_inertia(ret.mass, ret.wheelbase)
|
|
ret.centerToFront = ret.wheelbase * 0.44
|
|
ret.tireStiffnessFront, ret.tireStiffnessRear = scale_tire_stiffness(ret.mass, ret.wheelbase, ret.centerToFront,
|
|
tire_stiffness_factor=tire_stiffness_factor)
|
|
return ret
|
|
|
|
def _update(self, c):
|
|
ret = self.CS.update(self.cp, self.cp_cam)
|
|
|
|
events = self.create_common_events(ret, extra_gears=[GearShifter.manumatic])
|
|
ret.events = events.to_msg()
|
|
|
|
return ret
|
|
|
|
def apply(self, c):
|
|
return self.CC.update(c, self.CS)
|