-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Refactor default Civic params #720
Conversation
selfdrive/car/__init__.py
Outdated
@@ -1,8 +1,36 @@ | |||
# functions common among cars | |||
from common.numpy_fast import clip | |||
|
|||
from selfdrive.config import Conversions as CV |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we remove this import? Just so we avoid risk of mutual imports (int.py should be very little dependent on other files)
selfdrive/car/__init__.py
Outdated
|
||
# TODO: start from empirically derived lateral slip stiffness for the civic and scale by | ||
# mass and CG position, so all cars will have approximately similar dyn behaviors | ||
def scale_tire_stiffness(mass, wheelbase, center_to_front, tire_stiffness_factor): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tire_stiffness_factor should default to 1, as it's not always necessary (see chrysler)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so the gm, chrysler, and hyundai? seemed odd to me at the time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well,
- chrysler we can use the default 1 (close enough to 0.888),
- hyundai is 1, so also we can use the default.
- for gm we should keep 0.444
selfdrive/car/chrysler/interface.py
Outdated
@@ -70,11 +60,13 @@ def get_params(candidate, fingerprint, vin=""): | |||
ret.lateralTuning.pid.kf = 0.00006 # full torque for 10 deg at 80mph means 0.00007818594 | |||
ret.steerActuatorDelay = 0.1 | |||
ret.steerRateCost = 0.7 | |||
tire_stiffness_factor = 0.444 # not optimized yet |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like this is an unnecessary addition and change?
Should be 0.888, but we can remove it per my comment above and assume it's 1 (param learner algorithm is quite quick and good.)
selfdrive/car/ford/interface.py
Outdated
ret.centerToFront = ret.wheelbase * 0.44 | ||
|
||
tire_stiffness_factor = 0.444 # not optimized |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be 0.53, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah 20% higher. wanted to double check on whether this number was based on a meaningful method, so I defaulted it at the time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
subjective tuning
selfdrive/car/gm/interface.py
Outdated
@@ -70,6 +70,7 @@ def get_params(candidate, fingerprint, vin=""): | |||
ret.steerRatio = 15.7 | |||
ret.steerRatioRear = 0. | |||
ret.centerToFront = ret.wheelbase * 0.4 # wild guess | |||
tire_stiffness_factor = 0.444 # not optimized yet |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same value for all cars, we can move it out.
selfdrive/car/__init__.py
Outdated
|
||
# FIXME: hardcoding honda civic 2016 touring params so they can be used to | ||
# scale unknown params for other cars | ||
class CivicParams: | ||
MASS = 2923. * CV.LB_TO_KG + STD_CARGO_KG | ||
MASS = 2923. * LB_TO_KG + STD_CARGO_KG |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, I mean just put the value in kg :)
selfdrive/car/toyota/interface.py
Outdated
# TODO: get actual value, for now starting with reasonable value for | ||
# civic and scaling by mass and wheelbase | ||
ret.rotationalInertia = rotationalInertia_civic * \ | ||
ret.mass * ret.wheelbase**2 / (mass_civic * wheelbase_civic**2) | ||
ret.rotationalInertia = scale_rot_inertia(mass=ret.mass, wheelbase=ret.wheelbase) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style preference: no need to repeat the input variable name. Since the inputs are non-optional, I would prefer:
scale_rot_inertia(ret.mass, ret.wheelbase)
this is great, lots of lines removed and nice clean up. Some comments to address, then will definitely merge. |
selfdrive/car/hyundai/interface.py
Outdated
@@ -82,6 +71,7 @@ def get_params(candidate, fingerprint, vin=""): | |||
ret.mass = 1985. + STD_CARGO_KG | |||
ret.wheelbase = 2.78 | |||
ret.steerRatio = 14.4 * 1.1 # 10% higher at the center seems reasonable | |||
tire_stiffness_factor = 0.444 # not optimized yet |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be 1. Also, same for all cars, so we can use the default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
optima and elantra use much lower values. should we keep these?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, which you did already.
Version 0.6.0.3-ku7 (2019-07-09) ======================== * HKG - Send fingerprints to Sentry * HKG - WIP: bring back mapd from 0.5.12 * HKG - WIP: Auto Set Cruise to Speed Limit * HKG - Don't Learn Min Steer Speed when turning corners * HKG - Create MDPS12 Message (to reduce/stop Stock cam faults) * HKG - Implement Min Speed Speed Warning * Better Panda * 0.6.0.2 Untested * update releases * bug * Send fingerprints to Sentry * Refactor default Civic params (commaai#720) * move civic params out * fix variable name * simplify ford scaling * cleanup * remove import dependency * requested changes * keep hyundai * 2019 Rav4 Limited AWD (commaai#732) * Fingerprint * Merge Limited and XLE fingerprint because they're the same * 0.6.0.3 - Untested * no mapd just yet * Remote ASL * Done * panda too
* Better Panda * 0.6.0.2 Untested * update releases * bug * Send fingerprints to Sentry * Refactor default Civic params (commaai#720) * move civic params out * fix variable name * simplify ford scaling * cleanup * remove import dependency * requested changes * keep hyundai * 2019 Rav4 Limited AWD (commaai#732) * Fingerprint * Merge Limited and XLE fingerprint because they're the same * 0.6.0.3 - Untested * no mapd just yet * Remote ASL * Done * panda too * mapd, auto speed and cloudlog * start mapd * Test * bug * better code * bug * bug * bug * bug * bug * tweak * Remove Min Speed Steer Disengage
* Better Panda * 0.6.0.2 Untested * update releases * bug * Send fingerprints to Sentry * Refactor default Civic params (commaai#720) * move civic params out * fix variable name * simplify ford scaling * cleanup * remove import dependency * requested changes * keep hyundai * 2019 Rav4 Limited AWD (commaai#732) * Fingerprint * Merge Limited and XLE fingerprint because they're the same * 0.6.0.3 - Untested * no mapd just yet * Remote ASL * Done * panda too * mapd, auto speed and cloudlog * start mapd * Test * bug * better code * bug * bug * bug * bug * bug * tweak * Remove Min Speed Steer Disengage * Fix lane centering with single lane line (#38) add fix of openpilot dev commaai#737 * Update STEER_DELTA_DOWN - Temp Remove CLU11 (#43)
* Better Panda * 0.6.0.2 Untested * update releases * bug * Send fingerprints to Sentry * Refactor default Civic params (commaai#720) * move civic params out * fix variable name * simplify ford scaling * cleanup * remove import dependency * requested changes * keep hyundai * 2019 Rav4 Limited AWD (commaai#732) * Fingerprint * Merge Limited and XLE fingerprint because they're the same * 0.6.0.3 - Untested * no mapd just yet * Remote ASL * Done * panda too * mapd, auto speed and cloudlog * start mapd * Test * bug * fix spacing in toyota/carstate.py (commaai#736) * better code * bug * bug * bug * bug * bug * tweak * Fix lane centering with single lane line (commaai#737) * add loggered, gpsd, sensord to gitignore (commaai#735) * Improve Toyota Highlander tuning from commaai#690 * Added 2019 Toyota Highlander (commaai#739) Tested latest commit on ICE version, and it worked flawlessly out of box. Fantastic experience. * Use standard steer angle sensor in DSU-less pre-TSS2 Toyota. (commaai#751) * Squashed 'cereal/' changes from 9f2076e..4ea03ba 4ea03ba add speed 2198ad2 add alert for invalid posenet 9c18b3b rename to posenetValid 42669a8 add posenet debug fields to LiveParameters 852846f add whether point is detected by radar 1684698 add model prob fb87dba added HW type to support various panda versions 820bf7b added tooDistracted event 1105dc1 different name 45c4249 add second model lead f8c557f Log can errors from panda 04f105a back ff93320 add lead stuff git-subtree-dir: cereal git-subtree-split: 4ea03ba * Squashed 'panda/' changes from ae816c1..45d0d28 45d0d28 remove whitespace (commaai#255) e49d0db Pedal: use avg between tracks (commaai#253) c597dcc VERSION update after health packet changes and minor misra test change 01072be Misra 11.x: pointer usage. (commaai#250) fd68c26 Propagate can_push errors (commaai#249) ce1daf2 Misra check only done for EON config 70d4fd7 cleanup docker container on failure 04756a0 Turning back Misra check: unvoluntarily change fcb1208 fix weird code in USB_ReadPacket b983cc8 Re-wrote test_misra.sh 0b19206 Misra 17.7: The value returned by a function having non-void return type shall be used. We should hang on initial failed safety_set_mode 06ee8bd Ignore Misra 5.4 until cppcheck bug (?) is fixed 4be8582 Update cppcheck commit and pass predefined params to avoid impossible combinations of configs f45dd04 cppcheck: ignore redundantAssignment and selfAssignment for registers in llcan.h 9ce6311 Misra 12.1 (operator order) and 10.4 (incompatible essential types) fixes, arised after properly checking UID_BASE config 1cd34e5 Explicitly set the define and undefine for unknown configs in misra checks 5a02499 remove esp flash from run_automated_tests.sh 23e3684 Cppcheck unused functions (commaai#247) c97d60b Removed bad language b031480 Missed adding Dockerfile 91ff6bb Run language checker in CI 205ec34 Improved language checker f7bbab0 Language checker test d9d0a62 Misra 5.5: missed this change from previous PR 85fa3c0 Misra 5.5: Identifiers shall be distinct from macro names (commaai#246) 190d604 Pedal: 2 minor fixes to Misra 15.7 (else needed) and 17.7 (non-void output must be used) 8ea01ff Pedal: no built-in functions to avoid puts and putc re-definitions 1f40d1e Misra pedal (commaai#245) a4554e3 Ignore advisory Misra 19.2: the union keyword should not be used e6dc417 Minor indent error 247e128 Fix strict compiler on bootstub build ba68569 Removed build strict test and enabled -Werror flag da11f0f safety replay: update openpilot-tools after logreader fix fc8b9e4 Cppcheck: also check pedal f7bd2c2 Misra 10.4: fix last 2 violations (commaai#242) 9be5fde finished misra 17.8 (commaai#241) 3c3aba3 Misra 10.4: Both operands of an operator in which the usual arithmetic conversions are performed shall have the same essential type category (commaai#240) f2a3a17 Misra 15_7: fix what seems to be a false positive of cppcheck 812ace5 Misra 15_7: if … else if constructs should be terminated with an else clause (commaai#230) 79e9735 rename 5_wifi_udp.py 3c3ff0c Update Jenkinsfile (commaai#239) 1bd9284 Misra 17.7: the value returned by a function having non-void return shall be used (commaai#237) 18c9e88 Merge pull request commaai#238 from commaai/misra_17_8 7ac321d Merge pull request commaai#235 from commaai/memxxx 004e543 Jenkins: run EON test first 4bff286 Merge branch 'memxxx' of github.com:commaai/panda into memxxx 7cd80de typo 385e33b 12.1 regression 955842b WIP ea908cb 10_1 violations: Operands shall not be of an inappropriate essential type (commaai#233) fa33038 Fix Misra 5.3: An identifier declared in an inner scope shall not hide an identifier declared in an outer scope (commaai#236) ebfe1c5 Merge branch 'master' of github.com:commaai/panda into memxxx 8c11470 Fix EON test case 64e18e8 fix inverted logic to differentiate between dev and EON panda builds 36755a0 Merge branch 'master' of github.com:commaai/panda into memxxx e2981d6 skip wifi tests for EON panda build db2eec9 Merge branch 'master' of github.com:commaai/panda into memxxx 11257e7 Ignore test 5_wifi_udp.py_ignore: too unreliable for now 6973c2a fix wifi tests cf6985a memxxx function changes to be Misra compliant 3a6cd29 wifi threshold perc back to 20%. Problem wasn't this. d92a035 faster docker build for safety replay 3e9469b Fixing tests after min->MIN change ecb9b6c Revert "Misra 10 1: Operands shall not be of an inappropriate essential type (commaai#232)" 8732e4f Misra 10 1: Operands shall not be of an inappropriate essential type (commaai#232) git-subtree-dir: panda git-subtree-split: 45d0d28 * Squashed 'opendbc/' changes from 38650f8..e1955ba e1955ba Nissan: Added nissan_2017.dbc (commaai#173) c89eb71 properly generate Lexus 350 dbc file d08059c Lexus RX 350 DBC (commaai#170) git-subtree-dir: opendbc git-subtree-split: e1955ba * openpilot v0.6.1 release * self.poller not used (commaai#759) I do not see the need for zmq and the poller being initialized and not used. * Remove offset from curvature (commaai#761) * Update README.md (commaai#766) * Squashed 'cereal/' changes from 4ea03ba..748002c 748002c angle calib desc 27db4a7 add camera rpy angle msg a71c4fa deprecate old dm model output 6c6ab96 remove hwType from ThermalData. Decided to have health at higher freq instead. This will make last 24H of collected data unreadable. Sorry. f27249e Add fields for LQR lateral control 654860c add decelForModel 995b558 add longitudinal plan source 222f2de add eye stuff eebf268 hasGps is a better name than hasGpsAntenna 12da45f Blackpanda (#4) git-subtree-dir: cereal git-subtree-split: 748002c * Squashed 'panda/' changes from 45d0d28..519e39e 519e39e Changed heartbeat timeout to be 2 seconds on no ignition 996dc40 Added heartbeat to black loopback testing 79b44cb bump version 59f5813 Black (commaai#254) 0964866 no need to store safety only misra output anymore git-subtree-dir: panda git-subtree-split: 519e39e * Squashed 'opendbc/' changes from e1955ba..7684440 7684440 chrysler: increase size of ACCEL_134 (commaai#174) git-subtree-dir: opendbc git-subtree-split: 7684440 * openpilot v0.6.2 release * Fix timeout in longitudinal test (commaai#772) * Fix timeout in longitudinal test * Update hyundaican for Correct Message ID on LKAS11 (commaai#746) This is the only trace of CF_Lkas_Icon found under /car/hyundai relative to open .dbc commaai/opendbc#172 * Revert "Update hyundaican for Correct Message ID on LKAS11 (commaai#746)" (commaai#775) This reverts commit 1f1893a. * Correct Message ID on LKAS11 under Openpilot .dbc (commaai#747) commaai/opendbc#172 * Revert "Revert "Update hyundaican for Correct Message ID on LKAS11 (commaai#746)" (commaai#775)" This reverts commit d5242c5. * Remove Min Speed Steer Disengage * Fix lane centering with single lane line (#38) add fix of openpilot dev commaai#737 * Update STEER_DELTA_DOWN - Temp Remove CLU11 (#43) * update min speed and support genesis * Stock LKAS not allowed to enagage (@xx979xx) * Reinsate CLU11 with xx979 changes * panda * bugs * bug * No Low Speed (yet) * fix checksumc error * attempt fix of cjhecksum discover * Low Speed Alert * update version * Update version
* move civic params out * fix variable name * simplify ford scaling * cleanup * remove import dependency * requested changes * keep hyundai
Update safety_toyota.h
refactor discussed in #714