Commit Graph

75 Commits

Author SHA1 Message Date
Jason Wen
8f970bcb99 Reapply "latcontrol_torque: lower kp and lower friction threshold (commaai/openpilot#36619)" (#1581) (#1669)
* Reapply "latcontrol_torque: lower kp and lower friction threshold (commaai/openpilot#36619)" (#1581)

This reverts commit 7560497f

* bump
2026-02-02 22:13:37 -05:00
James Vecellio-Grant
7560497f15 Revert "latcontrol_torque: lower kp and lower friction threshold (commaai/openpilot#36619)" (#1581)
* Revert " latcontrol_torque: delay independent jerk and lower kp and lower friction threshold (#36619)"

This reverts commit f01391a7d9

* revert opendbc_repo

* bump

---------

Co-authored-by: Jason Wen <haibin.wen3@gmail.com>
2025-12-17 21:32:18 -05:00
Jason Wen
03c8494dbc Merge branch 'upstream/openpilot/master' into sync-20251213
# Conflicts:
#	README.md
#	common/api.py
#	docs/CARS.md
#	opendbc_repo
#	panda
#	selfdrive/ui/mici/layouts/offroad_alerts.py
#	system/ui/README.md
#	system/version.py
2025-12-13 01:50:42 -05:00
felsager
f01391a7d9 latcontrol_torque: delay independent jerk and lower kp and lower friction threshold (#36619) 2025-11-25 10:23:02 -08:00
Jason Wen
08e85808c5 Merge branch 'upstream/openpilot/master' into sync-20251114
# Conflicts:
#	.github/workflows/ci_weekly_run.yaml
#	.github/workflows/raylib_ui_preview.yaml
#	.github/workflows/tests.yaml
#	.gitmodules
#	README.md
#	SConstruct
#	common/api.py
#	common/params_keys.h
#	docs/CARS.md
#	msgq_repo
#	opendbc_repo
#	panda
#	selfdrive/car/tests/test_car_interfaces.py
#	selfdrive/controls/controlsd.py
#	selfdrive/controls/lib/latcontrol.py
#	selfdrive/controls/lib/latcontrol_angle.py
#	selfdrive/controls/lib/latcontrol_pid.py
#	selfdrive/controls/lib/latcontrol_torque.py
#	selfdrive/controls/tests/test_latcontrol.py
#	selfdrive/monitoring/helpers.py
#	selfdrive/ui/SConscript
#	selfdrive/ui/main.cc
#	selfdrive/ui/qt/body.h
#	selfdrive/ui/qt/home.cc
#	selfdrive/ui/qt/home.h
#	selfdrive/ui/qt/network/networking.cc
#	selfdrive/ui/qt/network/networking.h
#	selfdrive/ui/qt/network/wifi_manager.cc
#	selfdrive/ui/qt/offroad/developer_panel.cc
#	selfdrive/ui/qt/offroad/developer_panel.h
#	selfdrive/ui/qt/offroad/experimental_mode.cc
#	selfdrive/ui/qt/offroad/firehose.cc
#	selfdrive/ui/qt/offroad/firehose.h
#	selfdrive/ui/qt/offroad/onboarding.cc
#	selfdrive/ui/qt/offroad/onboarding.h
#	selfdrive/ui/qt/offroad/settings.cc
#	selfdrive/ui/qt/offroad/settings.h
#	selfdrive/ui/qt/offroad/software_settings.cc
#	selfdrive/ui/qt/onroad/alerts.cc
#	selfdrive/ui/qt/onroad/annotated_camera.h
#	selfdrive/ui/qt/onroad/buttons.cc
#	selfdrive/ui/qt/onroad/buttons.h
#	selfdrive/ui/qt/onroad/driver_monitoring.cc
#	selfdrive/ui/qt/onroad/hud.cc
#	selfdrive/ui/qt/onroad/hud.h
#	selfdrive/ui/qt/onroad/model.cc
#	selfdrive/ui/qt/onroad/model.h
#	selfdrive/ui/qt/onroad/onroad_home.cc
#	selfdrive/ui/qt/onroad/onroad_home.h
#	selfdrive/ui/qt/request_repeater.h
#	selfdrive/ui/qt/sidebar.cc
#	selfdrive/ui/qt/sidebar.h
#	selfdrive/ui/qt/util.cc
#	selfdrive/ui/qt/widgets/cameraview.h
#	selfdrive/ui/qt/widgets/controls.cc
#	selfdrive/ui/qt/widgets/controls.h
#	selfdrive/ui/qt/widgets/input.cc
#	selfdrive/ui/qt/widgets/input.h
#	selfdrive/ui/qt/widgets/prime.cc
#	selfdrive/ui/qt/widgets/prime.h
#	selfdrive/ui/qt/widgets/ssh_keys.h
#	selfdrive/ui/qt/widgets/toggle.h
#	selfdrive/ui/qt/widgets/wifi.cc
#	selfdrive/ui/qt/widgets/wifi.h
#	selfdrive/ui/qt/window.cc
#	selfdrive/ui/qt/window.h
#	selfdrive/ui/tests/cycle_offroad_alerts.py
#	selfdrive/ui/tests/test_ui/run.py
#	selfdrive/ui/translations/main_ar.ts
#	selfdrive/ui/translations/main_de.ts
#	selfdrive/ui/translations/main_es.ts
#	selfdrive/ui/translations/main_fr.ts
#	selfdrive/ui/translations/main_ja.ts
#	selfdrive/ui/translations/main_ko.ts
#	selfdrive/ui/translations/main_nl.ts
#	selfdrive/ui/translations/main_pl.ts
#	selfdrive/ui/translations/main_pt-BR.ts
#	selfdrive/ui/translations/main_th.ts
#	selfdrive/ui/translations/main_tr.ts
#	selfdrive/ui/translations/main_zh-CHS.ts
#	selfdrive/ui/translations/main_zh-CHT.ts
#	selfdrive/ui/ui.cc
#	selfdrive/ui/ui.h
#	system/manager/build.py
#	system/version.py
2025-11-16 02:50:28 -05:00
felsager
736e1fa7b7 Revert "latcontrol_torque: make feed-forward jerk independent of individual platform lag (#36334)"
This reverts commit fc4e5007fd.
2025-11-03 10:31:27 -08:00
felsager
177c7f1cf3 Revert "latcontrol_torque: retune torque controller (#36392)"
This reverts commit 76c5cb6d87.
2025-11-03 10:31:22 -08:00
felsager
76c5cb6d87 latcontrol_torque: retune torque controller (#36392) 2025-10-30 13:34:44 -07:00
felsager
fc4e5007fd latcontrol_torque: make feed-forward jerk independent of individual platform lag (#36334) 2025-10-30 13:29:38 -07:00
felsager
936740201c latcontrol_torque: refactor low speed factor into pid controller (#36364) 2025-10-22 11:50:37 -07:00
felsager
a2e7f3788f LateralTorqueState: log controller version and desired lateral jerk (#36421) 2025-10-22 10:56:34 -07:00
felsager
d2bb8fe537 latcontrol_torque: more descriptive variable names (#36422) 2025-10-22 10:44:14 -07:00
Harald Schäfer
b2e3dd17ea torque gains not car specific (#36404)
* torque gains not car specific

* remove opendbc interfaces longitudinal control kf field assignment that makes hitl test fail

* typo

* another typo

* bump

* bump openbc

* update ref

---------

Co-authored-by: felsager <d.felsager@gmail.com>
2025-10-20 17:16:03 -07:00
Harald Schäfer
7534b2a160 PID: no more ff gain (#36398)
* No more ff gain

* typo
2025-10-18 11:12:47 -07:00
felsager
3546b625e7 latcontrol_torque: change in kp should not affect effective low speed factor gain (#36335) 2025-10-14 13:22:17 -07:00
felsager
de805e4af7 Lateral torque controller: use measurement rate as error rate (#36291) 2025-10-09 14:57:12 -07:00
felsager
0736f325fc Latcontrol torque: cleaner low_speed_factor calculation (#36287) 2025-10-09 10:29:35 -07:00
felsager
226465e882 Latcontrol: refactor pid error to factor out lateral jerk component (#36280) 2025-10-08 18:29:54 -07:00
felsager
2deb4e6f65 Lateral controllers: pass dt (delta time) explictly (#36281) 2025-10-08 14:39:05 -07:00
Jason Wen
de64b99740 Torque Lateral Control: customized settings (#1314)
* init

* use internal frame

* exit early if toggle not enabled

* ui init

* ui: replace `static_cast<int>` with `std::nearbyint` for precise rounding

* revert

* update title

* handle live relaxed

* fix

* tweak ui

* toggle behaviors

* lint

* Update torqued_ext.py

* always update

* make sure it's updated properly with offroad states

* fix

* make sure to initialize

---------

Co-authored-by: nayan <nayan8teen@gmail.com>
2025-10-05 23:41:31 -04:00
Jason Wen
ec8f036850 Merge branch 'upstream/openpilot/master' into sync-20250908
# Conflicts:
#	.github/workflows/selfdrive_tests.yaml
#	README.md
#	docs/CARS.md
#	opendbc_repo
#	panda
#	selfdrive/car/tests/test_car_interfaces.py
#	selfdrive/modeld/modeld.py
#	selfdrive/selfdrived/selfdrived.py
#	selfdrive/ui/translations/main_ar.ts
#	selfdrive/ui/translations/main_de.ts
#	selfdrive/ui/translations/main_es.ts
#	selfdrive/ui/translations/main_fr.ts
#	selfdrive/ui/translations/main_ja.ts
#	selfdrive/ui/translations/main_ko.ts
#	selfdrive/ui/translations/main_pt-BR.ts
#	selfdrive/ui/translations/main_th.ts
#	selfdrive/ui/translations/main_tr.ts
#	selfdrive/ui/translations/main_zh-CHS.ts
#	selfdrive/ui/translations/main_zh-CHT.ts
#	system/hardware/hardwared.py
#	system/updated/updated.py
#	tinygrad_repo
#	uv.lock
2025-09-13 15:23:36 -04:00
Jason Wen
ba1da60c25 NNLC: compute error in torque space (#1185)
* NNLC: compute error in torque space

* bump

* sp happy too

* bump

* lint

* update path

* oops

* test entire loop

* bump

* test gm

* bump

* bump
2025-08-29 22:39:25 +02:00
felsager
b976135d2f torqued: apply offset (with more robust unit test) (#36075)
* torqued: apply latAccelOffset to torque control feed forward

* test learned latAccelOffset captures roll compensation bias on straight road driving, when the device is not flush in roll relative to the car

* test correct torqued latAccelOffset parameter convergence
2025-08-27 13:06:01 -07:00
Maxime Desroches
f40f7f9ece Revert "torqued: apply offset (#36005)"
This reverts commit 1d74a97ba6.
2025-08-26 21:45:49 -07:00
Harald Schäfer
1d74a97ba6 torqued: apply offset (#36005)
* torqued: apply latAccelOffset to torque control feed forward 

* test learned latAccelOffset captures roll compensation bias on straight road driving, when the device is not flush in roll relative to the car

* test correct torqued latAccelOffset parameter convergence

---------

Co-authored-by: felsager <d.felsager@gmail.com>
2025-08-25 13:50:10 -07:00
Jason Wen
798e9071d8 Merge branch 'upstream/openpilot/master' into sync-20250823
# Conflicts:
#	.github/workflows/release.yaml
#	README.md
#	RELEASES.md
#	common/params_keys.h
#	docs/CARS.md
#	opendbc_repo
#	panda
#	release/build_stripped.sh
#	selfdrive/controls/lib/longitudinal_planner.py
#	selfdrive/modeld/modeld.py
#	selfdrive/ui/feedback/feedbackd.py
#	selfdrive/ui/translations/main_ar.ts
#	selfdrive/ui/translations/main_de.ts
#	selfdrive/ui/translations/main_es.ts
#	selfdrive/ui/translations/main_fr.ts
#	selfdrive/ui/translations/main_ja.ts
#	selfdrive/ui/translations/main_ko.ts
#	selfdrive/ui/translations/main_pt-BR.ts
#	selfdrive/ui/translations/main_th.ts
#	selfdrive/ui/translations/main_tr.ts
#	selfdrive/ui/translations/main_zh-CHS.ts
#	selfdrive/ui/translations/main_zh-CHT.ts
#	system/version.py
#	uv.lock
2025-08-24 14:52:21 -04:00
Shane Smiskol
ab44c9a4ff Torque controller: refactor calculations to be in accel space (#35790)
* clean up

* little confusing but works

* clean up

* fix

* pid outputs torque again, fix windup above max torque

* clean up

* fix

* fix

* typo

* fix conflicts

* fix PID

* cleanups

* seems correct

* updte

* inverse

* whitespace

* move

* small cleanup

* more cleanup

* update ref

---------

Co-authored-by: Bruce Wayne <harald.the.engineer@gmail.com>
2025-08-15 11:39:56 -07:00
Jason Wen
6c4c0c00b4 Merge branch 'upstream/openpilot/master' into sync-20250812
# Conflicts:
#	opendbc_repo
#	selfdrive/controls/controlsd.py
#	selfdrive/controls/lib/latcontrol_angle.py
#	selfdrive/controls/lib/latcontrol_pid.py
#	selfdrive/controls/lib/latcontrol_torque.py
2025-08-12 23:11:18 -04:00
Harald Schäfer
455a6a586a Misc PID refactors (#35844)
* Misc PID refactors

* dead

* finish rename

* unused import

* whitespace

* typo

* fix fan controller

* pid_log

* whitespace

* integral clipping in pid

* update ref

* cleaner

* rm print

* update ref

* revert fan changes

* forgot this
2025-08-11 14:25:29 -07:00
Jason Wen
97c2d7e655 Merge branch 'upstream/openpilot/master' into sync-20250809
# Conflicts:
#	common/params_keys.h
#	opendbc_repo
#	panda
#	selfdrive/car/cruise.py
#	selfdrive/controls/controlsd.py
#	selfdrive/selfdrived/selfdrived.py
#	selfdrive/test/process_replay/process_replay.py
#	selfdrive/ui/qt/setup/setup.cc
#	tinygrad_repo
2025-08-10 02:05:05 -04:00
DevTekVE
9dc98b36be refactor: cleanup gravity constant handling (#35866)
* refactor: move lateral methods from init to lateral.py (#2594)

* Extracting lateral methods to lateral.py

* cleaning

* more cleaning

* more cleaning

* Making sure it remains where it should

* Leave rate_limit where it belongs

* Moving things to `car/controls/`

* Moving rate limit to get a taste of the changes

* clean

* copy verbatim

* clean up

* more

* now we can format

---------

Co-authored-by: Shane Smiskol <shane@smiskol.com>

* No need to change order of import

* refactor: consolidate ACCELERATION_DUE_TO_GRAVITY import path

* bump opendbc

* update refs

* don't import from opendbc

---------

Co-authored-by: Shane Smiskol <shane@smiskol.com>
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2025-08-02 11:20:18 -07:00
Jason Wen
d6474aa0a9 Merge branch 'upstream/openpilot/master' into sync-20250731
# Conflicts:
#	.github/workflows/selfdrive_tests.yaml
#	common/params.h
#	common/params_keys.h
#	common/params_pyx.pyx
#	docs/CARS.md
#	opendbc_repo
#	panda
#	selfdrive/car/tests/test_models.py
#	selfdrive/pandad/pandad.cc
#	selfdrive/pandad/pandad.h
#	selfdrive/selfdrived/selfdrived.py
#	selfdrive/ui/translations/main_ar.ts
#	selfdrive/ui/translations/main_de.ts
#	selfdrive/ui/translations/main_es.ts
#	selfdrive/ui/translations/main_fr.ts
#	selfdrive/ui/translations/main_ja.ts
#	selfdrive/ui/translations/main_ko.ts
#	selfdrive/ui/translations/main_pt-BR.ts
#	selfdrive/ui/translations/main_th.ts
#	selfdrive/ui/translations/main_tr.ts
#	selfdrive/ui/translations/main_zh-CHS.ts
#	selfdrive/ui/translations/main_zh-CHT.ts
#	system/athena/athenad.py
#	system/athena/manage_athenad.py
#	system/manager/manager.py
#	system/sentry.py
#	uv.lock
Sync: `commaai/opendbc:master` into `sunnypilot/opendbc:master`

Sync: `commaai/panda:master` into `sunnypilot/panda:master`
2025-08-02 00:21:14 -04:00
DevTekVE
1966845fc9 refactor: move lateral methods from init to lateral.py (#35856)
* refactor: move lateral methods from init to lateral.py (#2594)

* Extracting lateral methods to lateral.py

* cleaning

* more cleaning

* more cleaning

* Making sure it remains where it should

* Leave rate_limit where it belongs

* Moving things to `car/controls/`

* Moving rate limit to get a taste of the changes

* clean

* copy verbatim

* clean up

* more

* now we can format

---------

Co-authored-by: Shane Smiskol <shane@smiskol.com>

* No need to change order of import

---------

Co-authored-by: Shane Smiskol <shane@smiskol.com>
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2025-08-01 15:17:37 -07:00
Shane Smiskol
bc7d6f2677 torque controller: clean up friction (#35781)
* conditional friction inside here is confusing

* do it here

* one line

* run

* bump
2025-07-21 20:27:34 -07:00
Jason Wen
beaec753ab Merge branch 'upstream/openpilot/master' into sync-20250710
# Conflicts:
#	.github/workflows/selfdrive_tests.yaml
#	README.md
#	common/params_keys.h
#	opendbc_repo
#	panda
#	selfdrive/controls/lib/longitudinal_planner.py
#	selfdrive/controls/lib/tests/test_latcontrol.py
#	selfdrive/ui/soundd.py
#	selfdrive/ui/translations/main_ar.ts
#	selfdrive/ui/translations/main_de.ts
#	selfdrive/ui/translations/main_es.ts
#	selfdrive/ui/translations/main_fr.ts
#	selfdrive/ui/translations/main_ja.ts
#	selfdrive/ui/translations/main_ko.ts
#	selfdrive/ui/translations/main_pt-BR.ts
#	selfdrive/ui/translations/main_th.ts
#	selfdrive/ui/translations/main_tr.ts
#	selfdrive/ui/translations/main_zh-CHS.ts
#	selfdrive/ui/translations/main_zh-CHT.ts
#	tinygrad_repo
2025-07-19 00:28:43 -04:00
Harald Schäfer
20fdb686ca latcontrol torque: remove option to feed back on localizer (#35659)
* Localizer is too laggy for control

* typo

* typo

* fix test

* fix imports

* Revert "fix imports"

This reverts commit 5074f8050170f974b451e00d9fdc752f09a47d57.

* fix improt

* import
2025-07-08 14:12:46 -07:00
Tim Wilson
bcdb546638 NNLC: decreased low-speed factor (#822)
* NNLC: decreased low-speed factor

* np.float to float

* format

* add tests for sanity check

---------

Co-authored-by: Discountchubbs <159560811+Discountchubbs@users.noreply.github.com>
Co-authored-by: Jason Wen <haibin.wen3@gmail.com>
2025-04-19 11:47:47 -04:00
Jason Wen
d21e351003 Controls: Lateral Accel Torque Control Extension (#690)
* init

* more init

* keep it alive

* fixes

* more fixes

* more fix

* new submodule for nn data

* bump submodule

* update path to submodule

* spacing???

* update submodule path

* update submodule path

* bump

* dump

* bump

* introduce params

* Add Neural Network Lateral Control toggle to developer panel

This introduces a new toggle for enabling Neural Network Lateral Control (NNLC), providing detailed descriptions of its functionality and compatibility. It includes UI integration, car compatibility checks, and feedback links for unsupported vehicles.

* decouple even more

* static

* codespell

* remove debug

* in structs

* fix import

* convert to capnp

* fixes

* debug

* only initialize if NNLC is enabled or allow to enable

* oops

* fix initialization

* only allow engage if nnlc is off

* fix toggle param

* fix tests

* lint

* fix more test

* capnp test

* try this out

* validate if it's not None

* make it 33 to match

* align

* share the same friction input calculation

* return stock values if not enabled

* unused

* split base and child

* space

* rename

* NeuralNetworkFeedForwardModel

* less

* just use file name

* try this

* more explicit

* rename

* move it

* child class for additional controllers

* rename

* time to split out custom lateral acceleration

* move around

* space

* fix

* TODO-SP

* TODO-SP

* split nnlc and custom lat accel

* more

* not yet

* comment

* fix

---------

Co-authored-by: DevTekVE <devtekve@gmail.com>
2025-03-20 16:01:08 -04:00
Shane Smiskol
6891b795c4 controls: limit max curvature from lateral acceleration (#34651)
* limit max curvature with lateral accel too

* not a guideline

* roll compensation in curv clip

* improve clipping and alerting

* typo

* clean up

* no float

* get ready

* good idea

* good

* redundant

* TODO

* test

* do max curvature clip last

* flip

---------

Co-authored-by: Bruce Wayne <harald.the.engineer@gmail.com>
2025-03-03 19:47:52 -08:00
Shane Smiskol
68d22b960b rename steer_limited (#34763)
rename
2025-03-03 16:28:49 -08:00
Shane Smiskol
6723106bf5 Move vehicle_model.py to opendbc (#34681)
* move

* fix

* move test too

* bump

* better

* bump to master
2025-02-26 17:35:43 -08:00
Sammohana
8eebce75ac Getting rid of openpilot.common.numpy_fast (#34368)
* Got rid openpilot.common.numpy_fast

* fixed some data type erros

* importing numpy instead of importing specific functions

* fixing some numpy importing mistakes

* Update selfdrive/car/cruise.py

---------

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2025-01-14 14:52:56 -08:00
Adeeb Shihadeh
fecf6134ef move PID controller to common/ (#33419)
old-commit-hash: f59a1bf003
2024-08-31 16:49:29 -07:00
Shane Smiskol
4f019b5f60 move selfdrive/car to opendbc (#32630)
* move most of /car

* move some car tests

move some car tests

* fix selfdrive/car/tests

* fix selfdrive/controls tests

* fix the rest of the selfdrive tests

* bump opendbc

* fix all tests

* few more non-test references

* remove opcar and move docs to car

fix these debugging scripts

fix docs

* bump opendbc and panda

forgot panda
old-commit-hash: e735a7f379
2024-08-17 00:54:51 -07:00
Kacper Rączy
80bc61dc6c controlsd: use livePose (#33283)
* Pose calibrator

* Fix static analysis

* Fix static

* Fix test_latcontrol

* Fix test_latcontrol

* Update services in process replay

* Fix static

* Matmul not mul

* Add assertion

* Move pose calibration to data_sample

* Update ref commit

* Remove llk from cycle alerts

* Deprecated nogps event

* Switch power_draw to lp

* Bring back noGps alert

* Add handling code back

* get_bool

* Bring inputsok back
old-commit-hash: 9734015bbb
2024-08-13 21:11:16 -07:00
Shane Smiskol
3953eba4ac controlsd: no mutable carParams (#32381)
* no as builder

* fix car int test

* more
old-commit-hash: c95b58401a
2024-07-02 13:27:45 -07:00
Vivek Aithal
80195f1432 LatControlTorque: Add more inputs (#31252)
* add history and state to the ff inputs

* add history

* resolve comments

* remove history, simplify

* don't compute lateral accel, roll comp always
old-commit-hash: 056b330e8b
2024-02-01 04:12:48 -08:00
Harald Schäfer
f2106e0601 No curv rate for lateral control (#31042)
* No more Curvature rate for lat control

* Update cereal

* Update

* Fix lat control test
old-commit-hash: d36103791c
2024-01-17 16:00:50 -08:00
Adeeb Shihadeh
f408eb207a remove unused last_actuators arg from lateral controllers (#30595)
old-commit-hash: ce4bac8218
2023-12-03 15:54:18 -08:00
Adeeb Shihadeh
16ec56398c add openpilot prefix to imports (#29498)
* add openpilot prefix to imports

* more

* more

* fix docs

* fix linter

* bump submodules

* fix patched tests

* update dynamic imports

* debug

* Revert "debug"

This reverts commit db5e13b9911cc74438bee123bc3430da6c31b24b.

* fix pm test
old-commit-hash: a9626f95b6
2023-08-20 20:49:55 -07:00