Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More accurate jerk limits #24755

Merged
merged 4 commits into from
Jun 16, 2022
Merged

More accurate jerk limits #24755

merged 4 commits into from
Jun 16, 2022

Conversation

GregorKikelj
Copy link
Contributor

No description provided.

For example max_curvature_rate can be negative.
@sshane sshane added enhancement controls controls/planner related labels Jun 5, 2022
@GregorKikelj
Copy link
Contributor Author

Here's the idea

$a_{lat}=v^2\kappa$, where $\kappa$ is the curvature of the current path. To get jerk we need to differentiate the expression.
$$\dot{a_{lat}}=j=(v^2\kappa)'=(v^2)'\kappa+v^2(\kappa)'=2v\cdot (v)'\kappa+v^2\dot{\kappa}=2va\kappa+v^2\dot{\kappa}$$

We know that $-j_max\le j\le j_{max}$.

Expressing $\dot{\kappa}$ we get
$$-j_{max}\le 2va\kappa+v^2\dot{\kappa} \le j_{max}$$
$$-j_{max}-2va\kappa\le v^2\dot{\kappa} \le j_{max}-2va\kappa$$
$$\frac{-j_{max}-2va\kappa}{v^2}\le \dot{\kappa} \le \frac{j_{max}-2va\kappa}{v^2}$$

which needs to hold to ensure jerk is within the $5\frac{m}{s^3}$ limit.

The term $2va\kappa$ is not insignificant when computing jerk. For example at $10m/s$ with a lateral acceleration of $3m/s^2$ and longitudinal acceleration of $2m/s^2$ we get $\kappa=0.03$ and $2va\kappa=1.2m/s^3$

@haraschax
Copy link
Contributor

Math looks correct!

But, not sure if I see the need to fix these. It works fine as is and I'd rather not complicate this code. Can we just add a comment instead noting it isn't exactly correct and the correct formula?

1 similar comment
@haraschax
Copy link
Contributor

Math looks correct!

But, not sure if I see the need to fix these. It works fine as is and I'd rather not complicate this code. Can we just add a comment instead noting it isn't exactly correct and the correct formula?

@haraschax haraschax merged commit b941b39 into commaai:master Jun 16, 2022
@GregorKikelj GregorKikelj deleted the patch-3 branch June 16, 2022 17:50
dkiiv added a commit to dkiiv/openpilot that referenced this pull request Jun 26, 2022
* laikad: fixes to run on device (commaai#24879)

* Always run laikad on device!

* Update laika

* Update laika

* Fix gps week and time of week in msg

* Reset kalman filter if pos_fix or last_known_position

* put behind file

* move pr parsing into common file

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

* bump cereal

* navd: handle maxspeed being none (commaai#24871)

* navd: handle maxspeed being none

* none is encoded like this

* Cast gpstimeofweek to int

* More accurate jerk limits (commaai#24755)

* More accurate jerk limits

* Min is not - max

For example max_curvature_rate can be negative.

* reduce diff

* Chrysler: interface cleanup (commaai#24884)

* Chrysler: interface cleanup

* little more

* bump panda

* VW FPv2: reduce number of ECU queries (commaai#24706)

* only send valid/needed queries

* just do volkswagen

* clean up

* add parameter name

clean up

* add test for whitelist

* rename

* Update selfdrive/car/fw_versions.py

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

* fix test

* log response addresses

* bump cereal

* handle response pending with IsoTpParallelQuery

* remove response pending stuff

* temporarily disregard cache for easier testing

* revert this

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

* Chrysler: use universal gas and brake signals (commaai#24886)

* Chrysler_Update

* Update signal names

* bump panda

* bump submodules

* bump panda to master

Co-authored-by: Jonathan <jraycec@gmail.com>

* regen: send wideRoadCameraState (commaai#24863)

* fix camera malfunction

* revert

* send in one process to fix frames out of sync

* not used

* revert

* fix and add --no-upload for CI testing

* fingerprint if source is fw

* no FW versions

* live_cpu_and_temp: handle duplicate proc names

* add param to override carParams.dashcamOnly (commaai#24857)

* add param to override carParams.dashcamOnly

* little cleaner

* replay: no HW decoder, fix UV stride

* Long e2e planner: better xva weights (commaai#24893)

better long xva weights

* ui: show empty box when speed limit is unavailable during nav (commaai#24891)

* ui: show empty box when speed limit is unavailable during nav

* variant 2, long -

* Add Hyundai P harness (commaai#24872)

* Update docs_definitions.py

* Update values.py

* Chrysler: use unified signal definitions (commaai#24895)

* Update some signals to unified names and definitions

Co-authored-by: Jonathan <jraycec@gmail.com>

* steering looks good

* Fix cp signals

* Do steering signal changes separately

* bump opendbc to master

Co-authored-by: Jonathan <jraycec@gmail.com>

* jenkins: move simulator build into lock

* zookeeper: add avg power to power_monitor.py

* Car Port: 2022 Honda Civic (commaai#24535)

* master 2022 Civic

* bump panda

* bump

* bump cereal

* fix

* needed

* try for now

* maybe

* revert for now

* move to Cam parser

* fix

* move to cam

* need AEB_STATUS too

* bump for debug prints

* bump opendbc and add cruise_params

* bump opendbc and update cruise_params

* bump

* test route

* update ref

* Revert "update ref"

This reverts commit 28345da.

* cleanup

* just to test

* bump

* revert

* need to send val 12 too?

* change bus

* not needed

* update bus

* syntax

* move this to other bus too

* Revert "move this to other bus too"

This reverts commit 770bf47.

* test new lane line signal

* needed too

* maybe need both?

* Test new LKAS hud message

* bump

* missing comma

* missing

* maybe

* add frame and idx

* add in hud_lanes

* switch this too

* bump panda

* add this

* I guess need this too

* to match

* also

* wasnt correct

* bump opendbc

* bump panda

* move to cam parser

* missing

* add here too

* bump

* remove from cam parser

* bump

* back to cam parser

* its 5hz

* bump for new checksum function

* bump for correct frequency

* update frame and idx

* bump

* bump and update

* send set me bit

* bump

* pass these values through

* silly atom

* ret

* fix this

* use copy instead

* add these too

* to check keyerror

* switch

* bump submodules

* send too

* proper

* Replace HUD with BOH

* add dashed lanes

* small fix

* clean up

* not needed anymore

* remove and change

* this too

* dont always set

* remove additional LKAS message

* bump

* add

* to test

* add frame

* bump

* rebase

* remove default values

* rename

* clean up some carstate logic

* regenerate docs

* spacing

* simplify more logic

* bump opendbc

* bump opendbc

* only if radarless

* panda at least builds now

* add comment

* bump

* fixes

* bump opendbc

* bump opendbc

fix for new DBC

* bump opendbc

* bump opendbc

* carstate: fix bus, parser signals

* Set safety param

* pt bus is 0, not 1

* Fix SCM_BUTTONS and bump panda and opendbc

* fixes for ACC_CONTROL

* bump opendbc

* bump opendbc

* convert from MPH on HONDA_BOSCH_RADARLESS

move is_metric

* make sure we don't disable if radarless

* don't show incorrect harness on website

don't show incorrect harness on website

* bump panda

* remove/update comments

* bump panda

* Fix harnesses

* one line check

* bump opendbc

* remove this

* Some carstate cleanup

We removed STANDSTILL->WHEELS_MOVING

we don't use CRUISE_PARAMS

add back

add back

* more cleanup

* update docs

* marketing says it has TJA and ACC with low speed follow

* send buttons on bus 0

bump panda

* comment

* camera needs to see buttons on bus 2

comment

* bump panda

* add to releases

* remove comments

* comment

* we don't use stock hud yet

Co-authored-by: vanillagorillaa <ntmccoy@yahoo.com>
Co-authored-by: vanillagorillaa <31773928+vanillagorillaa@users.noreply.github.com>
Co-authored-by: kevinharbin <76784413+kevinharbin@users.noreply.github.com>

* Revert "Chrysler: use unified signal definitions (commaai#24895)"

This reverts commit 0f0b4ca.

* Chrysler: 2022 pacific hybrid is supported

* Move camerad to system/ (commaai#24836)

* mv camerad

* add hardware symlink

* fix unit tests

* sim: update cl kernel path

* bump cereal

* Add new message to Tesla AP2 fingerprint (commaai#24912)

* add new message

* fix spacing

* add space

* Improve laikad cpu usage. Less pos fix. Less local imports (commaai#24887)

* Improve laikad cpu usage. Less pos fix. Not local imports

* Add laika to files_common

* Add laika to dockerfile sim

* Fix

* Fix

* undo

* ui: onroad widget check if sockets alive (commaai#24913)

* ui: onroad widget check if socket alive

* cleanup

* fullframe DM model (commaai#24860)

* Revert "put cereal on master"

This reverts commit a8ccd8f.

* Revert "Revert fullframe DM model (commaai#24812)"

This reverts commit c646eee.

* revert revert cereal

* clip6

* 0.8 is fair

* Fiction compensation should be based on error

* Update refs

* Add deadzone

* not that

* good mg

* ref

* ref

* ee8f

* minor tweak

* ref

* recompile

* ref

* cereal

* match driverstatus

* new ref

* new ref

* pass token through jenkins credentials

* quote

* fix snpe dead weights

* final ref

Co-authored-by: Harald Schafer <harald.the.engineer@gmail.com>
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>

* bump cereal

* Toyota: international corolla cross is supported

* FPv2: log correct response address (commaai#24918)

log correct response address (29 bit addresses have a different standard)

* 22 civic hatcback is supported

* FPv2: log all present ECU addresses (commaai#24916)

* eliminate brands based on ECUs that respond to tester present

* make it work

* Add type hint for can message

Use make_can_msg

* Only query for addresses in fingerprints, and account for different busses

* These need to be addresses, not response addresses

* We need to listen to response addresses, not query addresses

* add to files_common

* Unused Optional
Drain sock raw

* add logging

* only query essential ecus

comments

* simplify get_brand_candidates(), keep track of multiple request variants per make and request each subaddress

* fixes

make dat bytes

bus is src

Fix check

* (addr, subaddr, bus) can be common across brands, add a match to each brand

* fix length

* query subaddrs in sequence

* fix

* candidate if a platform is a subset of responding ecu addresses

comment

comment

* do logging for shadow mode

* log responses so we can calculate candidates offline

* get has_subaddress from response set

* one liner

* fix mypy

* set to default at top

* always log for now

* log to make sure it's taking exactly timeout time

* import time

* fix logging

* 0.1 timeout

* clean up

Co-authored-by: Greg Hogan <gregjhogan@gmail.com>

* Mazda: log standstill bit (commaai#24923)

* set standstill bit for mazda

* use bit in carcontroller

* Revert "use bit in carcontroller"

This reverts commit f38210a.

* Bump laika (commaai#24920)

* test_models: check cruiseState.available (commaai#24924)

* check available is true if enabled is true

* remove extra line

* bump laika

* ui: metric wider set speed box (commaai#24890)

* Revert "VW FPv2: reduce number of ECU queries (commaai#24706)"

This reverts commit 6c02e55.

* ui: draw MAX above set speed (commaai#24930)

* replay: handle missing socket while replaying route log with --allow flag (commaai#24933)

* fix: fix the problem with replay routes locally

* fix: Exception with --allow flag in replay.cc

Co-authored-by: Anton Rudomaneko <anton.rudomanenko@nami.ru>

* car_bug_report.yml: fix labels

* Revert "Rocket league model (commaai#24869)" (commaai#24936)

* Revert rocket league

* revert ref commit

* New model ref commit

* jenkins: set successful boot flag

* Honda Longitudinal: fix HUD max distance setting (commaai#24915)

Fix max distance setting on display

* update refs

* update camerad gitignores

* compatibility docs: fixup steering torque star (commaai#24940)

* Ascent has good torque, hard code Toyota, print all unexpected torque star cars

* update docs

* Use subtests

* hardcode CHR for now

generate

* Hard code Impreza

* update refs

* ui: change alerts to Inter (commaai#24937)

* ui: change alerts to Inter

* fix up test

* ui: change sidebar font to Inter (commaai#24931)

* change sidebar to inter

* clean up metric color rect radius

* fix text placement

* simplify rect placement

* ui: change set speed, speed limit and current speed to Inter (commaai#24932)

* ui: change set speed/speed limit to Inter

* switch current speed to Inter

* remove Open Sans fonts from assets (commaai#24946)

* DM: track RHD predictions (commaai#24947)

* driverview

* auto choose

* useless

* remove

* modeld not use toggle

* remove from params

* Revert "remove from params"

This reverts commit a08df0b.

* Revert "modeld not use toggle"

This reverts commit 2730bf8.

* Revert "remove"

This reverts commit 21f7cfa.

* Revert "driverview"

This reverts commit 222d129.

* semi revert

* Chrysler: fill cruiseState.available (commaai#24907)

* Update some signals to unified names and definitions

Co-authored-by: Jonathan <jraycec@gmail.com>

* steering looks good

* Fix cp signals

* Do steering signal changes separately

* bump opendbc to master

* fix

fix

* check available is true if enabled is true

* fix

* already added

* bump opendbc, better cruise status names

* bump opendbc

* bump opendbc to master

* bump panda

Co-authored-by: Jonathan <jraycec@gmail.com>

* CANParser: invalid until valid (commaai#24945)

* CANParser: invalid until valid

* bump opendbc

* bump opendbc

* fix counter in sim

* Refactor torque stuff (commaai#24921)

* Refactor torque stuff

* Add to release

* Add substitute and override

* Maxlataccel is required

* Add to asserts

* add ideal car

* Need china too

* yamls already linted

* Fixed some bugs

* Fixup

* Unreliable data

* Add cehck

* Better comment

* ref commit update

* Cleanup car interfaces (commaai#24948)

* remove interface overrides

* Fix test

* set torque tune for ev6

* EV6: adjust steering thresholds (commaai#24901)

* EV6: adjust steering thresholds

* Is there any friction

* bump panda

* no friction

Co-authored-by: Harald Schafer <harald.the.engineer@gmail.com>

* count_events improvements

* Navd added to README (commaai#24953) (commaai#24954)

* Navd added to README

* Update README.md

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

* use correct tty device for serial

* Laikad: minor refactor (commaai#24956)

extract code to get_est_pos func

* VW MQB: Add FW for 2016 Volkswagen Passat (commaai#24957)

* VW MQB: Add FW for 2016 Passat B8
Passat B8 TDi 2.0 240HP DSG 7 Europe

* mechanical sort

Co-authored-by: Pierre Christen <netadvanced@gmail.com>

* cleanup torque tuning config (commaai#24951)

* fix carla test fake driverState (commaai#24959)

use driverstatev2

* Speed up YAML parsing with CSafeLoader (commaai#24958)

Use CSafeLoader

* can replay: get logs in parallel (commaai#24960)

* get can replay segs in parallel

* total not needed

* Hyundai: remove bad esp fingerprint (commaai#24952)

Remove unknown "esp" fp

Co-authored-by: Gijs Koning <gijs-koning@live.nl>
Co-authored-by: Willem Melching <willem.melching@gmail.com>
Co-authored-by: grekiki <96022003+GregorKikelj@users.noreply.github.com>
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
Co-authored-by: Shane Smiskol <shane@smiskol.com>
Co-authored-by: Jason Young <46612682+jyoung8607@users.noreply.github.com>
Co-authored-by: Jonathan <jraycec@gmail.com>
Co-authored-by: HaraldSchafer <harald.the.engineer@gmail.com>
Co-authored-by: vanillagorillaa <ntmccoy@yahoo.com>
Co-authored-by: vanillagorillaa <31773928+vanillagorillaa@users.noreply.github.com>
Co-authored-by: kevinharbin <76784413+kevinharbin@users.noreply.github.com>
Co-authored-by: Robbe Derks <robbe.derks@gmail.com>
Co-authored-by: ZwX1616 <zwx1616@gmail.com>
Co-authored-by: Greg Hogan <gregjhogan@gmail.com>
Co-authored-by: Anton Rudomanenko <rudomanenkoanton@gmail.com>
Co-authored-by: Anton Rudomaneko <anton.rudomanenko@nami.ru>
Co-authored-by: Jason Wen <47793918+sunnyhaibin@users.noreply.github.com>
Co-authored-by: Ayushman Kumar <41910134+ayushmankumar7@users.noreply.github.com>
Co-authored-by: Pierre Christen <netadvanced@gmail.com>
spektor56 pushed a commit to spektor56/ghostpilot that referenced this pull request Jun 30, 2022
* More accurate jerk limits

* Min is not - max

For example max_curvature_rate can be negative.

* reduce diff
spektor56 pushed a commit to spektor56/ghostpilot that referenced this pull request Jul 1, 2022
* More accurate jerk limits

* Min is not - max

For example max_curvature_rate can be negative.

* reduce diff
spektor56 pushed a commit to spektor56/ghostpilot that referenced this pull request Jul 1, 2022
* More accurate jerk limits

* Min is not - max

For example max_curvature_rate can be negative.

* reduce diff
spektor56 pushed a commit to spektor56/ghostpilot that referenced this pull request Jul 1, 2022
* More accurate jerk limits

* Min is not - max

For example max_curvature_rate can be negative.

* reduce diff
spektor56 pushed a commit to spektor56/ghostpilot that referenced this pull request Jul 1, 2022
* More accurate jerk limits

* Min is not - max

For example max_curvature_rate can be negative.

* reduce diff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
controls controls/planner related enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants