Skip to content

Commit

Permalink
Ford: filter out close high coverage range radar points (#1415)
Browse files Browse the repository at this point in the history
* no functional change, but later

* check correct radar configuration

* add comments

* temp

* clean up
  • Loading branch information
sshane authored Oct 24, 2024
1 parent 5aaad51 commit f1dbcc8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion opendbc/car/ford/radar_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
DELPHI_MRR_RADAR_MSG_COUNT = 64

DELPHI_MRR_RADAR_RANGE_COVERAGE = {0: 42, 1: 164, 2: 45, 3: 175} # scan index to detection range (m)
MIN_LONG_RANGE_DIST = 30 # meters


def _create_delphi_esr_radar_can_parser(CP) -> CANParser:
Expand Down Expand Up @@ -138,9 +139,13 @@ def _update_delphi_mrr(self):

valid = bool(msg[f"CAN_DET_VALID_LEVEL_{ii:02d}"])

# Long range measurement mode is more sensitive and can detect the road surface
dist = msg[f"CAN_DET_RANGE_{ii:02d}"] # m [0|255.984]
if scanIndex in (1, 3) and dist < MIN_LONG_RANGE_DIST:
valid = False

if valid:
azimuth = msg[f"CAN_DET_AZIMUTH_{ii:02d}"] # rad [-3.1416|3.13964]
dist = msg[f"CAN_DET_RANGE_{ii:02d}"] # m [0|255.984]
distRate = msg[f"CAN_DET_RANGE_RATE_{ii: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, left is positive
Expand Down

0 comments on commit f1dbcc8

Please sign in to comment.