Commit Graph

591 Commits

Author SHA1 Message Date
Suyog Shinde
2d91aa5abc locationd: fix velocity calibration using wrong pose field (#36844) 2025-12-11 19:24:32 -08:00
Kacper Rączy
889ce4c4fb torqued: add DEBUG flag (#36161)
Add a debug flag to torqued
2025-09-15 21:04:33 +00:00
Jason Young
839a773345 enable lateral accel factor learning for Honda (#35936)
enable torqued for Honda
2025-08-06 16:11:07 -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
Maxime Desroches
e7b80b78cc params: auto type cast on put (#35810)
* start

* fix

* fix

* more

* more

* more

* fix

* fix

* []

* f

* f

* fix

* lint

* back

* fix

* yep

* better msg

* fix

* fix

* fix

* fix

* more

* more
2025-07-25 19:20:49 -07:00
Simon Kuang
b4ae64358e Update vehicle model reference to 2023 edition of Guiggiani's book (#35805)
Update car_kf.py
2025-07-25 12:57:13 -07:00
Kacper Rączy
44c8cc4cb0 Revert "lagd: disable in release (#35426)" and "lagd calib: hide on release (#35523)" (#35633)
* Revert "lagd: disable in release (#35426)"

This reverts commit 6f6adc10a8.

* Revert "lagd calib: hide on release (#35523)"

This reverts commit e345f25ce4.

* Fix conflict
2025-07-07 10:18:31 +02:00
Harald Schäfer
d1893ee3eb OS camera calibration (#35603)
* wider narrow

* typo

* whiteapace
2025-06-25 22:08:56 -07:00
Shane Smiskol
bfa3f3cccb Add calPerc progress tracking for torque calibration (#35512)
* Add calPerc field and torque progress

* Fix torqued test style and CarParams usage

* test: remove unused numpy import

* move here

* trying all combinations to see what's most linear

* clean up with best method

* no no

* epic

* clean up

* last min not needed

* doesn't hurt

* list comp
2025-06-10 00:22:13 -07:00
Shane Smiskol
75b6ec68c6 Add lagd calibration percentage (#35511)
* lagd: publish calibration percentage

* Refine lagd calibration progress

* stash

* cleanup (match calibrationd calculation logic)

* no no no

* nor

* two lines
2025-06-09 22:10:47 -07:00
Shane Smiskol
6f6adc10a8 lagd: disable in release (#35426)
* disable in release

* pass

* one liner

* Update selfdrive/locationd/lagd.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* test

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-02 21:29:05 -07:00
Shane Smiskol
8695134b08 Faster lagd test (#35430)
* disable in release

* pass

* one liner

* saves 1s so far

* clean up

* fix

* Revert "one liner"

This reverts commit 5f419b5692565fc7ddc2abe9a40112fdc47ffe9e.

Revert "pass"

This reverts commit 47d260e76a9cb1310b95ea1ff83ab7f8808be96d.

Revert "disable in release"

This reverts commit 1782718b61891d87cbb9daa1c4c65314f505cee4.

* clean up

* there's more

* no mocker!
2025-06-02 21:14:53 -07:00
Shane Smiskol
1a84b05bde lagd: make method static 2025-06-02 20:53:11 -07:00
Kacper Rączy
97ad175243 Reapply "Enable online lag learning (#34968)" (#35327)
* Revert "Revert "Enable online lag learning (#34968)" (#35322)"

This reverts commit 9c40c48729.

* Update ref commit

* Update ref

* Update ref commit
2025-05-24 02:31:17 +00:00
Kacper Rączy
312658756d lagd: handle ambiguous cases (#35257)
* Mechanism to handle ambiguous estimates

* Use it

* Fix static

* Fix

* Comment

* Comment v2

* Use quantile instead

* Fix

* Make it better

* Make it confidence

* Make it a constant

* min_confidence as arg

* Make the test signal more like the real one

* Relax sample requirements

* Use constant

* Reduce confidence
2025-05-23 01:33:55 +00:00
Kacper Rączy
9c40c48729 Revert "Enable online lag learning (#34968)" (#35322)
* Revert "Enable online lag learning (#34968)"

* Update ref commit
2025-05-22 01:55:19 +00:00
Kacper Rączy
f242b1e88a lagd: remove saved param if mismatch (#35217)
Remove LiveDelay on mismatch
2025-05-14 03:18:14 +00:00
Kacper Rączy
cbec1886e7 paramsd: remove saved param if mismatch (#35215)
remove LiveParametersV2
2025-05-14 02:26:28 +00:00
Kacper Rączy
45b273328d Enable online lag learning (#34968)
* Use in modeld

* Use in torqued

* Do not use default value in torqued

* Add liveDelay in process replay

* update ref

---------

Co-authored-by: Bruce Wayne <harald.the.engineer@gmail.com>
2025-05-01 11:42:49 -07:00
Kacper Rączy
15326c2d30 lagd: check for validity of the estimate when restoring state (#35034)
Do not restore if invalid
2025-04-18 01:37:48 +00:00
Kacper Rączy
06a9483a24 lagd: estimate std (#35009)
* Std

* Fix static

* Refactor

* Assert std zero
2025-04-17 23:49:30 +00:00
Kacper Rączy
60da5dd39a lagd: check sensors valid (#35027)
* Check if sensors valid

* Fix test

* Fix static

* Constants

* time buffer for pose valid

* Fix static
2025-04-17 09:35:30 +02:00
Kacper Rączy
f237649a7a Reapply "Online lateral lag learning" (#34975)
* Online lateral lag learning (#34974)

This reverts commit b4cc9e68d1.

* pad to the best size for fft

* Fix static analysis

* Add typing

* Fix typing

* MAX_LAG

* Calculate cross correlation regardless if the points are valid

* Back to lagd

* Add lagd to process_config

* Lagd in test onroad

* Move lag estimator for lagd

* Remove duplicate entry from test_onroad

* Update process replay

* pre-fill the data

* Update cpu usage

* 25sec window

* Change the meaning of lateralDelayEstimate

* No newline

* Fix typing

* Prefill

* Update ref commit

* Add a unit test

* Fix static issues

* Time limit

* Or timeout

* Use mocker

* Update estimate every time

* empty test

* DT const

* enable RIVIAN again

* Update ref commit

* Update that again

* Improve the tests

* Fix static

* Add masking test

* Increase timeout

* Add liveDelay to selfdrived

* Add liveDelay to selfdrived in process_replay

* Fix block_avg restore after num_blocks

* regen most

* Update bolt

* Update ref commit

* Change the key name

* Add assert

* True weighted average
2025-04-09 22:31:07 +00:00
Kacper Rączy
fc65a8ea8f paramsd: cache backwards compatibility (#34991)
* LiveParametersV2 key

* Param key

* Fix tests

* Remove old params if error

* Update exception message

* Update the test

* Add test for corrupted byte format in v1

* Rename params_reader => params
2025-04-08 02:23:11 +00:00
Kacper Rączy
490c53e2dc locationd: make pose_kf inherit from KalmanFilter (#34982)
* Read message not json for initial state

* Delete lines

* Fix param
2025-04-05 05:48:34 +00:00
Kacper Rączy
1e3f6599bd calibrationd: read carParams from Params (#34981)
* Read CarParams once from Params

* Remove it from process replay
2025-04-04 23:05:36 +00:00
Kacper Rączy
b4cc9e68d1 Revert "Online lateral lag learning" (#34974)
Revert "Online lateral lag learning (#34531)"

This reverts commit 1034dbd37c.
2025-04-01 21:44:30 +00:00
Kacper Rączy
1034dbd37c Online lateral lag learning (#34531)
* Add struct and services

* Proof of concept

* Use vego

* Process replay support

* Fix issues

* Max not min

* Remove print

* Make lag positive

* Points and updates

* Sliding cross corr

* Stuff

* Remove redundant param

* Move to lagd

* Update alert

* Something that works

* Report isEstimated

* Corr field

* Use skimage masked corr

* Fixes

* Move to lat_accel_loc

* Use the delay it in the model

* Mark as executable

* Add 0.2 to initial

* add install line

* Back to 5m window

* Move the import up

* corr window 120

* Show is estimated

* Sort messages

* New impl

* Fix

* Params

* Set initial_lag elsewhere

* Add param

* Rename Param

* Fix type isues

* More blocks

* Masked fft NCC implementation

* Remove package installation

* Use 20hz data and interp the correlation peak

* Move ncc code to separate function

* steering_saturated support

* Constants

* Add recovery buffer

* Fix static

* min_valid_block_count nad liveDelay

* lateralDelayEstimate

* Fix comm issues. Do estimations at 4hz

* Fix

* Display the estimate

* Increase the block size

* Cache every minute

* DEBUG flag

* Add progress to the alert

* Fix crash

* points only in debug

* Fix BlockAverage restoration

* Comment

* Move estimators into estimator directory

* Remove lagd

* Feed only relevant messages

* Rewrite as a set literal

* np.diag with P_initial

* Fix static

* Struct renames

* Update ref commit

* Make it nicer

* Some renames
2025-04-01 04:02:02 +00:00
Kacper Rączy
39d4148c70 paramsd: cache restore unit test (#34966)
* Add a test

* Fix P_init restore

* Add migration to the first test

* Reuse the route from lld scenarios test
2025-04-01 01:45:58 +00:00
Kacper Rączy
ffcbdc8c43 paramsd: catch all exceptions during migration (#34965)
Catch all exceptions during migration
2025-03-31 23:59:29 +00:00
Kacper Rączy
75cc300480 paramsd: refactor VehicleParamsLearner (#34955)
* Refactor ParamsLearner

* Make it VehicleParamsLearner

* Fix

* Use capnp serialization instead of json

* Fix speed

* Remove redundant comments

* Monitor observed_roll

* Just use init_state

* Comment

* Improve reset

* Set globals api

* Typing for return value

* Redo reset messaging

* Remove usages of math

* Fix process_replay custom_params

* Type ignores for rednose fields

* Remove import

* Reset previous values too

* Update ref_commit

* Revert it

* Bring it back

* Remove more

* Add migration for cached params
2025-03-31 20:07:39 +00:00
Shane Smiskol
c55ef3ae1b Rivian: enable torqued learning (#34912) 2025-03-20 17:09:52 -07:00
Kacper Rączy
3652dff77a paramsd: allow uncalibrated values while calibrating (#34852)
* Use uncalibrated values

* Use calib_valid

* Move valids together

* Add calibration valid field

* Add migration block for new field

* No paramsdTemporaryError while calibrating

* comment

* Fix static issues

* Update ref commit

* Comment

* Remove redundant field

* check for calstatus in selfdrived

* Remove comment

* Update ref commit
2025-03-13 07:51:25 +01:00
Shane Smiskol
0789877cd3 paramsd: fix unbounded yaw rate while calibrating (#34806)
* rm

* comments

* default values when yaw rate invalid

* clean up

Revert "default values when yaw rate invalid"

This reverts commit e983abb3b009f15a57ebdfbadd4f616aba5b266e.

do the same for yaw rate we do for roll

and

* 1 is fine

* update refs

---------

Co-authored-by: Kacper Rączy <gfw.kra@gmail.com>
2025-03-06 22:44:09 -08:00
Kacper Rączy
00a0547978 paramsd: invalid angle offset alert (#34715)
* Add angle offset valid field

* Remove print

* Move it

* Add check in selfdrived

* Same thing for stiffnessFactor and steerRatio

* Fix

* Alert callback

* Fix bugs

* Fix

* Update events

* Make it functional

* Ref commit

* Update ref commit

* Remove dot

* Fix

Fix formatting

* Default values

* Update ref commit
2025-02-28 18:40:12 +01:00
Shane Smiskol
8f3e773977 actuators: rename steer to torque (#34724)
* bump

* temp fix

* fix

* forgot these
2025-02-27 16:12:55 -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
Adeeb Shihadeh
d98a554b17 tici: set core affinity for all realtime processes (#34574) 2025-02-11 21:20:31 -08:00
Kacper Rączy
a8b829167d locationd: use cloudlog (#34508)
* Use cloudlog instead of print

* Changes
2025-01-30 22:36:20 +00:00
Shane Smiskol
1d86afdf83 carName -> brand (#34474)
* bump

* brand

* body is lower
2025-01-25 01:39:06 -06:00
Kacper Rączy
93a8a18b6d locationd: frequency based bad observation resiliance and recovery (#34476)
* Improve it

* Fix static

* Fix test_consistent_timing_spikes test

* Fix tests

* Comment

* Remove crap
2025-01-25 05:38:20 +00: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
Maxime Desroches
e9246df02e ci: faster unit tests (#34161)
* fast

* lint

* try

* clean

* this

* try even more

* more

* maybe

* what

* maybe?

* maybe

* try this

* fix

* fast?

* now cache?

* debug

* again...

* maybe

* NOW!

* revert, this is already enough (for now?)
2024-12-05 16:41:38 -08:00
Kacper Rączy
eccdf8d880 locationd: timing spikes resiliance (#34080)
* Locationd scenario for timing spike

* Add test for consistent timing spike

* Resiliance to bad timing

* Test update

* Refactor test

* fix comment

* Decay based on frequency

* Fix

* Update comment

* Only for critical services

* Fix tests
2024-11-25 20:46:05 -08:00
Dean Lee
7a11d0180b locationd: improve circular buffer handling with np.roll (#33470)
improve circular buffer handling
2024-09-19 13:09:41 -07:00
Dean Lee
aca0ee3eea locationd: replaced the loop and setattr with direct attribute assignment (#33466)
replaced the loop and setattr with direct attribute assignment
2024-09-18 22:19:57 -07:00
Dean Lee
6dba364556 locationd: remove obsolete locationd.h (#33464)
remove obsolete locationd.h
2024-09-04 08:03:01 -07:00
Kacper Rączy
236dffe400 locationd no GPS (#33029)
* Pose kf draft

old-commit-hash: 17dd4d576e597792f0e18826498c00076739f92b

* Fix it

old-commit-hash: 13ac120affe58fd22e871586ea5f4d335b3e9d2b

* Add translation noise

old-commit-hash: 166529cb612858c4ce80649367ac35b2b6007e1d

* Add gravity to acc

old-commit-hash: 8fcfed544b8e090ccc86b189c13bc03c6c190613

* Use pyx

old-commit-hash: 8e69e0baa0a4c43b4d0c22535711f296f05420aa

* Indent

old-commit-hash: 25b19a73644cdcb571ccf1a1d8acb88a0d066c67

* Reset function

old-commit-hash: ca5d2736da15e4fd6539f7268133320735b7c9cc

* Add device_from_ned and ned_from_device transformations

old-commit-hash: a60d25da0edc311e583549dc015fa595749fd4ae

* Fix rotations

old-commit-hash: d6d582f7f6d19a2bc2308dbcb0c9f81363e325b6

* kms

old-commit-hash: 681bc4e50374795ccc61422c3ce4ffb51389fce2

* Centripetal acceleration

old-commit-hash: 6e574506d27e5b76a04b2097d94efa4ca91ead71

* Rewrite draft

old-commit-hash: 4a2aad0146267460e5d30036c8cdb2bef94d1d7c

* Remove old locationd stuff

old-commit-hash: c2be9f7dbf22fb5cd29e437cd7891a7d52266fba

* Python process now

old-commit-hash: 83fac85f28c0b546b6965aafe1dd8a089e67f5b3

* Process replay fix

old-commit-hash: c44f9de98583c49dad0b22497869b3bb0266fcd9

* Add checks for timing and validity

old-commit-hash: aed4fbe2d00ca620e01a0e0ee99a4871c939de36

* Fixes

old-commit-hash: 3f052c658c16984a34915f38afdfbfd0fb19a267

* Process replay config fixes

old-commit-hash: 1c56690ee7ceb3c23c9ec2b2713352191212716e

* static analysis fixes

old-commit-hash: 6145e2c140ea9aa97e75069c3ddd82172cadc866

* lp in latcontrol

old-commit-hash: 9abf7359d68e794c69052724f3aca14b04dd3cca

* Fix SensorEvent name for acceleration

old-commit-hash: 91a1ad6c604727c9c898ba4aefe9478022b167fd

* Ignore sensor readings from segments with multiple imus

old-commit-hash: 1f05af63d6cc605ea98d7da0d727a5bd8d7819b0

* Update shebang

old-commit-hash: e3f2f5c10df3a4ba698421335bfeffc63d1a8797

* Replace llk with lp

old-commit-hash: 99b6c7ba08de6b703708fef0b8fd2d8cb24b92c0

* Refactor locationd scenario test

old-commit-hash: 7f5f788f071b7647e36f854df927cc5b6f819a84

* Add more debugging tools

old-commit-hash: 8d4e364867e143ea35f4bfd00d8212aaf170a1d1

* Param name update

old-commit-hash: 5151e8f5520f067e7808e3f0baa628fbf8fb7337

* Fix expected observations

old-commit-hash: d6a0d4c1a96c438fb6893e8b6ff43becf6061b75

* Handle invalid measurements

old-commit-hash: 549362571e74ad1e7ec9368f6026378c54a29adf

* Fix spelling

old-commit-hash: eefd7c4c92fb486452e9b83c7121d2599811852b

* Include observations in debug info too

old-commit-hash: 625806d1110b3bffe249cd1d03416f2a3f2c1868

* Store error instead of expected observation

old-commit-hash: 1cb7a799b67e56af4eddc6608d5b0e295f2d888c

* Renames

old-commit-hash: a7eec74640fc5cc7a5e86172d2087b66cb93d17d

* Zero the yaw

old-commit-hash: 96150779590fcb8ac50e8ffe8f8df03105983179

* New state_dot for orientation

old-commit-hash: c1456bf3a0c5af2f888aa6ff0b5ffc2e5516ddf7

* Fix the state transformations

old-commit-hash: 7cb9b91e2f99caa4ac3fb748c7f23bb8bf9f65db

* Update process in test_onroad

old-commit-hash: 854afab7c39ca7dec2b42974cecbb5310b82b617

* Test polling on cameraOdometry

old-commit-hash: a78e8b7d61618177f15c9892e2fa1e51620deca8

* Keep the copy of x and P returned from predict

old-commit-hash: 3c4159a6a7d7383265a99f3f78f8805d2fcfc8cd

* Remove polling again

old-commit-hash: f7228675c5fd2de5f879c4786859f1abcec27d68

* Remove locationd.cc

old-commit-hash: d7005599b2b178e688c3bd1959d6b69357d3a663

* Optim in _finite_check

old-commit-hash: 58ad6a06b9380960e9f69eb98663ddb97461e8d5

* Access .t once

old-commit-hash: d03252e75ed4cbdb49291a60c904568e6a3d3399

* Move the timing check to cam odo code path

old-commit-hash: 6a1c26f8c201e1feb601753f0cb7299cf981b47e

* Call all_checks only once

old-commit-hash: 373809cebf8d9db89d1ab00f4c8c933f33038e78

* Do not sort

old-commit-hash: 2984cd02c0ab76827b8c7e32f7e637b261425025

* Check sm.updated

old-commit-hash: 11c48de3f0802eb4783899f6a37737078dbf2da4

* Remove test_params_gps

old-commit-hash: 82db4fd1a876cc2402702edc74eba0a8ac5da858

* Increase tolerance

old-commit-hash: 927d6f05249d2c8ec40b32e2a0dcde8e1a469fb3

* Fix static

old-commit-hash: 2d86d62c74d5ac0ad56ec3855a126e00a26cd490

* Try separate sockets for sensors

old-commit-hash: 5dade63947ab237f0b4555f45d941a8851449ab1

* sensor_all_checks

old-commit-hash: e25f40dd6b37ee76cd9cc2b19be552baf1355ec3

* Fix static

old-commit-hash: 328cf1ad86079746b4f3fde55539e4acb92d285e

* Set the cpu limit to 25

old-commit-hash: 7ba696ff54c5d3bfa42e42624d124f2a1914a96d

* Make it prettier

old-commit-hash: cd6270dec80d8b9dac784ddd4767a1a46bcff4b7

* Prettier

old-commit-hash: 1b17931d23d37f299dad54139eaf283a89592bf5

* Increase the cpu budget to 260

old-commit-hash: 20173afb937a2609c8a9905aee0b2b093cb8bba4

* Change trans std mult. 2 works better

* Update ref commit

* Update ref commit
2024-09-04 11:54:57 +02:00
Kacper Rączy
012162e816 Deprecate liveLocationKalman (#33405)
* Remove usages of llk

* Deprecate it

* Add scenarios back

* Fix orientationNED valid

* Regenerate

* Increase tolerances and update segment

* Remove calibration
old-commit-hash: 282eae3c30
2024-08-30 02:07:16 -07:00
Kacper Rączy
8315623257 paramsd: remove usages of llk nested structures (#33317)
* Remove usages of llk nested structures

* Rename to debugFitlerState

* Semicolon

* Initial parameters debugFilterState
old-commit-hash: 51fae363e4
2024-08-16 14:25:42 -07:00