Skip to content
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

Closed
wants to merge 4 commits into from

Conversation

MikeDoyal
Copy link

@MikeDoyal MikeDoyal commented Dec 16, 2023

Checklist

  • added entry to CarInfo in selfdrive/car/*/values.py and ran selfdrive/car/docs.py to generate new docs
  • test route added to routes.py
  • route with openpilot chill-mode: 3d4e31f900dd3a88|2023-12-15--11-31-09
  • route with openpilot experimental: 3d4e31f900dd3a88|2023-12-15--11-19-47
  • route with stock system: 3d4e31f900dd3a88|2023-12-17--16-47-36
  • harness Type: Ford Q3
  • architecture: CAN
  • Verify that StePinComp_An_Est is never set across lots of Edge routes

Link to all physical parts during installation

comma 3X
car harness kit
Ford Q3

@MikeDoyal MikeDoyal marked this pull request as ready for review December 16, 2023 23:57
# 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:
Copy link
Contributor

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?

Copy link
Author

@MikeDoyal MikeDoyal Dec 17, 2023

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 at StePinCompAnEst_D_Qf or StePinComp_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 found StePinComp_An_Est has no data. That changed CAN ID may indicate a larger change to the PSCM?

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.

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
Copy link
Contributor

@sshane sshane Dec 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Saw your opendbc PR. If SteeringPinion_Data is on this car, but is just on another ID (and that ID doesn't conflict with any existing message), we can add it to the DBC with a prefix such as Alt, and detect the absence 0x7e to use the new alternate message. This is common for other brands, such as Hyundai where we support many different configurations by CAN fingerprint detection.

Copy link
Author

@MikeDoyal MikeDoyal Dec 20, 2023

Choose a reason for hiding this comment

The 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, SteeringPinion_Data: StePinCompAnEst_D_Qf and SteeringPinion_Data: StePinComp_An_Est signals on the Edge are not used/available. They remain at 0:Faulty/-1600 deg, even when remapped to the new ID.

image

I initially tried using SteeringPinion_Data: StePinRelInit_An_Sns, but this signal is not calibrated 0=center. The offset changed every time the vehicle was started. OP would only function if the offset was within paramsd.OFFSET_MAX, which was very unreliable.

I found the signal ParkAid_Data: ExtSteeringAngleReq2 contains calibrated steering wheel angle on the Edge. I surveyed other drivers on the #ford Discord channel and no other models have any data at this signal. This leads me to believe the Edge has moved the calibrated steering wheel angle to the IPMA and it is not available in the PSCM. I was also able to confirm this with another 22' Ford Edge driver with a higher trim level and different ABS fwVersion (thank you @mikehundley). This is why I abandoned my new DBC since this data was already available in the original DBC.

image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dang, that's unfortunate. What about BrakeSnData_6->StePinOffst_An_Est?

Copy link
Contributor

@sshane sshane Dec 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On our Bronco, when the Qf signal is invalid, StePinComp_An_Est is 0 degrees (0b011111010010000), but yours is just zero'd out as bytes (hence the -1600), that is a meaningful difference, and perhaps tells us that it isn't a signal that will ever be filled out, so we can potentially ignore using that.

  • Still should check that it never is not set across lots of Edge routes

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).

Copy link
Author

@MikeDoyal MikeDoyal Dec 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No data at BrakeSnData_6

image

Are you asking about getting a wrong angle offset at SteeringPinion_Data->StePinRelInit_An_Sns? Reviewing a couple of routes, it looks like it's initialized to 0 at ignition so the offset is equal to steering wheel angle at ignition

image
image
image

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, ParkAid_Data->ExtSteeringAngleReq2 was identical to SteeringPinion_Data->StePinComp_An_Est. Does your Bronco have data at ParkAid_Data->ExtSteeringAngleReq2, is that the common signal for all CAN vehicles rather than just EDGE?

Copy link
Author

@MikeDoyal MikeDoyal Dec 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's the route you asked for. I toggled the vehicle on and off 50 times and then left it on for about a minute to collect data. Accessory power only. The steering wheel is turned 90 to the left, so should read about +90 when calibrated
3d4e31f900dd3a88|2023-12-20--00-45-19

image

Copy link
Author

@MikeDoyal MikeDoyal Jan 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Still should check that it never is not set across lots of Edge routes

Wrote a script to analyze the rlogs (or qlogs if rlogs not uploaded) for StePinComp_An_Est data for a list of routes. I ran this on about 500 miles worth of routes from my Edge. I also threw a couple of other Fords in as a control. Please let me know if you would like to see any more data

check_steering_data.py.zip
image

@incognitojam incognitojam mentioned this pull request Mar 7, 2024
5 tasks
@adeebshihadeh adeebshihadeh added car vehicle-specific and removed ignore stale labels Apr 10, 2024
@jyoung8607 jyoung8607 added the ford label Jul 3, 2024
@sshane
Copy link
Contributor

sshane commented Aug 20, 2024

We've moved the car interfacing code to our opendbc repository, which is now the new home for car ports and fingerprints. Please re-open your pull request against opendbc at your convenience by using this command below. This will transform all changes under selfdrive/car/ to opendbc_repo/opendbc/car/. Make sure you have initialized submodules beforehand and have checked out the latest opendbc commit.

PR_NUMBER=33045
curl -L https://github.com/commaai/openpilot/pull/$PR_NUMBER.patch | sed -e 's/selfdrive\/car/opendbc_repo\/opendbc\/car/g' | git apply -v --reject

Simply replace the PR number with your own. Once done, add the files, fix any conflicts, and open a new PR. Alternatively, you may start a new PR from scratch if that is easier for you.

@sshane sshane closed this Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
car port car vehicle-specific ford
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants