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

HKG: Car Port for Hyundai Palisade and Kia Telluride 2023-24 (HDA2) #27392

Closed
wants to merge 191 commits into from
Closed
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
191 commits
Select commit Hold shift + click to select a range
7c973a4
HKG: Car Port for 2023 Hyundai Palisade & Kia Telluride
sunnyhaibin Feb 11, 2023
96d94b6
bump opendbc
sunnyhaibin Feb 11, 2023
2d88def
bump panda
sunnyhaibin Feb 11, 2023
5c7696e
Merge remote-tracking branch 'upstream/master' into palisade-2023-por…
sunnyhaibin Feb 11, 2023
d798f7a
bump opendbc
sunnyhaibin Feb 11, 2023
0f4a3f5
bump panda
sunnyhaibin Feb 11, 2023
b7da74a
Merge remote-tracking branch 'upstream/master' into palisade-2023-port-1
sunnyhaibin Feb 19, 2023
1aaf6e9
Update docs
sunnyhaibin Feb 19, 2023
baa2724
Use IntFlag to detect platform
sunnyhaibin Feb 19, 2023
4d03ee3
Missed this oops
sunnyhaibin Feb 19, 2023
1861e2c
Add to release files
sunnyhaibin Feb 19, 2023
5cf9bab
fw fingerprint not working, force recognize for now
sunnyhaibin Feb 19, 2023
d97c8de
check at the top first
sunnyhaibin Feb 19, 2023
ad281b0
bump opendbc
sunnyhaibin Feb 19, 2023
9513a5f
different messages
sunnyhaibin Feb 19, 2023
5a5dc3f
Take these out for now
sunnyhaibin Feb 19, 2023
aeceac2
DISCOVERY: force panda safety
sunnyhaibin Feb 20, 2023
2609eb6
DISCOVERY: Skip CAN checks for now
sunnyhaibin Feb 20, 2023
de91bb5
DISCOVERY: Set safety model at the end
sunnyhaibin Feb 20, 2023
c1aad27
Second attempt
sunnyhaibin Feb 24, 2023
2a1b825
new panda safety
sunnyhaibin Feb 24, 2023
6ad5f69
correct bus
sunnyhaibin Feb 24, 2023
112d314
do this instead
sunnyhaibin Feb 24, 2023
05fdcca
uhhh why not multiplex busses?!
sunnyhaibin Feb 24, 2023
1c047c6
check this
sunnyhaibin Feb 24, 2023
5faea1a
wrong var
sunnyhaibin Feb 24, 2023
a7d092e
don't forget to block!
sunnyhaibin Feb 24, 2023
fa15300
Cable fixed!
sunnyhaibin Feb 24, 2023
f928619
check steering message!
sunnyhaibin Feb 28, 2023
0c8e808
checksum and counter
sunnyhaibin Feb 28, 2023
51b2d23
Merge remote-tracking branch 'upstream/master' into palisade-2023-port-1
sunnyhaibin Feb 28, 2023
a298fad
Update harness
sunnyhaibin Feb 28, 2023
8be93cd
Gotta block them LFA!
sunnyhaibin Feb 28, 2023
0d3d1fd
make things neater
sunnyhaibin Feb 28, 2023
2de50a8
split up the checks
sunnyhaibin Feb 28, 2023
3a98031
use can-fd button press freq
sunnyhaibin Mar 1, 2023
f698f8f
fix block
sunnyhaibin Mar 1, 2023
45addc5
fix set speed definitions
sunnyhaibin Mar 1, 2023
b260a15
small cleanup
sunnyhaibin Mar 1, 2023
c719f5c
only fwdCamera and fwdRadar
sunnyhaibin Mar 1, 2023
2527f1d
no need to force fingerprint
sunnyhaibin Mar 1, 2023
5d7162c
ugh, new blind spot indicator signals
sunnyhaibin Mar 1, 2023
63f1399
add FW versions for 2023 Telluride
sunnyhaibin Mar 2, 2023
415b322
use CAN method to send button presses
sunnyhaibin Mar 2, 2023
e1804a5
hda2 only
sunnyhaibin Mar 2, 2023
0aafbcc
detect using adas driving ecu
sunnyhaibin Mar 2, 2023
5cca282
hda2 only
sunnyhaibin Mar 2, 2023
1aca22f
friction from liveTorqueParameters
sunnyhaibin Mar 2, 2023
5231fa3
add test route
sunnyhaibin Mar 2, 2023
dfdf834
More explicit
sunnyhaibin Mar 2, 2023
ef2bc24
bump opendbc
sunnyhaibin Mar 3, 2023
dc97371
update tune
sunnyhaibin Mar 3, 2023
7a1dfc8
won't work
sunnyhaibin Mar 3, 2023
d0aff3f
bump opendbc
sunnyhaibin Mar 4, 2023
32597bf
Merge remote-tracking branch 'upstream/master' into palisade-2023-port-1
sunnyhaibin Mar 4, 2023
59241b1
bump opendbc
sunnyhaibin Mar 5, 2023
3f48736
fix understeer
sunnyhaibin Mar 6, 2023
cd051d8
less oversteer
sunnyhaibin Mar 6, 2023
d494949
bump opendbc
sunnyhaibin Mar 6, 2023
6c5d446
lower friction to test torqued
sunnyhaibin Mar 8, 2023
64d35d0
higher factor at init
sunnyhaibin Mar 8, 2023
daa23e4
add more FW (JackTheGiant)
sunnyhaibin Mar 12, 2023
a3cb2c7
Merge remote-tracking branch 'upstream/master' into palisade-2023-port-1
sunnyhaibin Mar 27, 2023
809cdbe
bump opendbc
sunnyhaibin Mar 27, 2023
3767feb
bump panda
sunnyhaibin Mar 27, 2023
ed82ff8
Merge branch 'upstream/openpilot/master' into palisade-2023-port-1
sunnyhaibin Jun 3, 2023
9c83051
check this platform too
sunnyhaibin Jun 3, 2023
bc28976
this way
sunnyhaibin Jun 3, 2023
b0fb5b4
try this
sunnyhaibin Jun 3, 2023
96f162a
check counter explicitly
sunnyhaibin Jun 3, 2023
5040ab0
Don't check non-16-bit checksum msgs
sunnyhaibin Jun 3, 2023
a3f83d5
fix send bus
sunnyhaibin Jun 3, 2023
4bee7fc
updating tuning per chichum
sunnyhaibin Jun 3, 2023
195ac2d
Update CARS.md
sunnyhaibin Jun 4, 2023
82c1756
Update CARS.md
sunnyhaibin Jun 4, 2023
cd69f75
bump panda (test can bus disconnected)
sunnyhaibin Jun 6, 2023
f163f20
Revert "updating tuning per chichum"
sunnyhaibin Jun 6, 2023
3991c4c
bump panda (test can bus disconnected)
sunnyhaibin Jun 6, 2023
e239344
Merge remote-tracking branch 'commaai/openpilot/master' into palisade…
sunnyhaibin Aug 11, 2023
d50edaa
Fix
sunnyhaibin Aug 11, 2023
4481b84
Add Hyundai R connector for 2023 Palisade HDA2
sunnyhaibin Aug 11, 2023
ed6e7da
bump panda
sunnyhaibin Aug 11, 2023
0c2a6d9
Merge remote-tracking branch 'commaai/openpilot/master' into palisade…
sunnyhaibin Aug 18, 2023
fe6d730
Sync with CanBus helper
sunnyhaibin Aug 25, 2023
85ff702
bump opendbc
sunnyhaibin Aug 25, 2023
3152c36
2024 Palisade FW
sunnyhaibin Aug 26, 2023
257653f
Use generated DBC for common messages
sunnyhaibin Aug 27, 2023
b17a056
bump opendbc
sunnyhaibin Aug 27, 2023
b6bf3f5
bump opendbc
sunnyhaibin Aug 27, 2023
9c5c0ab
bump opendbc
sunnyhaibin Aug 27, 2023
f9d1e8f
Merge remote-tracking branch 'commaai/openpilot/master' into palisade…
sunnyhaibin Aug 27, 2023
1e82dd4
Use common flag
sunnyhaibin Aug 27, 2023
4d51231
consolidate in method
sunnyhaibin Aug 27, 2023
884ccaa
cleanup and fixes
sunnyhaibin Aug 27, 2023
4691d8b
flipped
sunnyhaibin Aug 27, 2023
db54b02
Panda: common CAN_CANFD flags
sunnyhaibin Aug 27, 2023
3cb7295
Should be here
sunnyhaibin Aug 27, 2023
6c6dc10
common flags
sunnyhaibin Aug 27, 2023
a64a002
Fix
sunnyhaibin Aug 27, 2023
924ae09
Gate the list
sunnyhaibin Aug 27, 2023
12b4878
New test route
sunnyhaibin Aug 27, 2023
6295334
Gate it by default
sunnyhaibin Aug 27, 2023
9d80881
Update docs
sunnyhaibin Aug 27, 2023
4ed66b0
Merge remote-tracking branch 'commaai/openpilot/master' into palisade…
sunnyhaibin Aug 27, 2023
3a97295
bump MY to 2024
sunnyhaibin Aug 28, 2023
8e1d5c3
Revert for now
sunnyhaibin Aug 28, 2023
b4ede50
Merge remote-tracking branch 'commaai/openpilot/master' into palisade…
sunnyhaibin Aug 28, 2023
706d28b
Remove this
sunnyhaibin Aug 28, 2023
18c6bf7
bump opendbc
sunnyhaibin Aug 28, 2023
9d60948
Fix button method
sunnyhaibin Aug 29, 2023
399266b
Merge remote-tracking branch 'commaai/openpilot/master' into palisade…
sunnyhaibin Aug 29, 2023
28795b0
try this
sunnyhaibin Aug 29, 2023
0999c3c
H7 reset
sunnyhaibin Aug 29, 2023
8eeb64a
bump panda
sunnyhaibin Aug 29, 2023
80cb3c8
bump panda
sunnyhaibin Aug 29, 2023
1d06488
bump opendbc
sunnyhaibin Aug 30, 2023
eefae2a
Merge remote-tracking branch 'commaai/openpilot/master' into palisade…
sunnyhaibin Aug 30, 2023
c2b0fe4
update per community reviews
sunnyhaibin Aug 30, 2023
4eca532
This platform is radar SCC
sunnyhaibin Aug 30, 2023
e89d9a6
Merge remote-tracking branch 'commaai/openpilot/master' into palisade…
sunnyhaibin Aug 30, 2023
c0ac3c3
bump model year
sunnyhaibin Aug 31, 2023
33b9aad
Merge remote-tracking branch 'commaai/openpilot/master' into palisade…
sunnyhaibin Aug 31, 2023
7a86bf1
classify as CAN
sunnyhaibin Aug 31, 2023
521226a
fix
sunnyhaibin Aug 31, 2023
c8e7fdb
exclude
sunnyhaibin Aug 31, 2023
7fc81f0
try this
sunnyhaibin Aug 31, 2023
b0c96e1
linter
sunnyhaibin Aug 31, 2023
54de2a2
move
sunnyhaibin Aug 31, 2023
5bfd134
revert
sunnyhaibin Aug 31, 2023
ded63d3
upstream fix
sunnyhaibin Aug 31, 2023
4fac70e
Did it just happen again
sunnyhaibin Aug 31, 2023
72c20b3
consolidate get lfa block msg
sunnyhaibin Aug 31, 2023
0381999
Update CARS.md
sunnyhaibin Aug 31, 2023
85a53c7
upstream fix!
sunnyhaibin Aug 31, 2023
6594a18
flag
sunnyhaibin Aug 31, 2023
442a09c
gotta move this too
sunnyhaibin Aug 31, 2023
4b2e4f8
try this
sunnyhaibin Aug 31, 2023
95519b2
try this
sunnyhaibin Aug 31, 2023
3e6998b
Ugh
sunnyhaibin Aug 31, 2023
bec3fd0
bump panda
sunnyhaibin Sep 1, 2023
63d23c7
update test route
sunnyhaibin Sep 1, 2023
256bfa3
Revert "bump panda"
sunnyhaibin Sep 1, 2023
3b6b9a0
take it out
sunnyhaibin Sep 1, 2023
604e93d
unused
sunnyhaibin Sep 1, 2023
0d31697
Merge remote-tracking branch 'upstream/master' into palisade-2023-port-1
sshane Sep 6, 2023
0fb76d6
lfa block one place
sshane Sep 6, 2023
92abf1b
Revert "lfa block one place" until we clear up mismatch
sshane Sep 6, 2023
c49b4e1
Merge remote-tracking branch 'upstream/master' into palisade-2023-port-1
sshane Sep 7, 2023
a072784
lower lateral limits
sshane Sep 7, 2023
18b6b8a
lower friction
sshane Sep 7, 2023
5064370
add 2024 Palisade FW
sunnyhaibin Sep 19, 2023
4118ace
Hyundai: calculate counters manually for button sends
sunnyhaibin Oct 3, 2023
99e928c
Revert "Hyundai: calculate counters manually for button sends"
sunnyhaibin Oct 4, 2023
6588ec9
Merge remote-tracking branch 'commaai/openpilot/master' into palisade…
sunnyhaibin Mar 3, 2024
4c15777
bump opendbc
sunnyhaibin Mar 3, 2024
cca9e1e
Remove
sunnyhaibin Mar 3, 2024
5660599
Under CAN, not CAN-FD
sunnyhaibin Mar 4, 2024
51c92d5
Fixup! Under CAN, not CAN-FD
sunnyhaibin Mar 4, 2024
e1ebed0
Signal fix
sunnyhaibin Mar 4, 2024
044ee32
Bruh
sunnyhaibin Mar 4, 2024
b78d7b0
Update CARS.md
sunnyhaibin Mar 4, 2024
6fda126
More FW
sunnyhaibin Mar 25, 2024
e827df4
bump opendbc
sunnyhaibin Apr 24, 2024
c66f698
Merge remote-tracking branch 'commaai/openpilot/master' into palisade…
sunnyhaibin Apr 24, 2024
3511c4b
bump opendbc
sunnyhaibin Apr 24, 2024
5303118
update name
sunnyhaibin Apr 24, 2024
7a0b6e0
don't include this
sunnyhaibin Apr 26, 2024
02b7b33
bump opendbc
sunnyhaibin Apr 26, 2024
f1ae346
add the default back
sunnyhaibin Apr 26, 2024
63f361b
permission to 755
sunnyhaibin Apr 26, 2024
9d9c652
no longer needed
sunnyhaibin Apr 26, 2024
af701ae
CAN_CANFD -> CAN_CANFD_HYBRID
sunnyhaibin Apr 26, 2024
a4e4c0e
Remove CAN_CANFD_HYBRID from CAN_FD checks
sunnyhaibin Apr 26, 2024
6e770eb
Cleaner safety config and param sets
sunnyhaibin Apr 26, 2024
10d619d
put non-HDA2 variants in dashcamOnly in this PR
sunnyhaibin Apr 26, 2024
9df9907
bump panda
sunnyhaibin Apr 26, 2024
b6cb260
bump panda
sunnyhaibin Apr 26, 2024
7bac656
Merge remote-tracking branch 'commaai/openpilot/master' into palisade…
sunnyhaibin Apr 26, 2024
145b46e
bump panda
sunnyhaibin Apr 26, 2024
fb050ac
sync name
sunnyhaibin Apr 26, 2024
876460b
import CAN into button sendcan
sunnyhaibin Apr 26, 2024
8eefab9
this should be on bus 0
sunnyhaibin Apr 26, 2024
8d93f86
skip checksum for can can-fd hybrid
sunnyhaibin Apr 26, 2024
380cd84
bump opendbc
sunnyhaibin Apr 27, 2024
18e9dec
bump panda
sunnyhaibin Apr 27, 2024
ab12baa
bump opendbc
sunnyhaibin Apr 27, 2024
8598654
adjust steering threshold
sunnyhaibin Apr 27, 2024
323956d
adjust steering threshold limits
sunnyhaibin Apr 27, 2024
f1edfbe
bump opendbc
sunnyhaibin Apr 27, 2024
d114d5a
Merge remote-tracking branch 'commaai/openpilot/master' into palisade…
sunnyhaibin Jun 17, 2024
250af62
Update docs
sunnyhaibin Jun 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Version 0.9.2 (2023-03-XX)
========================
* Draw MPC path instead of model predicted path, this is a more accurate representation of what the car will do.
* Hyundai Palisade 2023 support thanks to sunnyhaibin!
* Kia Telluride 2023 support thanks to sunnyhaibin!

Version 0.9.1 (2023-02-23)
========================
Expand Down
4 changes: 3 additions & 1 deletion docs/CARS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

A supported vehicle is one that just works when you install a comma three. All supported cars provide a better experience than any stock system.

# 237 Supported Cars
# 239 Supported Cars

|Make|Model|Supported Package|ACC|No ACC accel below|No ALC below|Steering Torque|Resume from stop|Harness|Video|
|---|---|---|:---:|:---:|:---:|:---:|:---:|:---:|:---:|
Expand Down Expand Up @@ -79,6 +79,7 @@ A supported vehicle is one that just works when you install a comma three. All s
|Hyundai|Kona Electric 2022|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|<a href="https://comma.ai/shop/comma-three.html?make=Hyundai&model=Kona Electric 2022">Hyundai O</a>||
|Hyundai|Kona Hybrid 2020|Smart Cruise Control (SCC)|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|<a href="https://comma.ai/shop/comma-three.html?make=Hyundai&model=Kona Hybrid 2020">Hyundai I</a>|<a href="https://youtu.be/0dwpAHiZgFo" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|Hyundai|Palisade 2020-22|All|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|<a href="https://comma.ai/shop/comma-three.html?make=Hyundai&model=Palisade 2020-22">Hyundai H</a>|<a href="https://youtu.be/TAnDqjF4fDY?t=456" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|Hyundai|Palisade 2023[<sup>5</sup>](#footnotes)|All|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|<a href="https://comma.ai/shop/comma-three.html?make=Hyundai&model=Palisade 2023">Hyundai N</a>||
|Hyundai|Santa Cruz 2021-22[<sup>5</sup>](#footnotes)|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|<a href="https://comma.ai/shop/comma-three.html?make=Hyundai&model=Santa Cruz 2021-22">Hyundai N</a>||
|Hyundai|Santa Fe 2019-20|All|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|<a href="https://comma.ai/shop/comma-three.html?make=Hyundai&model=Santa Fe 2019-20">Hyundai D</a>||
|Hyundai|Santa Fe 2021-22|All|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|<a href="https://comma.ai/shop/comma-three.html?make=Hyundai&model=Santa Fe 2021-22">Hyundai L</a>|<a href="https://youtu.be/VnHzSTygTS4" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
Expand Down Expand Up @@ -123,6 +124,7 @@ A supported vehicle is one that just works when you install a comma three. All s
|Kia|Stinger 2018-20|Smart Cruise Control (SCC)|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|<a href="https://comma.ai/shop/comma-three.html?make=Kia&model=Stinger 2018-20">Hyundai C</a>|<a href="https://www.youtube.com/watch?v=MJ94qoofYw0" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|Kia|Stinger 2022|All|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|<a href="https://comma.ai/shop/comma-three.html?make=Kia&model=Stinger 2022">Hyundai K</a>||
|Kia|Telluride 2020-22|All|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|<a href="https://comma.ai/shop/comma-three.html?make=Kia&model=Telluride 2020-22">Hyundai H</a>||
|Kia|Telluride 2023[<sup>5</sup>](#footnotes)|All|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|<a href="https://comma.ai/shop/comma-three.html?make=Kia&model=Telluride 2023">Hyundai L</a>||
|Lexus|CT Hybrid 2017-18|Lexus Safety System+|openpilot available[<sup>2</sup>](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|<a href="https://comma.ai/shop/comma-three.html?make=Lexus&model=CT Hybrid 2017-18">Toyota</a>||
|Lexus|ES 2019-22|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|<a href="https://comma.ai/shop/comma-three.html?make=Lexus&model=ES 2019-22">Toyota</a>||
|Lexus|ES Hybrid 2017-18|Lexus Safety System+|openpilot available[<sup>2</sup>](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|<a href="https://comma.ai/shop/comma-three.html?make=Lexus&model=ES Hybrid 2017-18">Toyota</a>||
Expand Down
2 changes: 2 additions & 0 deletions launch_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ if [ -z "$PASSIVE" ]; then
fi

export STAGING_ROOT="/data/safe_staging"

export FINGERPRINT="HYUNDAI PALISADE 2023"
2 changes: 1 addition & 1 deletion opendbc
Submodule opendbc updated 1 files
+1,013 −0 hyundai_palisade_2023.dbc
2 changes: 1 addition & 1 deletion panda
1 change: 1 addition & 0 deletions release/files_common
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,7 @@ opendbc/honda_civic_ex_2022_can_generated.dbc

opendbc/hyundai_canfd.dbc
opendbc/hyundai_kia_generic.dbc
opendbc/hyundai_palisade_2023.dbc
opendbc/hyundai_kia_mando_front_radar_generated.dbc

opendbc/mazda_2017.dbc
Expand Down
20 changes: 13 additions & 7 deletions selfdrive/car/hyundai/carcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,19 +156,25 @@ def update(self, CC, CS, now_nanos):
can_sends.append(hyundaicanfd.create_buttons(self.packer, self.CP, CS.buttons_counter+1, Buttons.RES_ACCEL))
self.last_button_frame = self.frame
else:
can_sends.append(hyundaican.create_lkas11(self.packer, self.frame, self.car_fingerprint, apply_steer, lat_active,
torque_fault, CS.lkas11, sys_warning, sys_state, CC.enabled,
hud_control.leftLaneVisible, hud_control.rightLaneVisible,
left_lane_warning, right_lane_warning))
if self.CP.flags & HyundaiFlags.CAN_CANFD:
can_sends.append(hyundaican.create_lkas11_new(self.packer, self.frame, apply_steer, lat_active,
torque_fault, CS.lkas11, CC.enabled,
hud_control.leftLaneVisible, hud_control.rightLaneVisible,
left_lane_warning, right_lane_warning))
else:
can_sends.append(hyundaican.create_lkas11(self.packer, self.frame, self.car_fingerprint, apply_steer, lat_active,
torque_fault, CS.lkas11, sys_warning, sys_state, CC.enabled,
hud_control.leftLaneVisible, hud_control.rightLaneVisible,
left_lane_warning, right_lane_warning))

if not self.CP.openpilotLongitudinalControl:
if CC.cruiseControl.cancel:
can_sends.append(hyundaican.create_clu11(self.packer, self.frame, CS.clu11, Buttons.CANCEL, self.CP.carFingerprint))
can_sends.append(hyundaican.create_clu11(self.packer, self.frame, CS.clu11, Buttons.CANCEL, self.CP))
elif CC.cruiseControl.resume:
# send resume at a max freq of 10Hz
if (self.frame - self.last_button_frame) * DT_CTRL > 0.1:
# send 25 messages at a time to increases the likelihood of resume being accepted
can_sends.extend([hyundaican.create_clu11(self.packer, self.frame, CS.clu11, Buttons.RES_ACCEL, self.CP.carFingerprint)] * 25)
can_sends.extend([hyundaican.create_clu11(self.packer, self.frame, CS.clu11, Buttons.RES_ACCEL, self.CP)] * 25)
if (self.frame - self.last_button_frame) * DT_CTRL >= 0.15:
self.last_button_frame = self.frame

Expand All @@ -180,7 +186,7 @@ def update(self, CC, CS, now_nanos):

# 20 Hz LFA MFA message
if self.frame % 5 == 0 and self.CP.flags & HyundaiFlags.SEND_LFA.value:
can_sends.append(hyundaican.create_lfahda_mfc(self.packer, CC.enabled))
can_sends.append(hyundaican.create_lfahda_mfc(self.packer, CC.enabled, self.CP))

# 5 Hz ACC options
if self.frame % 20 == 0 and self.CP.openpilotLongitudinalControl:
Expand Down
59 changes: 39 additions & 20 deletions selfdrive/car/hyundai/carstate.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,11 @@ def update(self, cp, cp_cam):
ret.cruiseState.enabled = cp.vl["TCS13"]["ACC_REQ"] == 1
ret.cruiseState.standstill = False
else:
ret.cruiseState.available = cp_cruise.vl["SCC11"]["MainMode_ACC"] == 1
scc_bus = "SCC12" if self.CP.flags & HyundaiFlags.CAN_CANFD.value else "SCC11"
ret.cruiseState.available = cp_cruise.vl[scc_bus]["MainMode_ACC"] == 1
ret.cruiseState.enabled = cp_cruise.vl["SCC12"]["ACCMode"] != 0
sunnyhaibin marked this conversation as resolved.
Show resolved Hide resolved
ret.cruiseState.standstill = cp_cruise.vl["SCC11"]["SCCInfoDisplay"] == 4.
ret.cruiseState.speed = cp_cruise.vl["SCC11"]["VSetDis"] * speed_conv
ret.cruiseState.standstill = cp_cruise.vl[scc_bus]["SCCInfoDisplay"] == 4.
ret.cruiseState.speed = cp_cruise.vl[scc_bus]["VSetDis"] * speed_conv

# TODO: Find brake pressure
ret.brake = 0
Expand Down Expand Up @@ -134,7 +135,7 @@ def update(self, cp, cp_cam):

ret.gearShifter = self.parse_gear_shifter(self.shifter_values.get(gear))

if not self.CP.openpilotLongitudinalControl:
if not self.CP.openpilotLongitudinalControl and not (self.CP.flags & HyundaiFlags.CAN_CANFD.value):
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if not self.CP.openpilotLongitudinalControl and not (self.CP.flags & HyundaiFlags.CAN_CANFD.value):
# TODO: check AEB and FCW on CAN-CAN FD cars
if not self.CP.openpilotLongitudinalControl and not (self.CP.flags & HyundaiFlags.CAN_CANFD):

is CAN-CAN FD a good name in the comments for these cars?

aeb_src = "FCA11" if self.CP.flags & HyundaiFlags.USE_FCA.value else "SCC12"
aeb_sig = "FCA_CmdAct" if self.CP.flags & HyundaiFlags.USE_FCA.value else "AEB_CmdAct"
aeb_warning = cp_cruise.vl[aeb_src]["CF_VSM_Warn"] != 0
Expand Down Expand Up @@ -291,7 +292,6 @@ def get_can_parser(CP):
]
checks = [
# address, frequency
("MDPS12", 50),
("TCS13", 50),
("TCS15", 10),
("CLU11", 50),
Expand All @@ -303,8 +303,10 @@ def get_can_parser(CP):
("WHL_SPD11", 50),
("SAS11", 100),
]
freq_mdps12 = 100 if CP.flags & HyundaiFlags.CAN_CANFD.value else 50
checks.append(("MDPS12", freq_mdps12))

if not CP.openpilotLongitudinalControl and CP.carFingerprint not in CAMERA_SCC_CAR:
if not CP.openpilotLongitudinalControl and CP.carFingerprint not in CAMERA_SCC_CAR and not (CP.flags & HyundaiFlags.CAN_CANFD.value):
signals += [
("MainMode_ACC", "SCC11"),
("VSetDis", "SCC11"),
Expand All @@ -330,13 +332,25 @@ def get_can_parser(CP):
("CF_VSM_Warn", "SCC12"),
("CF_VSM_DecCmdAct", "SCC12"),
]
elif CP.flags & HyundaiFlags.CAN_CANFD.value:
signals += [
("MainMode_ACC", "SCC12"),
("VSetDis", "SCC12"),
("SCCInfoDisplay", "SCC12"),
("ACC_ObjDist", "SCC12"),
("ACCMode", "SCC12"),
]
checks += [
("SCC12", 50),
]

if CP.enableBsm:
signals += [
("CF_Lca_IndLeft", "LCA11"),
("CF_Lca_IndRight", "LCA11"),
]
checks.append(("LCA11", 50))
freq_lca11 = 20 if CP.flags & HyundaiFlags.CAN_CANFD.value else 50
checks.append(("LCA11", freq_lca11))

if CP.carFingerprint in (HYBRID_CAR | EV_CAR):
if CP.carFingerprint in HYBRID_CAR:
Expand Down Expand Up @@ -366,7 +380,8 @@ def get_can_parser(CP):
signals.append(("CF_Lvr_Gear", "LVR12"))
checks.append(("LVR12", 100))

return CANParser(DBC[CP.carFingerprint]["pt"], signals, checks, 0)
bus = 4 if CP.flags & HyundaiFlags.CAN_CANFD.value else 0
return CANParser(DBC[CP.carFingerprint]["pt"], signals, checks, bus)

@staticmethod
def get_cam_can_parser(CP):
Expand All @@ -376,21 +391,24 @@ def get_cam_can_parser(CP):
signals = [
# signal_name, signal_address
("CF_Lkas_LdwsActivemode", "LKAS11"),
("CF_Lkas_LdwsSysState", "LKAS11"),
("CF_Lkas_SysWarning", "LKAS11"),
("CF_Lkas_LdwsLHWarning", "LKAS11"),
("CF_Lkas_LdwsRHWarning", "LKAS11"),
("CF_Lkas_HbaLamp", "LKAS11"),
("CF_Lkas_FcwBasReq", "LKAS11"),
("CF_Lkas_HbaSysState", "LKAS11"),
("CF_Lkas_FcwOpt", "LKAS11"),
("CF_Lkas_HbaOpt", "LKAS11"),
("CF_Lkas_FcwSysState", "LKAS11"),
("CF_Lkas_FcwCollisionWarning", "LKAS11"),
("CF_Lkas_FusionState", "LKAS11"),
("CF_Lkas_FcwOpt_USM", "LKAS11"),
("CF_Lkas_LdwsOpt_USM", "LKAS11"),
]
if CP.flags & HyundaiFlags.CAN_CANFD.value:
signals += [
("CF_Lkas_LdwsSysState", "LKAS11"),
("CF_Lkas_SysWarning", "LKAS11"),
("CF_Lkas_HbaLamp", "LKAS11"),
("CF_Lkas_FcwBasReq", "LKAS11"),
("CF_Lkas_HbaSysState", "LKAS11"),
("CF_Lkas_FcwOpt", "LKAS11"),
("CF_Lkas_HbaOpt", "LKAS11"),
("CF_Lkas_FcwSysState", "LKAS11"),
("CF_Lkas_FcwCollisionWarning", "LKAS11"),
("CF_Lkas_FusionState", "LKAS11"),
("CF_Lkas_LdwsOpt_USM", "LKAS11"),
]
checks = [
("LKAS11", 100)
]
Expand Down Expand Up @@ -422,7 +440,8 @@ def get_cam_can_parser(CP):
("CF_VSM_DecCmdAct", "SCC12"),
]

return CANParser(DBC[CP.carFingerprint]["pt"], signals, checks, 2)
bus = 6 if CP.flags & HyundaiFlags.CAN_CANFD.value else 2
return CANParser(DBC[CP.carFingerprint]["pt"], signals, checks, bus)

@staticmethod
def get_can_parser_canfd(CP):
Expand Down
37 changes: 30 additions & 7 deletions selfdrive/car/hyundai/hyundaican.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import crcmod
from selfdrive.car.hyundai.values import CAR, CHECKSUM, CAMERA_SCC_CAR
from selfdrive.car.hyundai.values import HyundaiFlags, CAR, CHECKSUM, CAMERA_SCC_CAR

hyundai_checksum = crcmod.mkCrcFun(0x11D, initCrc=0xFD, rev=False, xorOut=0xdf)

Expand Down Expand Up @@ -77,24 +77,47 @@ def create_lkas11(packer, frame, car_fingerprint, apply_steer, steer_req,

return packer.make_can_msg("LKAS11", 0, values)

def create_lkas11_new(packer, frame, apply_steer, steer_req,
torque_fault, lkas11, enabled, left_lane, right_lane, left_lane_depart, right_lane_depart):
values = lkas11
values["CF_Lkas_LdwsLHWarning"] = left_lane_depart
values["CF_Lkas_LdwsRHWarning"] = right_lane_depart
values["CR_Lkas_StrToqReq"] = apply_steer
values["CF_Lkas_ActToi"] = steer_req
values["CF_Lkas_ToiFlt"] = torque_fault # seems to allow actuation on CR_Lkas_StrToqReq
values["CF_Lkas_MsgCount"] = frame % 0xF
values["CF_Lkas_LdwsActivemode"] = int(left_lane) + (int(right_lane) << 1)
values["CF_Lkas_FcwOpt_USM"] = 2 if enabled else 1

def create_clu11(packer, frame, clu11, button, car_fingerprint):
dat = packer.make_can_msg("LKAS11", 4, values)[2]

# CRC Checksum as seen on 2019 Hyundai Santa Fe
dat = dat[:6] + dat[7:8]
checksum = hyundai_checksum(dat)

values["CF_Lkas_Chksum"] = checksum

return packer.make_can_msg("LKAS11", 4, values)

def create_clu11(packer, frame, clu11, button, CP):
values = clu11
values["CF_Clu_CruiseSwState"] = button
values["CF_Clu_AliveCnt1"] = frame % 0x10
# send buttons to camera on camera-scc based cars
bus = 2 if car_fingerprint in CAMERA_SCC_CAR else 0
bus = 2 if CP.carFingerprint in CAMERA_SCC_CAR else 4 if CP.flags & HyundaiFlags.CAN_CANFD else 0
return packer.make_can_msg("CLU11", bus, values)


def create_lfahda_mfc(packer, enabled, hda_set_speed=0):
def create_lfahda_mfc(packer, enabled, CP, hda_set_speed=0):
values = {
"LFA_Icon_State": 2 if enabled else 0,
"HDA_Active": 1 if hda_set_speed else 0,
#"HDA_Active": 1 if hda_set_speed else 0,
"HDA_Icon_State": 2 if hda_set_speed else 0,
"HDA_VSetReq": hda_set_speed,
#"HDA_VSetReq": hda_set_speed,
}
return packer.make_can_msg("LFAHDA_MFC", 0, values)

bus = 4 if CP.flags & HyundaiFlags.CAN_CANFD else 0
return packer.make_can_msg("LFAHDA_MFC", bus, values)

def create_acc_commands(packer, enabled, accel, upper_jerk, idx, lead_visible, set_speed, stopping, long_override):
commands = []
Expand Down
20 changes: 15 additions & 5 deletions selfdrive/car/hyundai/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ def _get_params(ret, candidate, fingerprint, car_fw, experimental_long):
# added to selfdrive/car/tests/routes.py, we can remove it from this list.
ret.dashcamOnly = candidate in {CAR.KIA_OPTIMA_H, }

if candidate in CANFD_CAR:
# detect platforms with HKG CAN and CAN-FD definitions
if 0x50 in fingerprint[5] and 0x420 in fingerprint[4]:
ret.flags |= HyundaiFlags.CAN_CANFD.value

if candidate in CANFD_CAR and not (ret.flags & HyundaiFlags.CAN_CANFD.value):
# detect HDA2 with ADAS Driving ECU
if Ecu.adas in [fw.ecu for fw in car_fw]:
ret.flags |= HyundaiFlags.CANFD_HDA2.value
Expand All @@ -45,7 +49,8 @@ def _get_params(ret, candidate, fingerprint, car_fw, experimental_long):
ret.flags |= HyundaiFlags.CANFD_CAMERA_SCC.value
else:
# Send LFA message on cars with HDA
if 0x485 in fingerprint[2]:
lfahda_bus = 6 if ret.flags & HyundaiFlags.CAN_CANFD.value else 2
if 0x485 in fingerprint[lfahda_bus]:
ret.flags |= HyundaiFlags.SEND_LFA.value

# These cars use the FCA11 message for the AEB and FCW signals, all others use SCC12
Expand All @@ -72,7 +77,7 @@ def _get_params(ret, candidate, fingerprint, car_fw, experimental_long):
ret.mass = 4497. * CV.LB_TO_KG
ret.wheelbase = 2.804
ret.steerRatio = 13.27 * 1.15 # 15% higher at the center seems reasonable
elif candidate == CAR.PALISADE:
elif candidate in (CAR.PALISADE, CAR.PALISADE_2023):
ret.mass = 1999. + STD_CARGO_KG
ret.wheelbase = 2.90
ret.steerRatio = 15.6 * 1.15
Expand Down Expand Up @@ -234,7 +239,7 @@ def _get_params(ret, candidate, fingerprint, car_fw, experimental_long):
else:
ret.longitudinalTuning.kpV = [0.5]
ret.longitudinalTuning.kiV = [0.0]
ret.experimentalLongitudinalAvailable = candidate not in (LEGACY_SAFETY_MODE_CAR | CAMERA_SCC_CAR)
ret.experimentalLongitudinalAvailable = candidate not in (LEGACY_SAFETY_MODE_CAR | CAMERA_SCC_CAR) and not (ret.flags & HyundaiFlags.CAN_CANFD)
ret.openpilotLongitudinalControl = experimental_long and ret.experimentalLongitudinalAvailable
ret.pcmCruise = not ret.openpilotLongitudinalControl

Expand All @@ -250,7 +255,8 @@ def _get_params(ret, candidate, fingerprint, car_fw, experimental_long):
bus = 5 if ret.flags & HyundaiFlags.CANFD_HDA2 else 4
ret.enableBsm = 0x1e5 in fingerprint[bus]
else:
ret.enableBsm = 0x58b in fingerprint[0]
bus = 4 if ret.flags & HyundaiFlags.CAN_CANFD else 0
ret.enableBsm = 0x58b in fingerprint[bus]

# *** panda safety config ***
if candidate in CANFD_CAR:
Expand All @@ -263,6 +269,10 @@ def _get_params(ret, candidate, fingerprint, car_fw, experimental_long):
ret.safetyConfigs[1].safetyParam |= Panda.FLAG_HYUNDAI_CANFD_ALT_BUTTONS
if ret.flags & HyundaiFlags.CANFD_CAMERA_SCC:
ret.safetyConfigs[1].safetyParam |= Panda.FLAG_HYUNDAI_CAMERA_SCC
elif ret.flags & HyundaiFlags.CAN_CANFD:
ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.noOutput),
get_safety_config(car.CarParams.SafetyModel.hyundai)]
ret.safetyConfigs[1].safetyParam |= Panda.FLAG_HYUNDAI_CAN_CANFD
else:
if candidate in LEGACY_SAFETY_MODE_CAR:
# these cars require a special panda safety mode due to missing counters and checksums in the messages
Expand Down
Loading