-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ford: Car Port for Edge 2nd Generation #30762
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Saw your opendbc PR. If There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can update the existing ford_lincoln_base_pt DBC with the alternate ID for documentation/future-use purposes. However, I initially tried using I found the signal There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dang, that's unfortunate. What about There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On our Bronco, when the Qf signal is invalid,
Can you turn your car on and off repeatedly and then send the latest route? It took maybe 50 tries on our Bronco to get it into this state where the angle's offset was wrong. You can just turn the ignition to "on" you don't need to start the engine (as long as 3X goes onroad). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No data at Are you asking about getting a wrong angle offset at The responses I mentioned receiving earlier from other Ford drivers on #ford Discord all seemed to be CAN_FD vehicles. I just found another route from a CAN vehicle, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Wrote a script to analyze the rlogs (or qlogs if rlogs not uploaded) for |
||
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,16 @@ 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), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any idea why the EDGE is different?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why. I checked with other Ford drivers and they confirmed that the F-150's have no data at
ExtSteeringAngleReq2
. Likewise, my Edge has no data atStePinCompAnEst_D_Qf
orStePinComp_An_Est
. There's another Edge user that just bought a C3x. He has a different ABS fingerprint, the rest matches, and his data matches with mine.SteeringPinion_Data
shows up at a different ID in the Edges as well. I originally created a new DBC, changing ID from 7e to 85, but abandoned that once I foundStePinComp_An_Est
has no data. That changed CAN ID may indicate a larger change to the PSCM?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can confirm this is working with my Ford Edge Titanium 2022. Stock openpilot:master did not work after fingerprinting and required these extra steps. I can provide logs if they would be helpful.