Commit Graph

76 Commits

Author SHA1 Message Date
Adeeb Shihadeh
cfc16a88c5 improved alert verbosity (#24434)
* improved alert verbosity

* better testing script

* better description

* speed diff

* touch ups

* fix that
old-commit-hash: b1858df00e
2022-05-16 21:19:38 -07:00
Willem Melching
0a2c2a6b28 Add unittest for alert callbacks (#24551)
add alert callback test
old-commit-hash: 31af13101b
2022-05-16 16:25:52 +02:00
Shane Smiskol
bf744c0410 tests: add overriding to state machine test (#24131)
* add overriding to state machine test

* overriding should consider soft disable too
old-commit-hash: d7a708d6da
2022-04-05 11:36:18 -07:00
Shane Smiskol
8e11fbe2db controlsd: add state machine tests (#24107)
* Handle NO_ENTRY in PRE_ENABLED

* add test

* add preEnabled NO_ENTRY test

* stash

* test soft disable

* tuples

* remove overriding until it's merged in

* use Events class

* fix tests and split out

* don't rely on controlsd's counter
old-commit-hash: d4f330447a
2022-04-04 17:13:29 -07:00
Jonathan Frey
baab5d7a7b Cython acados and minor (#23835)
* acados_ocp_solver_pyx.pyx: implement get_stats for timings and ints

* long_mpc: use acados timers

* acados_ocp_solver_pyx.pyx: fix dynamics_get

* acados_ocp_solver_pyx.pyx: get statistics

* use acados_ocp_solver_pyx.pyx from commaai/cython2 branch

* acados_ocp_solver_pyx.pyx: implement store_iterate

* acados_ocp_solver_pyx.pyx: implement get_residuals

* acados_ocp_solver_pyx.pyx: fix set() for empty fields

* acados_ocp_solver_pyx.pyx: load_iterate

* cython acados: add print_statistics

* test_following_distance: fix typo

* test_longitudinal: unique names for test maneuvers

* longitudinal MPC: comments for evaluation

* longitudinal MPC: add comments to eval acados residuals

* long_mpc: use qp_solver_cond_N = 1

* long MPC: comments, simplify set_cur_state

* update acados version in build script

* longitudinal mpc: weigh a_change in 1 place only

* update ref

* Update ref

Co-authored-by: Harald Schafer <harald.the.engineer@gmail.com>
old-commit-hash: d09dffb7cd
2022-02-25 14:16:44 -08:00
Adeeb Shihadeh
70f1418256 remove community features toggle (#23214)
* remove community features toggle

* bump cereal

* little more

* update refs
old-commit-hash: 3e9cb7fa12
2022-01-24 14:49:47 -08:00
Jonathan Frey
6f4c93238f work on acados lateral MPC (#23558)
* lat_mpc: make v_ego, rotation_radius parameters instead of states

* lat_mpc: remove rotation_radius argument, since it is part of the parameters

* lat_mpc: use qp_solver_cond_N = 1

slightly faster and in line with case study in Fig. 2/ 3 in Frison2016 - https://cdn.syscop.de/publications/Frison2016.pdf
An Efficient Implementation of Partial Condensing for Nonlinear Model Predictive Control

* adapt test_lateral_mpc to formulation with parameters

* lat_mpc: set parameters in reset() and copy values

* acados_ocp_solver_pyx: make options_set useable

* update ref

Co-authored-by: Willem Melching <willem.melching@gmail.com>
old-commit-hash: 0681474840
2022-01-18 09:49:48 -08:00
Dean Lee
98de810849 check in tuple instead of list (#23477)
* check in tuple instead of list

* Update selfdrive/car/toyota/carcontroller.py

Co-authored-by: Willem Melching <willem.melching@gmail.com>

* Update selfdrive/car/mazda/interface.py

Co-authored-by: Willem Melching <willem.melching@gmail.com>

Co-authored-by: Willem Melching <willem.melching@gmail.com>
old-commit-hash: a653461dec
2022-01-10 16:36:51 +01:00
Ewout ter Hoeven
a962365292 Convert format strings strings to f-strings (#23241)
* Convert all text strings to f-strings

Reformats all the text from the old "%-formatted" and .format(...) format to the newer f-string format, as defined in PEP 498. This requires Python 3.6+.

Flynt 0.69 was used to reformat the strings. 120 f-strings were created in 51 files.

F-strings are in general more readable, concise and performant. See also: https://www.python.org/dev/peps/pep-0498/#rationale

* revert pyextra changes

* revert ublox.py

Co-authored-by: Willem Melching <willem.melching@gmail.com>
old-commit-hash: 55390d273f
2021-12-16 14:58:17 +01:00
Adeeb Shihadeh
3d72ed6ea1 alerts: add test for creation delay
old-commit-hash: 45f3662cf0
2021-12-09 14:29:50 -08:00
HaraldSchafer
3afc818433 Long policy: strictly squared stopped equivalence function (#23118)
* new ref

* never let lead stopped equivalence go down

* no overbraking

* stricter again

* cleanup

* updated refs
old-commit-hash: 0dcdf9c30f
2021-12-03 16:12:30 -08:00
HaraldSchafer
08ac1b33ba Human inspired follow distance (#22937)
* Add cost for creep

* more reasonable cost

* seems better than before

* science tune

* more chill

* closer follow

* stopping takes some leeway

* better cruise

* needed to be cumsum all along

* jerk not even needed

* matches better

* 6 is too much

* add back

* a little extra buffer is good for badly tuned cars

* new refs

* refs again
old-commit-hash: 46fd5892bf
2021-12-02 14:42:13 -08:00
Adeeb Shihadeh
85b0e69efd more alert checks
old-commit-hash: 8d917b6702
2021-11-16 22:56:29 -08:00
Adeeb Shihadeh
448d5f9e93 alerts: use a single duration for sound, text, and HUD (#22856)
* alerts: use a single duration for sound, text, and HUD

* little cleanup

* update refs
old-commit-hash: c5d6b85c90
2021-11-10 11:54:12 -08:00
Robbe Derks
58c99158a1 Make pandaState and safetyMode a list (#22454)
* wip: move to pandaStates

* bump cereal

* wip: SafetyMode struct

* move to safetyMode

* fix typo

* this can be None

* fix potential empty pandaStates list

* fix thermald

* fix controlsd

* rename safetyModes to safetyConfigs

* update process_replay

* fix test_models

* bump cereal
old-commit-hash: 91987f38d4
2021-10-08 17:54:34 +02:00
HaraldSchafer
2b470f4e38 acados long merged (#22224)
* rebased

* cleaner, seems to drive better?

* more stable

* wrong import

* new way of thinking

* reports look nice

* start move back

* works at leas

* good timestamps

* step by step

* somewhat work

* tests pass

* ALL CARS STOPPED

* should work

* fake a cruise obstacle

* cleaner costs

* pretty good except cruise braking

* works pretty well now!

* cleanup

* add source

* add source

* that is needed for unit tests

* nan recovery

* little cleaner

* stop wasting arrays

* unreasonable without unfair init

* this isnt needed without the exponential

* that works too

* unused

* uses less

* new ref

* long enough

* e2e long api

* DONT PUT IN A VIEW INTO ACADOS

* new ref for outside weights

* remove debug prints
old-commit-hash: fe983a7b8c
2021-09-27 19:48:28 -07:00
Adeeb Shihadeh
821f1f6cb6 remove community supported cars from community features (#22330)
* remove community supported cars from community features

* remove bosch and hkg long

* remove test case

* update refs
old-commit-hash: 649af76fd4
2021-09-23 17:34:52 -07:00
Willem Melching
b3601ce43b Remove fuzzy fingerprint startup alert (#22328)
* deprecate fuzzy fingerprint startup alert

* bump cereal
old-commit-hash: 88d248a5af
2021-09-23 17:15:33 -07:00
HaraldSchafer
498e0f4212 Fix cruise MPC convergence bug and add test (#22295)
* fix tests

* fix cruise convergence bug

* update refs

* Update selfdrive/controls/tests/test_cruise_speed.py

Co-authored-by: Willem Melching <willem.melching@gmail.com>

* Update selfdrive/controls/tests/test_cruise_speed.py

* add msgh

Co-authored-by: Willem Melching <willem.melching@gmail.com>
old-commit-hash: fcda55fbf1
2021-09-21 12:19:05 -07:00
HaraldSchafer
0512c89d34 various cleanup (#22289)
old-commit-hash: cc6af379ce
2021-09-20 16:26:10 -07:00
HaraldSchafer
2d4b64ed04 Acados long fast (#22233)
* acados long

* new ref

* SPPEEEEEDDD

* less iterations

* this shouldn't be so high

* reset only essentials

* minimal reset for long mpc

* more cpu usage plannerd

* Use lead mpc even when going to crash

* reset to current state

* Use open loop speed for lead mpc

* 1 iteration is too little for cruise mpc

* add whitespace

* update refs
old-commit-hash: 66c275b711
2021-09-15 19:00:12 -07:00
HaraldSchafer
8877772a95 Less QP iterations for lateral acados (#22231)
* Less QP iterations for lateral acados

* update ref
old-commit-hash: 96a8f8a831
2021-09-14 13:55:30 -07:00
HaraldSchafer
c422cce205 Port lateral planning to ACADOS (#22080)
* lateral acados

* looks good!

* add another solve, needed for init somehow

* use copy

* init correctly

* cleanup sconstruct

* Update files_common

* update cpu usage

* reset when invalid

* fix cpu usage

* cost_set doesnt leak

* new ref

* non leaky reset

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
Co-authored-by: Comma Device <device@comma.ai>
old-commit-hash: 7081ab4fb7
2021-09-13 19:06:54 -07:00
Adeeb Shihadeh
db852728a2 move fuzzy fingerprinting out of community features (#21542)
old-commit-hash: b4fc208166
2021-07-10 13:23:39 -07:00
HaraldSchafer
96d4bfbff3 Refactor long (#21433)
* refactor

* needs casting

* tests pass

* fix that test

* refactor in controls

* lets not go crazy

* change of names

* use constants

* better naming

* renamed

* soft constraints

* compile slack variables

* rm git conflict

* add slack variables

* unused

* new edition

* fcw

* fix tests

* dividing causes problems

* was way too slow

* take a step back

* byeeee

* for another time

* bad idxs

* little more cpu for cruise mpc

* update refs

* these limits seem fine

* rename

* test model timings fails sometimes

* add default

* save some cpu

* Revert "little more cpu for cruise mpc"

This reverts commit f0a8163ec90e8dc1eabb3c4a4268ad330d23374d.

* Revert "test model timings fails sometimes"

This reverts commit d259d845710ed2cbeb28b383e2600476527d4838.

* update refs

* less cpu

* Revert "Revert "test model timings fails sometimes""

This reverts commit e0263050d9929bfc7ee70c9788234541a4a8461c.

* Revert "less cpu"

This reverts commit 679007472bc2013e7fafb7b17de7a43d6f82359a.

* cleanup

* not too much until we clean up mpc

* more cost on jerk

* change ref

* add todo

* new ref

* indentation
old-commit-hash: be5ddd25cd
2021-07-07 19:42:26 -07:00
HaraldSchafer
7e87930a20 Refactor lateral lag compensation (#21334)
* add T_IDXS

* refactor

* fix test

* unused

* typo

* needs casting

* Update selfdrive/controls/lib/drive_helpers.py

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>

* deprecate field

* regen all

* new segs

* add todo

* split back

* clean

* bad names

* do in controls

* add arg

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
old-commit-hash: 6838e1c82c
2021-06-30 14:19:39 -07:00
Adeeb Shihadeh
5dfc430d47 startup alert for no fw returned (#21177)
old-commit-hash: d4ab1f1e27
2021-06-07 14:15:09 -07:00
Jafar Al-Gharaibeh
f108d93bc0 Mazda FP 2.0 support (#20879)
* Mazda FP 2.0 support

ECU FW for CX-5 2017 and Mazda3 2017

Signed-off-by: Jafar Al-Gharaibeh <to.jafar@gmail.com>

* Use standard UDS request/reponse, fix missing arg.

Signed-off-by: Jafar Al-Gharaibeh <to.jafar@gmail.com>

* Add CX-5 FW test

Signed-off-by: Jafar Al-Gharaibeh <to.jafar@gmail.com>

* update/add FW FP

Current suported models:
  CX-5 2017/2021
  CX-9 2019/2020
  Mazda3 2017/2018

Signed-off-by: Jafar Al-Gharaibeh <to.jafar@gmail.com>

* Add Cx-9 2019 FW FP

Signed-off-by: Jafar Al-Gharaibeh <to.jafar@gmail.com>

* Remove comments, remove TESTER_PRESENT_REQUEST from Mazda

Signed-off-by: Jafar Al-Gharaibeh <to.jafar@gmail.com>

* add transmission ecu to startup test

Signed-off-by: Jafar Al-Gharaibeh <to.jafar@gmail.com>
old-commit-hash: 824f93303d
2021-05-28 15:50:58 +02:00
Adeeb Shihadeh
bb70ddcbfe Move CAN fingerprinting behind community features (#20993)
* Move CAN fingerprinting behind community features

* fix typo

* fix startup test

* fix
old-commit-hash: 726fb9d501
2021-05-24 19:21:58 -07:00
Adeeb Shihadeh
6d28491dbf Toyota: use FW query for DSU detection (#20615)
* Toyota: use FW query for DSU detection

* make sure we have at least some fw responses

* bool

* add test to test_startup

Co-authored-by: Willem Melching <willem.melching@gmail.com>
old-commit-hash: a19d94ae2d
2021-04-20 14:32:34 +02:00
Willem Melching
ee0e80a6d4 Fuzzy match on ECU FW versions (#20687)
* Fuzzy match on 3+ ECUs

* reuse dict

* exclude some shared ecus to be sure

* show alert for fuzzy match

* use title case

* require community toggle

* refactor

* do both exact and fuzzy in test script

* update test script

* add fuzz test and lower matches to >= 2

* strip alert length

* sort mismatches

* add fw tests to test_startup

* bump cereal
old-commit-hash: e4f73fbda5
2021-04-20 12:00:36 +02:00
Willem Melching
8f4a445171 add putBool/getBool wrappers to cython params class (#20611)
* add putBool/getBool wrappers to cython class

* use new API

* some more puts

* fix mockparams arguments

* add get_bool to MockParams

* typo
old-commit-hash: ae094042ad
2021-04-07 15:36:37 +02:00
HaraldSchafer
1d36adf351 no heading cost (#20594)
* no heading cost

* live mpc weight config

* need to add stds

* make work on empty data

* no divide by 0

* update refs

* update model replay

* update proc replat

* new model replay ref
old-commit-hash: d72d433ec7
2021-04-06 23:49:29 -07:00
Adeeb Shihadeh
05eb44115e cereal cleanup part 2 (#20092)
* car stuff

* thermal

* Revert "car stuff"

This reverts commit 77fd1c65ebd01abfa8493ae12c9e6b14f7ada976.

* panda state

* camera stuff

* start deg

* most is building

* builds

* planner + controls run

* fix up paramsd

* cleanup

* process replay passes

* fix webcam build

* camerad

* no more frame

* thermald

* ui

* paramsd

* camera replay

* fix long tests

* fix camerad tests

* maxSteeringAngle

* bump cereal

* more frame

* cereal master
old-commit-hash: 312b681a46
2021-02-16 21:39:32 -08:00
Adeeb Shihadeh
966945880b Cereal cleanup (#20003)
* start cleanup

* fan speed

* cleanup dm

* fix cereal

* hwType -> pandaType

* update refs

* update refs

* bump cereal

* freeSpacePercent

* cereal master
old-commit-hash: 000bd226aa
2021-02-03 19:57:30 -08:00
HaraldSchafer
f4e94524d4 Remove curv factor (#20011)
* cleaning crew

* need that to match

* smooth factor

* that didn't really work

* closer to previous

* new ref

* new names
old-commit-hash: 61a4e3e661
2021-02-03 17:51:21 -08:00
Mitchell Goff
d28831dbab Split planner and pathplanner publishing into separate 'publish' methods (#19860)
* Split planner and pathplanner publishing into separate 'publish' methods

* Updated test_following_distance.py

* Combined publish+send_mpc_solution methods
old-commit-hash: 608f00f814
2021-01-26 20:27:24 -08:00
HaraldSchafer
7af6dab1e8 Cleanup pathplanner (#19827)
* no divide by 0

* misc cleanup

* final fixes

* remove last polys

* new ref

* fix test

* update again
old-commit-hash: 0e49919ab9
2021-01-19 00:02:53 -08:00
HaraldSchafer
c6d9b9565a Mpc rework2 (#19660)
* start again

* need that too

* this actually works

* not needed

* do properly

* still works

* still works

* still good

* all G without ll

* still works

* all still good

* cleanup building

* cleanup sconscript

* new lane planner

* how on earth is this silent too....

* update

* add rotation radius

* update

* pathplanner first pass

* misc fixes

* fix

* need deep_interp

* local again

* fix

* fix test

* very old

* new replay

* interp properly

* correct length

* another horrible silent bug

* like master

* fix that

* do doubles

* different delay compensation

* make robust to empty msg

* make pass with hack for now

* add some extra

* update ref for increased leg

* test cpu usage on this pr

* tiny bit faster

* purge numpy

* update ref

* not needed

* ready for merge

* try again after recompile

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
old-commit-hash: 158210cde8
2021-01-14 18:43:50 -08:00
HaraldSchafer
902d107af1 cleanup planner (#2519)
* no reason for external function

* dont need d_poly for this test

* dont copy float

* typo
old-commit-hash: 39f27f9d6a
2020-11-10 14:42:43 -08:00
Adeeb Shihadeh
aea2faaa98 Alert cleanup (#2274)
* no more focus recover active

* consistency

* more permanent

* dm alerts

* sanity check test

* no please

* clean that up

* update refs

* one more

* bump cereal
old-commit-hash: ae4b4bd125
2020-10-14 15:56:18 -07:00
qadmus
c613f8dfcc cleanup long planner, mpc: unused globals and arguments (#2211)
Co-authored-by: user <email@web.com>
old-commit-hash: 72e0ac2de1
2020-09-21 11:43:28 +02:00
Adeeb Shihadeh
8221c26fab type hints for alerts and fix community feature alert (#2196)
* fix startup alert for community features

* type hints for alerts

* more type hints

* fix dashcam only alerts

* more type hints
old-commit-hash: a81a18205e
2020-09-17 22:06:31 -07:00
Adeeb Shihadeh
3001e4c3b2 set params for new test
old-commit-hash: fde8b18f73
2020-09-09 15:57:06 -07:00
Adeeb Shihadeh
43010d853a fix timing issues with new test
old-commit-hash: fae13bf07e
2020-09-09 15:16:05 -07:00
Adeeb Shihadeh
c3760c267d simple unit test for startup alert
old-commit-hash: a3c1de1e66
2020-09-09 14:40:16 -07:00
Adeeb Shihadeh
017b084154 Alert when updated consistently fails (#2013)
* alert when update fails more than 10 times

* bring over offroad alert refactor from other branch

* and we have tests

* use it in snapshot

* bump apk

* don't show exceptions on release branches

* only write when changed

* why does delete use so much cpu

* clean that up

* little more
old-commit-hash: 8e63f06540
2020-08-11 16:23:57 -07:00
Adeeb
ea0292d86e Move driver monitoring out of controls (#1642)
* move dmonitoring out of controls

* run monitoring unit tests in CI
old-commit-hash: d4858e5ff5
2020-06-09 13:25:15 -07:00
Adeeb
9027018368 Update Flake8 config (#1624)
* update flake8 checks

* add E502

* no whitespace warnings

* fix violations

* no W391

Co-authored-by: Jason Young <jason@comma.ai>
old-commit-hash: 367155168a
2020-06-03 16:13:34 -07:00
Willem Melching
a56e2b01f8 Make pylint more strict (#1626)
* make pylint more strict

* cleanup in progress

* done cleaning up

* no opendbc
old-commit-hash: 843a64c72f
2020-06-02 16:29:32 -07:00