Skip to content

HKG: Car Port for EV6 2025-26 (HDA2, LFA2)#3278

Draft
sunnyhaibin wants to merge 105 commits intocommaai:masterfrom
sunnypilot:ev6-2025
Draft

HKG: Car Port for EV6 2025-26 (HDA2, LFA2)#3278
sunnyhaibin wants to merge 105 commits intocommaai:masterfrom
sunnypilot:ev6-2025

Conversation

@sunnyhaibin
Copy link
Copy Markdown
Contributor

@sunnyhaibin sunnyhaibin commented Apr 3, 2026

Based on #1646

Juan's 2025 EV6 Wind (HDA2): 3fc2f65852a45c13

@sshane
Copy link
Copy Markdown
Contributor

sshane commented Apr 3, 2026

If we used EV6 params for everything, all other cars would violate accel and jerk ISO limits:

image

Set to Sportage, most conservative car:

image

2 m/s^2 is not terrible, but not ideal, especially if we port a new car that bumps everything down further. Need some way in panda safety to differentiate the cars

@elkoled can you run the script for Subarus to see the worst case and change to most conservative car?

@devtekve
Copy link
Copy Markdown
Contributor

devtekve commented Apr 3, 2026

Need some way in panda safety to differentiate the cars

I was working a while ago on intercepting the fingerprint by tapping to the UDS messages, I didn't love where it was heading and thought that it would just consume "a lot" of memory on the red panda for storing each fingerprint needed...

If you are curious, this is the code I was writing back then https://github.com/sunnypilot/opendbc/pull/294/changes

@sshane
Copy link
Copy Markdown
Contributor

sshane commented Apr 7, 2026

Trying a kalman filter instead of low pass filter, overshoots, but interesting to try:

image

@sshane
Copy link
Copy Markdown
Contributor

sshane commented Apr 8, 2026

@sunnyhaibin please try this latest tune out on your vehicle (not the commits after this, I haven't tested them yet!)

@sshane
Copy link
Copy Markdown
Contributor

sshane commented Apr 8, 2026

Stock route with lots of turns and other scenarios: 3fc2f65852a45c13/00000043--0faaacc68d

@devtekve
Copy link
Copy Markdown
Contributor

devtekve commented Apr 8, 2026

@sshane
Copy link
Copy Markdown
Contributor

sshane commented Apr 8, 2026

@sshane why not EMA like we have on the SP branch tho?

https://github.com/sunnypilot/opendbc/blob/1190d6672f71670c43795a9ed5c42c4803adf21d/opendbc/car/hyundai/carcontroller.py#L73-L75

What do you mean? FirstOrderFilter class is a low pass filter/ema. The gains on that branch are pretty close to what I found, but lessens rc earlier.

Converted your alphas to rc:

  SMOOTHING_ANGLE_VEGO_MATRIX = [0, 8.5, 11, 13.8, 18]
  SMOOTHING_ANGLE_RC_MATRIX = [0.19, 0.09, 0.0233, 0.0067, 0.0]

@devtekve
Copy link
Copy Markdown
Contributor

devtekve commented Apr 8, 2026

@sshane why not EMA like we have on the SP branch tho?
https://github.com/sunnypilot/opendbc/blob/1190d6672f71670c43795a9ed5c42c4803adf21d/opendbc/car/hyundai/carcontroller.py#L73-L75

What do you mean? FirstOrderFilter class is a low pass filter/ema. The gains on that branch are pretty close to what I found, but lessens rc earlier.

Converted your alphas to rc:

  SMOOTHING_ANGLE_VEGO_MATRIX = [0, 8.5, 11, 13.8, 18]
  SMOOTHING_ANGLE_RC_MATRIX = [0.19, 0.09, 0.0233, 0.0067, 0.0]

Thanks for the explanation! I didn't realize you had reverted the kalman filter 😅
I'll try with the FirstOrderFilter class with your values and report back.

The values I have on our branch are from a lot of trial and error, aiming to drop the smoothing as soon as possible, hence why the RC lessens earlier


I've also made a bit of tweaking on the torque reduction gain calculation to more dynamically adjust given that EU and US markets are quite different, so I generally have lower torque reduction gain values but with angle error taken into account to boost the torque dynamically.

However, my changes are based what claude did on the hackathon, so i will actually pull your changes and test those too.

this is what we had for the reduction gain https://github.com/sunnypilot/opendbc/blob/1190d6672f71670c43795a9ed5c42c4803adf21d/opendbc/car/hyundai/carcontroller.py#L37-L50

@devtekve
Copy link
Copy Markdown
Contributor

devtekve commented Apr 8, 2026

@sshane i could daily drive with your tuning! It's working pretty well, great work!

This is the route 4dcb6256482436c6/000001f5--382c61ee17

The only "caveat" I have is that it felt too stiff to override at lower speeds, I think it's possible the torque reduction gain starts too high ? But otherwise no jitter on the path, no EPS noises that I noticed and no understeer or oversteer.

@sshane
Copy link
Copy Markdown
Contributor

sshane commented Apr 9, 2026

@sshane i could daily drive with your tuning! It's working pretty well, great work!

This is the route 4dcb6256482436c6/000001f5--382c61ee17

The only "caveat" I have is that it felt too stiff to override at lower speeds, I think it's possible the torque reduction gain starts too high ? But otherwise no jitter on the path, no EPS noises that I noticed and no understeer or oversteer.

which commit?

@sshane
Copy link
Copy Markdown
Contributor

sshane commented Apr 9, 2026

Here's a video showing visually how second order filter smooths out the stair steppy model requests a bit better:

https://connect.comma.ai/3fc2f65852a45c13/00000062--4aa5f8800c

Peek.2026-04-08.23-53.mp4

@devtekve
Copy link
Copy Markdown
Contributor

devtekve commented Apr 9, 2026

@sshane i could daily drive with your tuning! It's working pretty well, great work!
This is the route 4dcb6256482436c6/000001f5--382c61ee17
The only "caveat" I have is that it felt too stiff to override at lower speeds, I think it's possible the torque reduction gain starts too high ? But otherwise no jitter on the path, no EPS noises that I noticed and no understeer or oversteer.

which commit?

I was on my own branch to use ioniq 5 PE limits and with the safety fix from #3294 applied, but this was the commit
sunnypilot@c72b6fd


Edit: to be clear, I tested the changes you had before you disabled the filtering @ 99664ba ;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

car safety vehicle-specific safety code car related to opendbc/car/ DBC signals hyundai

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants