From 6b335b36858b2665a461adbc2ce63c0d2a56c340 Mon Sep 17 00:00:00 2001 From: MikeDoyal Date: Mon, 18 Dec 2023 22:14:05 -0500 Subject: [PATCH 1/3] added FORD EDGE MK2 --- docs/CARS.md | 3 ++- selfdrive/car/ford/carstate.py | 30 ++++++++++++++++++++----- selfdrive/car/ford/fingerprints.py | 18 +++++++++++++++ selfdrive/car/ford/interface.py | 5 +++++ selfdrive/car/ford/values.py | 3 +++ selfdrive/car/tests/routes.py | 1 + selfdrive/car/torque_data/override.toml | 1 + 7 files changed, 54 insertions(+), 7 deletions(-) diff --git a/docs/CARS.md b/docs/CARS.md index e48f4765bb40fa..03f66a0f3b3120 100644 --- a/docs/CARS.md +++ b/docs/CARS.md @@ -4,7 +4,7 @@ A supported vehicle is one that just works when you install a comma device. All supported cars provide a better experience than any stock system. Supported vehicles reference the US market unless otherwise specified. -# 273 Supported Cars +# 274 Supported Cars |Make|Model|Supported Package|ACC|No ACC accel below|No ALC below|Steering Torque|Resume from stop|Hardware Needed
 |Video| |---|---|---|:---:|:---:|:---:|:---:|:---:|:---:|:---:| @@ -33,6 +33,7 @@ A supported vehicle is one that just works when you install a comma device. All |Chrysler|Pacifica Hybrid 2019-23|Adaptive Cruise Control (ACC)|Stock|0 mph|39 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 FCA connector
- 1 RJ45 cable (7 ft)
- 1 comma 3X
- 1 comma power v2
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| |comma|body|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|None|| |Ford|Bronco Sport 2021-22|Co-Pilot360 Assist+|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 Ford Q3 connector
- 1 RJ45 cable (7 ft)
- 1 angled mount (8 degrees)
- 1 comma 3X
- 1 comma power v2
- 1 harness box
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| +|Ford|Edge 2020-23|Adaptive Cruise Control with Lane Centering|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 Ford Q3 connector
- 1 RJ45 cable (7 ft)
- 1 comma 3X
- 1 comma power v2
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| |Ford|Escape 2020-22|Co-Pilot360 Assist+|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 Ford Q3 connector
- 1 RJ45 cable (7 ft)
- 1 comma 3X
- 1 comma power v2
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| |Ford|Explorer 2020-23|Co-Pilot360 Assist+|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 Ford Q3 connector
- 1 RJ45 cable (7 ft)
- 1 comma 3X
- 1 comma power v2
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| |Ford|Focus 2018[3](#footnotes)|Adaptive Cruise Control with Lane Centering|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 Ford Q3 connector
- 1 RJ45 cable (7 ft)
- 1 comma 3X
- 1 comma power v2
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| diff --git a/selfdrive/car/ford/carstate.py b/selfdrive/car/ford/carstate.py index 9230d16ef9fed4..2df469e15dcac1 100644 --- a/selfdrive/car/ford/carstate.py +++ b/selfdrive/car/ford/carstate.py @@ -4,7 +4,7 @@ from opendbc.can.parser import CANParser from openpilot.selfdrive.car.interfaces import CarStateBase from openpilot.selfdrive.car.ford.fordcan import CanBus -from openpilot.selfdrive.car.ford.values import CANFD_CAR, CarControllerParams, DBC +from openpilot.selfdrive.car.ford.values import CANFD_CAR, CAN_EDGE, CarControllerParams, DBC GearShifter = car.CarState.GearShifter TransmissionType = car.CarParams.TransmissionType @@ -29,9 +29,14 @@ def update(self, cp, cp_cam): self.unsupported_platform = (cp.vl["VehicleOperatingModes"]["TrnAinTq_D_Qf"] == 0 and self.CP.carFingerprint not in CANFD_CAR) - # Occasionally on startup, the ABS module recalibrates the steering pinion offset, so we need to block engagement - # The vehicle usually recovers out of this state within a minute of normal driving - self.vehicle_sensors_valid = cp.vl["SteeringPinion_Data"]["StePinCompAnEst_D_Qf"] == 3 + if self.CP.carFingerprint in CAN_EDGE: + # Ford Edge calibrated steering wheel angle comes from the IPMA_ADAS instead of PSCM + # Check for Ford Edge Unknown/Invalid steering wheel position + self.vehicle_sensors_valid = cp.vl["ParkAid_Data"]["ExtSteeringAngleReq2"] < 32766 + else: + # Occasionally on startup, the ABS module recalibrates the steering pinion offset, so we need to block engagement + # The vehicle usually recovers out of this state within a minute of normal driving + self.vehicle_sensors_valid = cp.vl["SteeringPinion_Data"]["StePinCompAnEst_D_Qf"] == 3 # car speed ret.vEgoRaw = cp.vl["BrakeSysFeatures"]["Veh_V_ActlBrk"] * CV.KPH_TO_MS @@ -49,7 +54,10 @@ def update(self, cp, cp_cam): ret.parkingBrake = cp.vl["DesiredTorqBrk"]["PrkBrkStatus"] in (1, 2) # steering wheel - ret.steeringAngleDeg = cp.vl["SteeringPinion_Data"]["StePinComp_An_Est"] + if self.CP.carFingerprint in CAN_EDGE: + ret.steeringAngleDeg = cp.vl["ParkAid_Data"]["ExtSteeringAngleReq2"] + else: + ret.steeringAngleDeg = cp.vl["SteeringPinion_Data"]["StePinComp_An_Est"] ret.steeringTorque = cp.vl["EPAS_INFO"]["SteeringColumnTorque"] ret.steeringPressed = self.update_steering_pressed(abs(ret.steeringTorque) > CarControllerParams.STEER_DRIVER_ALLOWANCE, 5) ret.steerFaultTemporary = cp.vl["EPAS_INFO"]["EPAS_Failure"] == 1 @@ -122,7 +130,6 @@ def get_can_parser(CP): ("BrakeSnData_4", 50), ("EngBrakeData", 10), ("Cluster_Info1_FD1", 10), - ("SteeringPinion_Data", 100), ("EPAS_INFO", 50), ("Steering_Data_FD1", 10), ("BodyInfo_3_FD1", 2), @@ -134,6 +141,17 @@ def get_can_parser(CP): ("Lane_Assist_Data3_FD1", 33), ] + # Ford Edge gets steering wheel angle from IPMA instead of PSCM + if CP.carFingerprint in CAN_EDGE: + messages += [ + ("ParkAid_Data", 50), + ] + else: + messages += [ + ("SteeringPinion_Data", 100), + ] + + if CP.transmissionType == TransmissionType.automatic: messages += [ ("Gear_Shift_by_Wire_FD1", 10), diff --git a/selfdrive/car/ford/fingerprints.py b/selfdrive/car/ford/fingerprints.py index d26c3eac0ab943..46c03d8d69b38e 100644 --- a/selfdrive/car/ford/fingerprints.py +++ b/selfdrive/car/ford/fingerprints.py @@ -26,6 +26,24 @@ b'M1PA-14C204-RE\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', ], }, + CAR.EDGE_MK2: { + (Ecu.eps, 0x730, None): [ + b'M2GC-14D003-AA\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', + ], + (Ecu.abs, 0x760, None): [ + b'M2GC-2D053-CB\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', + b'M2GC-2D053-EA\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', + ], + (Ecu.fwdRadar, 0x764, None): [ + b'JX7T-14D049-AD\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', + ], + (Ecu.fwdCamera, 0x706, None): [ + b'KT4T-14F397-AF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', + ], + (Ecu.engine, 0x7E0, None): [ + b'N2GA-14C204-ND\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', + ], + }, CAR.ESCAPE_MK4: { (Ecu.eps, 0x730, None): [ b'LX6C-14D003-AF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', diff --git a/selfdrive/car/ford/interface.py b/selfdrive/car/ford/interface.py index 8a8ce36bd02d1c..0796688b4c2c0b 100644 --- a/selfdrive/car/ford/interface.py +++ b/selfdrive/car/ford/interface.py @@ -40,6 +40,11 @@ def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs): ret.steerRatio = 17.7 ret.mass = 1625 + elif candidate == CAR.EDGE_MK2: + ret.wheelbase = 2.824 + ret.steerRatio = 15.3 + ret.mass = 1933 + elif candidate == CAR.ESCAPE_MK4: ret.wheelbase = 2.71 ret.steerRatio = 16.7 diff --git a/selfdrive/car/ford/values.py b/selfdrive/car/ford/values.py index 2c4415be2b691b..08388377c19284 100644 --- a/selfdrive/car/ford/values.py +++ b/selfdrive/car/ford/values.py @@ -42,6 +42,7 @@ def __init__(self, CP): class CAR(StrEnum): BRONCO_SPORT_MK1 = "FORD BRONCO SPORT 1ST GEN" + EDGE_MK2 = "FORD EDGE 2ND GEN" ESCAPE_MK4 = "FORD ESCAPE 4TH GEN" EXPLORER_MK6 = "FORD EXPLORER 6TH GEN" F_150_MK14 = "FORD F-150 14TH GEN" @@ -52,6 +53,7 @@ class CAR(StrEnum): CANFD_CAR = {CAR.F_150_MK14, CAR.F_150_LIGHTNING_MK1, CAR.MUSTANG_MACH_E_MK1} +CAN_EDGE = {CAR.EDGE_MK2} class RADAR: @@ -89,6 +91,7 @@ def init_make(self, CP: car.CarParams): CAR_INFO: Dict[str, Union[CarInfo, List[CarInfo]]] = { CAR.BRONCO_SPORT_MK1: FordCarInfo("Ford Bronco Sport 2021-22"), + CAR.EDGE_MK2: FordCarInfo("Ford Edge 2020-23", "Adaptive Cruise Control with Lane Centering"), CAR.ESCAPE_MK4: [ FordCarInfo("Ford Escape 2020-22"), FordCarInfo("Ford Kuga 2020-22", "Adaptive Cruise Control with Lane Centering"), diff --git a/selfdrive/car/tests/routes.py b/selfdrive/car/tests/routes.py index c711f819291124..c2614356fe3e4d 100755 --- a/selfdrive/car/tests/routes.py +++ b/selfdrive/car/tests/routes.py @@ -48,6 +48,7 @@ class CarTestRoute(NamedTuple): CarTestRoute("8fb5eabf914632ae|2022-08-04--17-28-53", CHRYSLER.RAM_HD, segment=6), CarTestRoute("54827bf84c38b14f|2023-01-25--14-14-11", FORD.BRONCO_SPORT_MK1), + CarTestRoute("3d4e31f900dd3a88|2023-12-15--11-19-47", FORD.EDGE_MK2), CarTestRoute("f8eaaccd2a90aef8|2023-05-04--15-10-09", FORD.ESCAPE_MK4), CarTestRoute("62241b0c7fea4589|2022-09-01--15-32-49", FORD.EXPLORER_MK6), CarTestRoute("e886087f430e7fe7|2023-06-16--23-06-36", FORD.FOCUS_MK4), diff --git a/selfdrive/car/torque_data/override.toml b/selfdrive/car/torque_data/override.toml index 5cdebc1709cc18..26ece006ce8e43 100644 --- a/selfdrive/car/torque_data/override.toml +++ b/selfdrive/car/torque_data/override.toml @@ -21,6 +21,7 @@ legend = ["LAT_ACCEL_FACTOR", "MAX_LAT_ACCEL_MEASURED", "FRICTION"] # Guess "FORD BRONCO SPORT 1ST GEN" = [nan, 1.5, nan] +"FORD EDGE 2ND GEN" = [nan, 1.5, nan] "FORD ESCAPE 4TH GEN" = [nan, 1.5, nan] "FORD EXPLORER 6TH GEN" = [nan, 1.5, nan] "FORD F-150 14TH GEN" = [nan, 1.5, nan] From ec8dc3950a1e46cadf8caa0d98751084f2370684 Mon Sep 17 00:00:00 2001 From: Mike Doyal Date: Mon, 18 Dec 2023 23:08:19 -0500 Subject: [PATCH 2/3] removed extra line --- selfdrive/car/ford/carstate.py | 1 - 1 file changed, 1 deletion(-) diff --git a/selfdrive/car/ford/carstate.py b/selfdrive/car/ford/carstate.py index 2df469e15dcac1..046d48dd09d3eb 100644 --- a/selfdrive/car/ford/carstate.py +++ b/selfdrive/car/ford/carstate.py @@ -151,7 +151,6 @@ def get_can_parser(CP): ("SteeringPinion_Data", 100), ] - if CP.transmissionType == TransmissionType.automatic: messages += [ ("Gear_Shift_by_Wire_FD1", 10), From 31695f4df10bd2e1dc4065bb46bc2ce08e00659b Mon Sep 17 00:00:00 2001 From: MikeDoyal Date: Tue, 9 Jan 2024 22:33:59 -0500 Subject: [PATCH 3/3] Generatated docs after merge --- docs/CARS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/CARS.md b/docs/CARS.md index 43ed9466bc1009..e6a2ee37845b09 100644 --- a/docs/CARS.md +++ b/docs/CARS.md @@ -4,7 +4,7 @@ A supported vehicle is one that just works when you install a comma device. All supported cars provide a better experience than any stock system. Supported vehicles reference the US market unless otherwise specified. -# 274 Supported Cars +# 275 Supported Cars |Make|Model|Supported Package|ACC|No ACC accel below|No ALC below|Steering Torque|Resume from stop|Hardware Needed
 |Video| |---|---|---|:---:|:---:|:---:|:---:|:---:|:---:|:---:|