Commit Graph

26 Commits

Author SHA1 Message Date
Jason Wen
c4f5a4f9d2 Merge branch 'upstream/opendbc/master' into sync-20260401
# Conflicts:
#	docs/CARS.md
#	opendbc/car/car_helpers.py
#	opendbc/car/chrysler/carcontroller.py
#	opendbc/car/chrysler/values.py
#	opendbc/car/honda/carcontroller.py
#	opendbc/car/honda/hondacan.py
#	opendbc/car/hyundai/hyundaicanfd.py
#	opendbc/car/rivian/interface.py
2026-04-02 21:05:06 -04:00
Jason Wen
18f906f7ee Hyundai CAN FD: Update DBC signals (#3241)
* Rivian: fix duplicate counters on forwarded VDM_AdasSts (#3236)

* fix

* strict

* Hyundai CAN FD: Update DBC signals

* revert

* more

---------

Co-authored-by: Shane Smiskol <shane@smiskol.com>
Co-authored-by: royjr <royjr96@gmail.com>
2026-03-27 21:42:52 -04:00
Jason Wen
0035b6752e Merge branch 'upstream/opendbc/master' into sync-20260111
# Conflicts:
#	.github/workflows/tests.yml
#	SConstruct
#	opendbc/car/docs.py
#	opendbc/car/gm/interface.py
#	opendbc/car/interfaces.py
#	opendbc/car/tesla/teslacan.py
#	opendbc/safety/modes/chrysler.h
#	opendbc/safety/modes/tesla.h
#	opendbc/safety/tests/test.sh
#	opendbc/safety/tests/test_tesla.py
2026-01-19 21:42:56 -05:00
Nikita Pylypyuk
c278560e7b Hyundai: document SCC_CONTROL signal preservation for ACC cancel (#2996)
hyundai: document SCC_CONTROL signal preservation for ACC cancel

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2025-12-29 15:24:55 -08:00
James Vecellio-Grant
42bbd450b9 Feature: Add support for auto regen for EV HKG HyundaiCAN platform (#139)
* Add enhanced HyundaiCAN extension

Introduced HyundaiCanEXT for improved object parsing and control integration, leveraging new fields like lead distance and relative speed in CarControlSP.

Refactored controlsd to utilize a modular design with ControlsdExt for additional sunnypilot specific functionality.

* self.cc_sp

* Refactor CarControlSP handling for improved state updates

* Add HyundaiCanFDEXTParams for  CANFD ACC control parameters

* hud_control.leadVisible

* hysteresis for lead visible

* add lead car & distance indicators

* Revert "add lead car & distance indicators"

This reverts commit 89dc6c6a75a1aa321bc6fc84f4a77a11f32df899.

* Remove canfd

* Hysteresis parameters

* staticmethod for internal methods without self instance.

Break up long line in hyundaican_ext for readability

* add support for can-fd

* add comments & values for new dbc signals

* cleanup - keep only regen related stuff

* CLEAN!!

* not needed for this PR

* reduce duplicate code

* better hysteresis

* combine hysteresis variables

* refactor(hyundai): replace HyundaiCanEXT with LeadDataCarController

- Introduced a modular `LeadDataCarController` replacing `HyundaiCanEXT` to simplify lead data handling.
- Improved maintainability by abstracting lead-related data into reusable components.
- Added unit tests for `LeadDataCarController` to ensure correctness.

* Refactor: Consolidate lead vehicle data into `LeadData` struct

- Replaced separate `leadDistance`, `leadRelSpeed`, and `leadVisible` with `LeadData` struct for cleaner organization.
- Updated references and logic to use the new `LeadData` structure across modules.

* Refactor: Update tests to use `LeadData` struct in `make_carcontrolsp`

- Replaced individual lead attributes with `leadData` struct to align with recent refactor.
- Improves consistency and code clarity.

* introduce leadOne and leadTwo from radard

* update to use that instead

---------

Co-authored-by: nayan8teen <nayan8teen@gmail.com>
Co-authored-by: DevTekVE <devtekve@gmail.com>
Co-authored-by: Jason Wen <haibin.wen3@gmail.com>
2025-09-01 08:25:34 -04:00
Jason Wen
1e143668d6 Merge branch 'upstream/opendbc/master' into sync-20250809
# Conflicts:
#	opendbc/car/chrysler/chryslercan.py
#	opendbc/car/hyundai/hyundaican.py
#	opendbc/car/hyundai/hyundaicanfd.py
#	opendbc/safety/tests/libsafety/safety_helpers.py
#	opendbc/safety/tests/safety_replay/replay_drive.py
#	opendbc/safety/tests/test_chrysler.py
#	opendbc/safety/tests/test_hyundai.py
2025-08-10 01:45:49 -04:00
Shane Smiskol
1302e1bb25 ruff: enable preview rules (#2621)
* preview

* fmt

* fix formatting!

* Revert "fix formatting!"

This reverts commit 559d291cfa27c3500e5fa3105ffdea809bdd1b27.

* some of these are good, but can enable in steps

* and

* ruff check --fix

* preview

* format
2025-08-04 15:38:04 -07:00
Jason Wen
577e864a10 Merge branch 'upstream/opendbc/master' into sync-20250731
# Conflicts:
#	opendbc/car/body/carstate.py
#	opendbc/car/chrysler/carstate.py
#	opendbc/car/ford/carstate.py
#	opendbc/car/gm/carstate.py
#	opendbc/car/honda/carstate.py
#	opendbc/car/honda/interface.py
#	opendbc/car/hyundai/carstate.py
#	opendbc/car/hyundai/interface.py
#	opendbc/car/interfaces.py
#	opendbc/car/mazda/carstate.py
#	opendbc/car/nissan/carstate.py
#	opendbc/car/rivian/carstate.py
#	opendbc/car/subaru/carstate.py
#	opendbc/car/subaru/interface.py
#	opendbc/car/tesla/carstate.py
#	opendbc/car/toyota/interface.py
#	opendbc/car/volkswagen/carstate.py
#	opendbc/safety/modes/chrysler.h
#	opendbc/safety/modes/ford.h
#	opendbc/safety/modes/honda.h
#	opendbc/safety/modes/hyundai.h
#	opendbc/safety/modes/hyundai_canfd.h
#	opendbc/safety/modes/nissan.h
#	opendbc/safety/modes/subaru.h
#	opendbc/safety/modes/tesla.h
#	opendbc/safety/modes/toyota.h
#	opendbc/safety/tests/mutation.sh
#	opendbc/safety/tests/safety_replay/replay_drive.py
2025-08-01 23:57:03 -04:00
Adeeb Shihadeh
83cf9da1c5 Hyundai: make LFA and LKAS steering consistent (#2591) 2025-07-29 19:22:54 -07:00
Adeeb Shihadeh
c966a2be7f Move checksum functions to car modules (#2541)
* Move checksum helpers into can modules

* cleanup

* one more
2025-07-23 17:05:09 -07:00
Discountchubbs
95fc304727 Hyundai: custom longitudinal tuning (#80)
* Make upper conditional as well so we have MOAR POWER

* MORE README.md

* MORE README.md

* Whoops

* README.md

* Actuators.accel makes a difference. Interesting..

* Actuators.accel makes a difference. Interesting..

* Actuators.accel makes a difference. Interesting..

* bump actuators

* Try turning jerk into a parabola

* Try turning jerk into a parabola

* Blend with current accel for more parabolas

* Blend with current accel for more parabolas

* Update README.md

* Remove some unused vars

* Remove some unused vars

* Maybe I was asleep but somehow it worked.

* Maybe I was asleep but somehow it worked.

* 70/30 split

* 60/35 split

* 67:33 split

* use Sqrt for tiny values to increase factor. Oh, also add a test file.

* use Sqrt for tiny values to increase factor. Oh, also add a test file.

* Raise these to restart tests

* Raise these to restart tests

* Update jerk calculation mimicking j_ego math.

* README.md

* Update timestep

* Fix test

* Readability

* Lower time

* Add higher limits for CANFD

* Send these as a floating object. update comments to add TODO msg.

* Conditional flags

* yes its a little weird but heres why:

` "aReqValue": long_state.accel_value if enabled else a_val`

its only to not have merge conflicts with syncs from this file, because if not enabled a_val is already at 0 anyways.

* Make it easier to read

* Chronological order

* Trigger rebuild

* This is an internal test on my end. Disregard, for now

* fw version for my car...

* remove fw version as that was a test

* refactor that while passing internal tests

* bump safety mutation test

* no longer need this

* all should match 50 Hz

* jerk limits are 0 when not enabled

* bump safety mutation test

* match stock behavior for accel

* do our own clipping

* apply upper/lower dynamically

* bump test

* bump test

* Higher lower limit

* move desired accel force zero in tuning controller

* bump

* abs it here

* fix logic

* make sure it resets to 0, enforced in safety

* Test a few things

* Higher jerk for VOACC

* Elantra specific

* raise `off` to stock

* bump opendbc test

* allow jerk calculations at all times

* no more starting state

* higher seems better for elantra ice

* update defaults

* no need for elantra specific

* more default

* more

* match aReqVale

* we dont need such high accel jerk when above 20m/s. This is cruise control, not a racecar.

* 0.45 default long actuator delay

* align type hint

* add lower jerk multiplier for HYUNDAI_IONIQ

* Change min jerk

* should be float

* Change min jerk

* Change min jerk upper

* Change max jerk upper

* Change max jerk upper

* Change max jerk upper

* step + threshold + first order filter to smooth

* spacing

* constants

* Revert "constants"

This reverts commit 442b0c8c75d7dfe30ee04a6239a3afcb1077872b.

* Revert "spacing"

This reverts commit 771d2dacfd230bb901fbe98fbd52ba9650139350.

* Revert "step + threshold + first order filter to smooth"

This reverts commit 9efb28b25550f7f3643fd28fe375eb0f2a66b536.

* multiplier to 1.5

* step updates for parabolic accel/braking

* step updates for parabolic accel/braking

* even less

* test multiplier

* higher threshold

* back to default delay for now

* update test

* update config

* update test

* update config.py

* update test

* Remove stoppingDecelRate **No need for this anymore**

* multiplier to 1.0

* Variable lower dependency

* Variable lower dependency

* Variable lower jerk minimum

* Variable lower jerk minimum
planned_accel -> desired_acel

* Revert some scaling

* .01 here

* .01 here

* try even smoother stopping

* missed a `tuning` here that instead calls itself to inf.

* what is math

* they're the same

* Adjust lower jerk condition by comparing desired and actual accel

Updated the condition for `min_lower_jerk` to account for the difference between desired and actual acceleration, improving precision in jerk calculations. This ensures smoother transitions and enhances overall longitudinal control logic.

* use existing rate_limit

* reset

* Refactor longitudinal controller for better jerk handling

Revised `calculate_a_value` and jerk processing logic to improve acceleration and jerk handling, particularly under dynamic conditions. Adjusted test cases to cover the new logic.

* Refactor longitudinal controller for better jerk handling

Revised `calculate_a_value` and jerk processing logic to improve acceleration and jerk handling, particularly under dynamic conditions. Adjusted test cases to cover the new logic.

* Refactor longitudinal controller for better jerk handling

Revised `calculate_a_value` and jerk processing logic to improve acceleration and jerk handling, particularly under dynamic conditions. Adjusted test cases to cover the new logic.

* Adjust lower_jerk interpolation for improved accuracy

* Lowered the acceleration error threshold from -0.01 to -0.001

* Adjust jerk interpolation thresholds for Hyundai tuning.

Updated the interpolation range  for smaller acceleration errors.

* Move it up

* -.03 not -.05

* radarUnavailable = higher limit patch

* Commit the real change

* Updated the interpolation values and logic for lower_jerk to refine acceleration behavior.

* Updated the interpolation values and logic for lower_jerk to refine acceleration behavior.

* Updated the interpolation values and logic for lower_jerk to refine acceleration behavior.

* Updated the interpolation values and logic for lower_jerk to refine acceleration behavior.

* THIS. THIS WILL STOP FOR LEADS

* Higher for VOACC

* Higher for VOACC

* make sure to stop when transition from off state

* rearrange

* rename

* Rename `make_jerk` to `calculate_jerk` in test cases.

* Adjust jerk tuning for Hyundai longitudinal control

Updated the interpolation table for lower jerk values to improve deceleration handling. This adjustment refines control behavior during higher deceleration requests.

* Updated the interpolation breakpoint from -0.03 to -0.025

* Adjust longitudinal control jerk tuning for smoother response

Updated interpolation values in the jerk tuning logic to improve acceleration smoothing in Hyundai longitudinal control. These changes aim to provide a more consistent and predictable driving experience, particularly during deceleration scenarios.

* Handle radar unavailability in longitudinal tuning check

* `Refactor longitudinal control acceleration and jerk handling`

Removed unused `FirstOrderFilter` and simplified acceleration and jerk calculations for improved clarity and maintainability. Adjusted logic to replace redundant return statements, streamline jerk computation, and reduce unnecessary dependencies.

* `Refactor longitudinal control acceleration and jerk handling`

Removed unused `FirstOrderFilter` and simplified acceleration and jerk calculations for improved clarity and maintainability. Adjusted logic to replace redundant return statements, streamline jerk computation, and reduce unnecessary dependencies.

* Simplify test to be straight to the point.

* split stopping logic out

* Adjust upper_speed_factor and integrate ramp_update logic

* Adjust upper_speed_factor and integrate ramp_update logic

* Adjust upper_speed_factor and integrate ramp_update logic

* Refine acceleration and jerk tuning logic.

* greater than 0

* constant

* add deadzone

* bring back ramp update for jerk upper

* no more ramp update for jerk lower

* use accel_error instead for better comfort and control

* new tune

* bring back ramp update for now for lower jerk

* make sure it goes into stopping

* drag it out

* using count seems to work better

* Refine jerk tuning logic and expand test coverage

* bump vals

* fix logic

* blended aego

* update lower jerk tuning

* spacing

* rename

* fix

* no need for PID yet as we don't have p or i

* Adjust jerk tuning parameters for Hyundai longitudinal control

* retry lfs check

* unused

* tuning diff

* Fix acceleration blending and enhance test coverage

* Update lower_jerk breakpoints

* bump

* Adjust lower jerk parameters and include accel_cmd condition

* Adjust vars

* "Adjust Hyundai longitudinal jerk limits and tuning logic"

* Adjust jerk limits and tuning logic for better control

* lookahead with a_ego_blended

* switch over to planner intent vs car state

* get future jerk limits and variable with velocity

* some cleanup

* more

* Adjusted future jerk lookahead interpolations to utilize dynamic car-specific jerk limit

* Update Hyundai longitudinal tuning and add dynamic jerk logic

Refactored longitudinal configuration to include "lookahead" parameters and revised "jerk_limits" for improved tuning flexibility. Implemented dynamic jerk adaptation logic (Gen1) for smoother braking and acceleration transitions.

* getExperimentallong -> getAlphalong

* bump to original branch

* do not ramp up upper jerk if TCS is not responding

* snap to target when closer

* tunable lookahead values

* more aggressive for the elantra ice

* Still allow ramp while in standstill for EV

* Adjust Kia Niro EV tuning parameters for smoother control

* self.cp.flags

* Update longitudinal_config.py

* ICE tune

* use base

* not too hot about this, fine for now

* Remove ramp for lower desired jerk

* Update tuning_controller.py

* Update longitudinal_config.py

* Update longitudinal_config.py

* update README.md

* update README.md

* Adjust lookahead_jerk_lower_v values in Hyundai longitudinal config.

* update tuning

* Update tune one last time to vals from device which are much smoother.

* Accel error

* unused

* stopping state diff

* accel diff

* do this instead

* start simplifying

* set it from the start

* jerk diff

* update directly

* update tests

* fix

* rename flag and slight cleanup

* long_state -> tuning

* Prep for clean up

* some more

* more

* less in main

* actually modify CP_SP

* extra

* move

* rename

* start

* refactor

* static comfort band (CAN for now)

* directly in can send

* final

---------

Co-authored-by: Jason Wen <haibin.wen3@gmail.com>
2025-05-09 00:27:34 -04:00
Jason Wen
c5efd32c69 Merge branch 'upstream/opendbc/master' into sync-20250312
# Conflicts:
#	opendbc/car/hyundai/carcontroller.py
#	opendbc/safety/safety/safety_chrysler.h
#	opendbc/safety/safety/safety_gm.h
#	opendbc/safety/safety/safety_hyundai.h
#	opendbc/safety/safety/safety_hyundai_canfd.h
#	opendbc/safety/safety/safety_nissan.h
#	opendbc/safety/safety/safety_toyota.h
#	opendbc/safety/tests/test_hyundai.py
2025-03-13 00:30:30 -04:00
royjr
e0d03bf813 HKG: spas remove unused frame param (#1966)
spas remove unused frame param
2025-03-11 23:51:08 -07:00
DevTekVE
e37120452d Merge branch 'master-0efdb71b8f2440ee51a806d057f20a553b849a3a' into master-new
# Conflicts:
#	opendbc/car/hyundai/hyundaicanfd.py
#	opendbc/car/rivian/carcontroller.py
#	opendbc/safety/tests/common.py
#	opendbc/safety/tests/test_chrysler.py
#	opendbc/safety/tests/test_hyundai_canfd.py
2025-03-09 08:41:32 +01:00
Shane Smiskol
e0cacf2cb9 Hyundai CAN FD: add angle control signals to the DBC (#1887)
* restart

* fix

* missing

* remove stuff we don't use

* huh

* fix

* fix fix fix

* we haven't seen LKAS with angle yet

* this is missing from the new message

* ...

* more explicit

* flip

* import
2025-02-28 21:51:29 -08:00
Shane Smiskol
52f89f135e Revert "Hyundai CAN FD: ADAS steering API updates" (#1888)
Revert "Hyundai CAN FD: ADAS steering API updates (#1873)"

This reverts commit 2a758069f5.
2025-02-28 21:19:20 -08:00
Jason Wen
2a758069f5 Hyundai CAN FD: ADAS steering API updates (#1873)
* Hyundai CAN FD: Steering API updates

* comments

* comments

* keep it for now

* not used

* should use DBC spec

* consistent

---------

Co-authored-by: Shane Smiskol <shane@smiskol.com>
2025-02-28 16:05:41 -08:00
DevTekVE
67683321a3 Merge branch 'master-ref-20250228' into sync-20250228-2
# Conflicts:
#	opendbc/car/chrysler/carcontroller.py
#	opendbc/car/ford/carstate.py
#	opendbc/car/hyundai/carcontroller.py
#	opendbc/car/hyundai/carstate.py
#	opendbc/car/hyundai/hyundaicanfd.py
#	opendbc/car/hyundai/interface.py
#	opendbc/car/hyundai/values.py
#	opendbc/car/mazda/carcontroller.py
#	opendbc/car/nissan/values.py
#	opendbc/car/subaru/carcontroller.py
2025-02-28 17:40:05 +01:00
Shane Smiskol
bdcb515ffc actuators: rename steer to torque (#1869)
* Update car.capnp

* and this

* rename these

fix

* and these

* still makes sens to call this apply_steer_req
2025-02-27 15:57:33 -08:00
Jason Wen
6720c230ca Hyundai CAN-FD Longitudinal: Enable for radar-based SCC platforms (non-HDA2) (#1283)
* Hyundai CAN-FD Longitudinal: Enable for radar-based SCC platforms (non-HDA2)

* port safety to opendbc

* fix tests?

* more

* fix tests

* more

* add condition to radar disable tests

* simplify

* more explicit tx checks

* deleted for some reason, caused some models to fail tests

* merge them
2025-02-25 02:12:52 -05:00
Jason Wen
fe1690d48d Hyundai CAN-FD: Refactor HDA2 with available steering types (#1782)
* Hyundai CAN-FD: Refactor HDA2 with available steering types

* add comments
2025-02-22 01:07:42 -08:00
Jason Wen
2faa7fb9b0 Merge branch 'upstream/opendbc/master' into sync-20250124 2025-01-24 00:48:12 -05:00
Sammohana
78b33e877a Got rid of openpilot.common.numpy_fast as per https://github.com/commaai/openpilot/issues/34331 (#1626)
* removed openpilot.common.numpy_fast

* used numpy in place of openpilot.common.numpy_fast

* fixed numpy data type error

* Update opendbc/car/__init__.py

---------

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2025-01-14 14:55:43 -08:00
DevTekVE
5d399457c8 Modular Assistive Driving System (MADS) (#29)
* fix

* clearer

* cleanup

* more fix

* hkg dbc

* typo!

* Add Custom MIT License (#26)

* missed

* better

* more fixes

* try this out

* inherit in carcontroller properly

* hyundai: main button handling

* always disable

* add main check for pcm cruise

* revert

* sunnyParams

* Move car-specific changes to opendbc

* no need

* more fixes

* more!

* final?

* static analysis

* use new cereal

* rename to lkas_button

* rename

* mads base for cars

* add lkas for ford

* enabled <-> active

* MUST REMOVE test process replay

* Revert "MUST REMOVE test process replay"

This reverts commit 6dde2c8435b0e09158ab455aa215a573f5212c11.

* subaru

* ruff

* more subaru

* toyota

* add them

* mypy

* fix

* update name

* FCA

* assign directly

* init directly

* missing

* not yet

* missed

* no longer needed

* missed hd

* fix

* move to generator

* more nissan

* Apply suggestions from code review

* no need

* Revert "no need"

This reverts commit 6156c62113d9abb626014947a9066b5580f6460a.

* hyundai: move main logic out of main carstate

* move around

* move lkas and lfa icon logic to mads base

* Parse more flags from alt exp, more tests, hyundai main cruise allowed

* license

* add code spell ignore

* fix icon

* remove toyota lta status for lkas, causes weird behaviors

* parse signals inside mads methods

* more codes in mads childs

* Update opendbc/sunnypilot/car/hyundai/escc.py

* revert

* type hint

* test type hint

* more type hint

* no

* needs to be in carstate

* in another PR

---------

Co-authored-by: Jason Wen <haibin.wen3@gmail.com>
2024-12-16 09:33:18 +01:00
Jason Wen
d332152aa1 Hyundai CAN-FD: Add CAN fingerprint fallback checks for HDA2 detection (#1285)
* Hyundai CAN-FD: Add CAN fingerprint fallback checks for HDA2 detection

* fix test

* just 1 source

* update unit test

* comment

* simplify

* move hda2 to the end of arg so it's cleaner

* Update opendbc/car/hyundai/interface.py

Co-authored-by: Jason Young <46612682+jyoung8607@users.noreply.github.com>

---------

Co-authored-by: Jason Young <46612682+jyoung8607@users.noreply.github.com>
2024-09-26 23:09:46 -04:00
Shane Smiskol
9a53f08080 move selfdrive/car to opendbc (#1049)
* move most of /car

* rename selfdrive.car imports to opendbc.car

* move some car tests

move some car tests

* fix car tests

* fix actions?

* add panda ignore to pytest

* need these ignores from openpilot

* fix tests for outside pip install (openpilot/local)

forgot
2024-08-17 00:38:33 -07:00