-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 CANFD Radar Parser #1835
base: master
Are you sure you want to change the base?
Ford CANFD Radar Parser #1835
Conversation
@@ -34,6 +34,10 @@ def _get_params(ret: structs.CarParams, candidate, fingerprint, car_fw, experime | |||
# MRR_Header_Timestamps->CAN_DET_TIME_SINCE_MEAS reports 61.3 ms | |||
ret.radarDelay = 0.06 | |||
|
|||
if not ret.radarUnavailable and DBC[candidate][Bus.radar] == RADAR.DELPHI_MRR_64: |
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.
Didn't really understood how the 60ms was calculated, but I tried to apply a similar logic for CANFD
azimuth = msg[f"CAN_DET_AZIMUTH_{ii:02d}_{iii:02d}"] # rad [-3.1416|3.13964] | ||
distRate = msg[f"CAN_DET_RANGE_RATE_{ii:02d}_{iii:02d}"] # m/s [-128|127.984] | ||
dRel = cos(azimuth) * dist # m from front of car | ||
yRel = sin(azimuth) * dist # in car frame's y axis, right is positive |
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.
This is the major change between CAN and CANFD, I can't say if it's correct not not the one for CAN, but this one makes the most sense for CANFD. See the PR details for more explanation
🚀 |
Radar enabled with the same logic as for CAN - see below for more details:
Radar Enabled - with final version of the code:
I started with using the same logic used for CAN Fords, adjusting the code for the missing signals in CANFD, and I had some artifacts like:
https://github.com/user-attachments/assets/f4537216-9a6d-43a3-b973-a7bca28b8ff9
Check the lead chevron how it bounces.
https://github.com/user-attachments/assets/dfd9ff2a-e680-4d3f-afd5-2f34bd463ee9
I'm expecting the old radar points to remain in the right and new ones to come on the left.
The road curves to the right and the radar points cross the lanes, when there is noting on the lanes.

CAN logic uses
yRel = -sin(azimuth) * dist
and I used the same for CANFD and I got the above artifacts, then I switched toyRel = sin(azimuth) * dist
and I got:AdjustedRadar-small.mp4
Note how nice old points are left on the right and new ones come from the left.
https://github.com/user-attachments/assets/d2120681-f914-4c7c-b338-2d0f11cf1e35
Note how nice the radar points match with the left edge of the road.

I will add some more comments in the code.