Skip to content

HKG: Car Port for Kia Carnival 2025-26 HDA II (ICE + Hybrid)#3377

Open
iwilliamlee wants to merge 4 commits intocommaai:masterfrom
iwilliamlee:kia-carnival-2025-26-upstream
Open

HKG: Car Port for Kia Carnival 2025-26 HDA II (ICE + Hybrid)#3377
iwilliamlee wants to merge 4 commits intocommaai:masterfrom
iwilliamlee:kia-carnival-2025-26-upstream

Conversation

@iwilliamlee
Copy link
Copy Markdown

@iwilliamlee iwilliamlee commented May 7, 2026

Checklist

  • added entry to CarInfo in opendbc/car/hyundai/values.py
  • test route added to routes.py
  • route with stock system: N/A
  • route with openpilot: 64884eacd32fec89/0000009c--f9ab362581 (segment 12 used in routes.py; engaged drive on a 2026 Carnival Hybrid HDA II)
  • harness Type: Hyundai Q
  • architecture: CAN-FD

Link to all physical parts during installation


Summary

Supersedes #1558 (open since Dec 2024). Combines @sunnyhaibin's original 2025 Carnival HDA II car port with full 2025-26 hybrid coverage and the safety changes required to actually drive it.

Three commits:

  1. HKG: Car Port for Kia Carnival 2025-26 HDA II — adds 2025 ICE + 2025/2026 hybrid fingerprints to KIA_CARNIVAL_4TH_GEN, dynamic HYBRID detection (existing 0xFA in ECAN), moves CANFD_ALT_BUTTONS detection out of the non-LKA-steering branch so it applies to HDA2 cars too. Drops the static CANFD_RADAR_SCC platform flag in favor of the existing per-vehicle SCC detection. Carries Co-Authored-By: Jason Wen for sunnyhaibin's original work in HKG: Car Port for Kia Carnival 2025 (HDA2) #1558.

  2. hyundai_canfd: ALT_BUTTONS support for LKA-steering safety — extends Hyundai CAN-FD safety to handle the 0x1aa cruise-button address on the LKA-steering paths. Previously the LKA-steering init paths assumed standard 0x1cf buttons and would block any TX of 0x1aa; HDA2 cars without 0x1cf (e.g. 2025-26 Kia Carnival HDA II) need ALT_BUTTONS routing. Includes new test classes for LKAS + 0x1aa, LKAS_ALT + 0x1aa, and the longitudinal variant.

  3. HKG: test route for Kia Carnival Hybrid 2025-26 HDA II — adds the engaged-drive test route entry to routes.py.

Why this isn't just #1558 rebased

#1558 covers the 2025 model year and treats hybrid detection via FW string prefix on the older 0x105-based hybrid logic. Since then, commaai/master moved hybrid detection to 0xFA in ECAN (works on this car — verified) and the Carnival 4th-gen platform was renamed. This PR rebases onto current master and adds:

Verification

  • Safety unit tests pass — 1086 tests (105 new for the LKA-steering + ALT_BUTTONS combinations); existing-platform behavior unchanged
  • MISRA-clean — safety patch reviewed via cppcheck --addon=misra
  • Real-rlog replay — validated against 5 segments of an engaged drive on a 2026 Carnival Hybrid HDA II:
    • 0 invalid RX across all segments (the new HYUNDAI_CANFD_ALT_BUTTONS_RX_CHECKS(1) for LKA-steering paths correctly accepts 0x1aa)
    • 0 0x1aa ever blocked on TX (the new TX hook + msg sets correctly route alt cruise buttons)
    • Mid-drive segments (e.g. seg 12) pass cleanly with all TX approved while controls allowed
  • carParams sanity — the rlog's recorded safetyParam=178 decomposes cleanly to HYBRID_GAS | CANFD_LKA_STEER_MSG | CANFD_ALT_BUTTONS | CANFD_LKA_STEER_MSG_ALT, which our new code produces from the rlog's CAN data via dynamic detection

Bus / FW evidence (from rlog)

bus 1 (E-CAN) bus 2 (CAM)
0x110 LKAS_ALT
0x362 CAM_0x362
0x1cf standard buttons
0x1aa ALT_BUTTONS
0xFA hybrid signal
0x1ba BSM

ADAS ECU 0x730 present (KA4 FBL6 1.00 1.00 250305) — confirms HDA2 with ADAS Driving ECU.

Credits

Thanks to @sunnyhaibin / Jason Wen for the original car port in #1558, and the community 2025 Kia Carnival (HDA2) owners (reasonableperson_29247, breadley4090, ianik66 on Discord) for the original validation. Hybrid validation by @iwilliamlee on a 2026 Carnival Hybrid HDA II.

@github-actions github-actions Bot added car related to opendbc/car/ hyundai car safety vehicle-specific safety code labels May 7, 2026
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Thanks for contributing to opendbc! In order for us to review your PR as quickly as possible, check the following:

  • Convert your PR to a draft unless it's ready to review
  • Read the contributing docs
  • Before marking as "ready for review", ensure:
    • the goal is clearly stated in the description
    • all the tests are passing
    • include a route or your device' dongle ID if relevant

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

Car behavior report

Replays driving segments through this PR and compares the behavior to master.
Please review any changes carefully to ensure they are expected.

Testing 260 segments for: HYUNDAI_AZERA_HEV_6TH_GEN, HYUNDAI_ELANTRA_GT_I30, HYUNDAI_ELANTRA_2021, HYUNDAI_ELANTRA_HEV_2021, HYUNDAI_GENESIS, HYUNDAI_IONIQ, HYUNDAI_IONIQ_HEV_2022, HYUNDAI_IONIQ_EV_2020, HYUNDAI_IONIQ_PHEV_2019, HYUNDAI_IONIQ_PHEV, HYUNDAI_KONA_2022, HYUNDAI_KONA_EV, HYUNDAI_KONA_EV_2022, HYUNDAI_KONA_EV_2ND_GEN, HYUNDAI_SANTA_FE, HYUNDAI_SANTA_FE_2022, HYUNDAI_SANTA_FE_HEV_2022, HYUNDAI_SANTA_FE_PHEV_2022, HYUNDAI_SONATA, HYUNDAI_SONATA_LF, HYUNDAI_STARIA_4TH_GEN, HYUNDAI_PALISADE, HYUNDAI_SONATA_HYBRID, HYUNDAI_IONIQ_5, HYUNDAI_IONIQ_6, HYUNDAI_TUCSON_4TH_GEN, HYUNDAI_SANTA_CRUZ_1ST_GEN, HYUNDAI_CUSTIN_1ST_GEN

✅ 0 changed, 260 passed, 0 errors

wlee and others added 3 commits May 6, 2026 21:57
Adds support for the Kia Carnival HDA II (with HDA2 architecture) for
both ICE and Hybrid variants, model years 2025-26. The HYBRID and
CANFD_ALT_BUTTONS flags are detected dynamically:

- Camera/radar FW added to KIA_CARNIVAL_4TH_GEN: 2025 ICE
  (KA4 MFC ... 99210-R0500 240305, 99110-R0510), 2025 hybrid
  (KA4HMFC ... 99210-R0500 240305, KAhe RDR ... 99110-ES500),
  and 2026 hybrid (KA4HMFC ... 99210-R0700 250324)
- CANFD_ALT_BUTTONS detection (0x1cf absent from E-CAN) moved out
  of the non-LKA-steering branch so it applies to HDA2 cars too
- Adds doc entries for "Kia Carnival (with HDA II) 2025" and
  "Kia Carnival Hybrid (with HDA II) 2025-26"

The CANFD_RADAR_SCC platform flag is retained because the existing
2022-24 ICE Carnival is non-HDA2 + radar-SCC. HDA2 cars (lka_steering
detected dynamically from CAN) bypass the radar/camera SCC branch
entirely, so the platform flag is harmless for them.

Supersedes commaai#1558 by sunnyhaibin / Jason Wen.

Co-Authored-By: Jason Wen <haibin.wen3@gmail.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Extends the Hyundai CAN-FD safety mode to handle the ALT_BUTTONS
(0x1aa) cruise-button address when the LKA-steering message is in
use. Previously the LKA-steering paths assumed standard 0x1cf
buttons and would block any TX of 0x1aa; HDA2 cars without 0x1cf
(e.g. 2025-26 Kia Carnival HDA II) need ALT_BUTTONS routing.

Safety changes:

- New TX msg sets covering both LKAS (0x50) and LKAS_ALT (0x110)
  steering paired with 0x1aa cruise buttons, for both
  longitudinal and non-longitudinal modes
- TX hook now accepts 0x1cf or 0x1aa, but rejects whichever does
  not match the configured `hyundai_canfd_alt_buttons` flag, then
  validates cancel/resume on the matching address (mirrors the
  existing RX hook)
- New RX-checks branches in the longitudinal and non-longitudinal
  LKA-steering paths to pick the right cruise-button address

Tests:

- TestHyundaiCanfdLKASteeringAltButtonsEV: LKAS (0x50) + 0x1aa
- TestHyundaiCanfdLKASteeringAltAltButtonsEV: LKAS_ALT (0x110) + 0x1aa
- TestHyundaiCanfdLKASteeringLongAltButtonsEV: longitudinal variant
- Widens the cross-mode TX exemption in common.py so the new
  LKA-Long ALT_BUTTONS class doesn't trip the cross-mode test

No behavior change for existing platforms.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Adds an engaged-drive test route captured on a 2026 Kia Carnival
Hybrid (HDA II) running the dynamic-detection platform config.
Closes the test_test_route_present gap for the HDA II + hybrid
configuration.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@iwilliamlee iwilliamlee force-pushed the kia-carnival-2025-26-upstream branch from 3556c8f to faff382 Compare May 7, 2026 04:57
@iwilliamlee
Copy link
Copy Markdown
Author

The test_models (2) failures are all the same — segment 12 of 64884eacd32fec89/0000009c--f9ab362581 needs to be onboarded to the openpilotci bucket.

Status from my end:

  • Route is public on connect.comma.ai (is_public: true per the comma API)
  • All 17 qlog segments uploaded to commadata2
  • Route resolves via comma_api_source with a signed URL (verified locally)

The CI's openpilotci_source doesn't have it yet, and comma_api_source likely needs a JWT my CI doesn't have. Could a maintainer add segment 12 to the openpilotci bucket?

Local validation done while preparing this PR:

  • Safety unit tests: 1086 pass (105 new for LKA-steering + ALT_BUTTONS combinations)
  • MISRA-clean (cppcheck --addon=misra)
  • safety_replay against the qlog: 0 invalid RX, 0 0x1aa TX blocked across 5 segments. Mid-drive segments (e.g. seg 8, 12) pass cleanly with all TX approved while controls allowed
  • carParams from the rlog decompose cleanly to HYBRID_GAS | CANFD_LKA_STEER_MSG | CANFD_ALT_BUTTONS | CANFD_LKA_STEER_MSG_ALT (safetyParam=178), which the new dynamic-detection code in this PR produces from the qlog's CAN data

Happy to share the rlog directly or capture additional data if needed. Drive metadata: 16 minutes engaged on a 2026 Kia Carnival Hybrid HDA II, captured 2026-05-06 PDT.

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/ hyundai

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant