Commit Graph

44 Commits

Author SHA1 Message Date
HaraldSchafer
a8ec6f4cfd Rocket Launcher Model (#25963)
* 1456d261-d232-4654-8885-4d9fde883894/440 6b7d7cec-ead8-40f3-86cc-86d52c9b03fe/300

* compute only 9 tokens: 1456d261-d232-4654-8885-4d9fde883894/440 6b7d7cec-ead8-40f3-86cc-86d52c9b03fe/300

* tinygrad: cleanup gather

* 1456d261-d232-4654-8885-4d9fde883894/440 6b7d7cec-ead8-40f3-86cc-86d52c9b03fe/700

* empty commit for tests

* bump tinygrad

* dont use tinygrad matmul for now

* bump tinygrad

* 1456d261-d232-4654-8885-4d9fde883894/440 e63ab895-2222-4abd-a9a5-af86bb70e260/700

* float16 1456d261-d232-4654-8885-4d9fde883894/440 e63ab895-2222-4abd-a9a5-af86bb70e260/700

* increase steer rate cost

* Revert "increase steer rate cost"

This reverts commit 74ce9ab9be7ef17ecfec931f96851b12f37f2336.

* fork tinygrad

* empty commit for tests

* basics

* Kinda works

* new lat

* new tuning

* Move LATMPCN so scons compiles

* Update long weights

* Add tinygrad optim

* Update model ref

* update weights

* Update ref

* Try

* Error message for field ignore

* update model regf

* ref commit

* Fix onnx test

Co-authored-by: Yassine Yousfi <yyousfi1@binghamton.edu>
old-commit-hash: cb0b7375b7
2022-10-05 21:43:38 -07:00
HaraldSchafer
f25d434a01 Planner cleanup (#25969)
old-commit-hash: e5d2c3ce7a
2022-10-04 21:19:04 -07:00
Lee Jong Mun
f6700cb7ba remove blank whitespace (#25921)
old-commit-hash: 7df0e3efcf
2022-09-29 13:52:41 -07:00
HaraldSchafer
10bc36ae58 Minor ACC fixes (#25911)
* Change cruise accel limits

* Long tuning script looks good

* Cap cruise slowdown aggression in e2e mode

* Revert atau change

* Cleanup

* Update ref

* fix ref
old-commit-hash: 1007df874f
2022-09-28 13:27:07 -07:00
HaraldSchafer
0b87a4ddb1 More conservative lead policy in e2e long mode (#25684)
* Add params for lead and danger

* fix long params

* E2e passes simple maneuver tests

* Make tests run with e2e long mode

* Slightly more error allowed in e2e mode

* FCW back and populate long source field

* Fix planner name

* FCW still doesnt work

* Slightly less aggressive

* Doesn't need to simulate from stop
old-commit-hash: 7899fb79c1
2022-09-06 21:52:34 -07:00
HaraldSchafer
0cccf195f3 Add e2e long toggle (#25638)
* Add toggle

* Misc fixes

* Update translations

* pre alpha not great
old-commit-hash: faff2b8950
2022-09-02 00:24:53 -07:00
HaraldSchafer
4b8547c7a4 Support e2e long in longitudinal planner (#25636)
* refactor

* Add planer modes to support offline, acc, and blended

* add acceleration

* Fix index

* Update model ref

* Read in model outputs

* Add model msg

* Add e2e logic

* Add source
old-commit-hash: e1b7a37a1f
2022-09-01 15:40:25 -07:00
HaraldSchafer
c4dcf67acc Long e2e planner: better xva weights (#24893)
better long xva weights
old-commit-hash: 2c877ce490
2022-06-17 10:35:24 -07:00
Adeeb Shihadeh
3c48bc47b7 Move a bunch of stuff to system/ part 3 (#24829)
* move swaglog.py

* timezoned

* logmessaged

* version.py

* fix linter
old-commit-hash: 0fce5d9045
2022-06-11 23:19:27 -07:00
Vivek Aithal
8823b9e4a5 longitudinal_mpc: Compute forward distance from velocity (#24328)
* add vel integ as x in e2e long mpc

* add comment
old-commit-hash: 1a9f5d29d4
2022-04-25 20:15:04 -07:00
Jonathan Frey
059dbf57e7 longitudinal MPC: use reset() function instead of recreating the solver in (#24091)
* scons: add acados_template as dependency for lat and long mpc

* long MPC: use acados reset instead of recreating the solver

* long MPC: print timings and reset commented

* update acados x86_64

* update acados include folder

* update acados Python interface

* update acados reference commit to latest acados/master

* update x86 libs

* update comma two

* update acados again with commit 8ea8827fafb1b23b4c7da1c4cf650de1cbd73584

* update comma two

* update comma three

* update x86

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
Co-authored-by: Comma Device <device@comma.ai>
old-commit-hash: a9bac5acf8
2022-04-01 15:39:41 -07:00
Adeeb Shihadeh
479ac5753c longitudinal MPC: add MAX_T in T_IDXS_LST (#23960)
* longitudinal MPC: add MAX_T in T_IDXS_LST

* update refs

Co-authored-by: KexianShen <shenkexian@gmail.com>
old-commit-hash: f1aab78d08
2022-03-13 21:45:23 -07:00
Jonathan Frey
3bd71500bd Upstreamed and update acados (#23927)
* change acados version to finalized PR https://github.com/acados/acados/pull/791

* acados: update include and x86_64 build

* acados: update pyextra

* adapt mpc files to updated acados

* acados buid: clear acados_template and include dir before updating

* update acados again

* acados MPC: only generate solver, building is done via scons

* update acados to latest acados/master

* c3 libs

* c2 libs

* acados scons files: add acados build script as a dependency

* acados scons files: add libacados.so and ocp_nlp_interface.h, build script not in files_common

* update acados

* adapts long & lat MPC file

* update acados reference commit to acados/master

Co-authored-by: Comma Device <device@comma.ai>
old-commit-hash: d653dd843a
2022-03-11 11:49:27 +01:00
Jonathan Frey
0d5d9a43d3 Longitudinal MPC set qp tolerance to 1e-3 (#23899)
* initialize solverExecutionTime longitudinal_planner

* test_onroad: improve timing evaluation

* longitudinal MPC: set qp_tol to 1e-3

* update ref

Co-authored-by: Harald Schafer <harald.the.engineer@gmail.com>
old-commit-hash: ab371f888a
2022-03-02 21:38:40 -08:00
Jonathan Frey
aa549592f7 remove trivial terminal constraint and associated CasADi generated functions (#23898)
* remove trivial terminal constraint and associated CasADi generated functions

* Update refs

Co-authored-by: Harald Schafer <harald.the.engineer@gmail.com>
old-commit-hash: 1801baba68
2022-03-02 20:53:21 -08: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
Willem Melching
dc16307917 longitudinal planner: disable change cost when stopped. not engaged or gas pressed (#23639)
* disable change cost completely on standstill and gas press

* cleanup

* set accel to zero

* clean up logic around standstill

* update ref
old-commit-hash: 428d412c1f
2022-02-21 16:14:41 +01:00
Willem Melching
dce057d29f Log MPC solver time (#23566)
* add solve time to plan output

* add to process replay ignore list

* print in CI
old-commit-hash: f76328b426
2022-01-18 14:51:03 +01:00
Shane Smiskol
b500034b8d LongitudinalMpc: Remove class accel_limit_arr (#23295)
* remove class accel_limit_arr

remove class accel_limit_arr

* make it static

* only set static parameters once

* just use existing function

style

* Update selfdrive/controls/lib/longitudinal_mpc_lib/long_mpc.py

* Update selfdrive/controls/lib/longitudinal_mpc_lib/long_mpc.py

Co-authored-by: Willem Melching <willem.melching@gmail.com>
old-commit-hash: 9cb0ebe37d
2022-01-04 16:00:29 +01:00
Shane Smiskol
d5bf8e0e65 LongitudinalMpc: minor clean up (#23296)
* correct order

* formatting

* Revert "formatting"

This reverts commit 481c390f400179f5d0d8f9b5a3066cb68e484d0c.

* use np.zeros

* typos and formatting

* typo

* typo
old-commit-hash: 5387806400
2021-12-28 12:05:52 +01:00
Ewout ter Hoeven
f206ebd054 Pyupgrade 3.6: Update syntax with Python 3.6+ features (#23305)
Updated Python code with Python 3.6+ features:
- utf-8 encoding is now the default (PEP 3120)
- Replace list comprehensions by Generator Expressions (PEP 289)
- Replace yield loop by yield from (PEP 380)
- Remove the (object) subclass when defining a class
- Replace the IOError alias by OSError (PEP 3151)
- Define sets with curly braces {} instead of set()
- Remove "r" parameter from open function, which is default

Co-Authored-By: Adeeb Shihadeh <8762862+adeebshihadeh@users.noreply.github.com>
Co-Authored-By: GregorKikelj <96022003+GregorKikelj@users.noreply.github.com>

Co-authored-by: Adeeb Shihadeh <8762862+adeebshihadeh@users.noreply.github.com>
Co-authored-by: GregorKikelj <96022003+GregorKikelj@users.noreply.github.com>
old-commit-hash: 332f568a82
2021-12-24 11:18:39 -08: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
HaraldSchafer
00749bd3cd XVA long policy: prev_a becomes numpy anyway (#23175)
old-commit-hash: c41a0cae4b
2021-12-08 16:06:09 -08:00
Harald Schafer
3ee06e92ed Long mpc: fix xva policy for sim
old-commit-hash: 7e20fe7ca2
2021-12-08 15:42:30 -08:00
HaraldSchafer
b19b5fdb98 long planner: no reset when starting (#23149)
* long planner: no reset when starting

* let go to 2m/s

* update ref
old-commit-hash: 77a99e7d6d
2021-12-06 23:10:16 -08:00
Harald Schafer
3a6a87ffe0 add a change cost
old-commit-hash: 9afc95474d
2021-12-06 16:17:11 -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
c6964152bb Reaction buffer on follow distance (#23112)
* Reaction time buffer

* new ref
old-commit-hash: 5b0e10ea33
2021-12-02 23:56:02 -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
HaraldSchafer
e3f9919b5c Set accel trajectory to a_ego when not engaged (#23100)
* Set accel trajectory to a_ego when not engaged

* update ref
old-commit-hash: 68015f75ed
2021-12-01 23:12:11 -08:00
HaraldSchafer
345d52e957 Add cost to long plan change for smoother lag comp (#22923)
* add plan changing cost

* fix compile

* set weights

* try this cost

* horizon problem

* looks pretty good

* update refs

* update refs

* smoother plan changes
old-commit-hash: b3b45c8d29
2021-11-16 17:57:55 -08:00
Joost Wooning
9042f18afd cython wrapper for acados (#22784)
* cython wrapper for acados

* fix building

* sconscript cleanup

* no cython numpy

* cleanup

* upgrade build script

* try without slices

* new acados commit

* c3 update acados libs

* c2 libs

* make faster

* undo profiling

* fix build

* somewhat faster

* tryout cost_set_slice

* Revert "tryout cost_set_slice"

This reverts commit d358d93a133270e4edab9e7c07ffb6f577c52bd6.

* cleanup

* undo t_renderer change

Co-authored-by: Comma Device <device@comma.ai>
old-commit-hash: 89d0a52d16
2021-11-12 17:09:08 +01:00
HaraldSchafer
caa01d2f95 ACADOS: partial condensing (#22830)
* partial condense

* new refs

* new ref

* newerest refs
old-commit-hash: 35d6ed1014
2021-11-09 19:29:55 -08:00
HaraldSchafer
d50d9af755 e2e long planner: use position, speed and accel (#22688)
* a little bit more moderate

* cleaner
old-commit-hash: 7868baeac9
2021-10-25 14:03:41 -07:00
HaraldSchafer
b7aba92661 Remove accel cost in long MPC (#22527)
* ACCEL not useful

* new ref
old-commit-hash: c4510024da
2021-10-11 17:20:40 -07:00
HaraldSchafer
4814c30667 ACADOS fix non-convergence when long_plan changes (#22495)
* debug commit

* cleanup

* some indexing bugs

* need more its

* BALANCE is way better it seems

* fix test

* this converges in 2000segs

* new ref

* less cpu
old-commit-hash: 04cf12cb00
2021-10-10 00:05:29 -07:00
HaraldSchafer
5a1e44c417 Long MPC cleanup (#22462)
* cleaner extrapolation

* some comments

* new ref

* more comments

* new ref
old-commit-hash: a4bc1bbb74
2021-10-06 17:51:23 -07:00
HaraldSchafer
f495134be4 Retune long mpc (#22445)
* first try

* looks decent

* finalize retune

* back to 3 its

* may need 4 still

* misc cleanup

* new ref

* SPEEEED

* new ref
old-commit-hash: 9ab09f5ae9
2021-10-06 09:37:53 -07:00
HaraldSchafer
d91e0604e8 Change radar-based FCW to model-based FCW (#22379)
* just use MPC for fcw checking

* thats already bad

* model FCW is always good

* better fcw

* should be good for now

* comment

* linting

* cleaner

* unused
old-commit-hash: a8b4249ebc
2021-09-29 11:55:54 -07:00
HaraldSchafer
f02787eb75 Small long MPC optimizations (#22360)
* Revert "temporarily relax camerad timings"

This reverts commit 59b8293b70e0cbd43567275dc2c6c1d29308fb84.

* cleanup

* wrong weight size

* changes ever so slightly

* seems enough

* Revert "seems enough"

This reverts commit 24f64e9b18583462206bb77c37ba7727b9e47245.

* new ref
old-commit-hash: 85dc43d166
2021-09-28 17:37:31 -07: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
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
Mitchell Goff
aa4b201b96 Added update_with_xva method to long_mpc so it can be used in sim (#22284)
old-commit-hash: 485afda79d
2021-09-20 14:20:01 -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