-
Notifications
You must be signed in to change notification settings - Fork 9.1k
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
Fix lane centering with single lane line #737
Conversation
@@ -44,7 +44,7 @@ def update(self, v_ego, md): | |||
self.lane_width_certainty += 0.05 * (lr_prob - self.lane_width_certainty) | |||
current_lane_width = abs(l_poly[3] - r_poly[3]) | |||
self.lane_width_estimate += 0.005 * (current_lane_width - self.lane_width_estimate) | |||
speed_lane_width = interp(v_ego, [0., 31.], [3., 3.8]) | |||
speed_lane_width = interp(v_ego, [0., 31.], [2.8, 3.5]) |
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.
The Interstate Highway standards for the U.S. Interstate Highway System use a 12-foot (3.7 m) standard lane width, while narrower lanes are used on lower classification roads. In Europe, laws and road widths vary by country; the minimum widths of lanes are generally between 2.5 to 3.25 meters (8.2 to 10.7 ft).
So yeah, I think assuming slightly smaller lane lines by default will help for the average case and also for the case you described.
add fix of openpilot dev commaai#737
@rbiasini this commit seems to make my vehicle ride much too closely to a single lane line. Additionally, lane width is set when both lane lines are detected, right? So if I was in a curve where both lines weren't solid throughout (such as the right one dropped out), the "center" would then immediately revert to the single lane line calculation (this PR) Then, if the right lane line, or whatever, was picked up again, center would immediately be set to the actual center. This can cause the recent undesired behavior of my vehicle jerking around in corners and often crossing the center line. https://discordapp.com/channels/469524606043160576/574796986822295569/602316109701447701^^ this may not be immediately related to this issue, but crossing the center line where I'd front end oncoming traffic forced me to investigate. Jerking around, crossing the center line: Reverting this PR: Community feedback: In fact, I can't remember hardly any experiences that OP didn't turn enough pre-PR. If anything, I want to be further from the center line in curves, so I don't sideswipe oncoming traffic. Hondas don't have nearly as much torque as Toyota, and I'm driving a Prius. Maybe the additional desired angle is needed on Hondas to make up for this. |
You know what would be cool @Gernby @pd0wm @geohot ? If OP took the actual, calculated lane width when both lines were detected, and setup more of slow decay moving average back to a single lane line estimation; kind of like how ParamsLearner works with slow angle offset, with higher v_ego increasing the learning rate (possibly), or gating the "learners" to a range of v_egos. This way there isn't sudden center changes dependent on if both lane lines are detected, or not - smoothing out lateral performance in changing road conditions. Lane widths are rather regionally based, and some sort of slow decay, moving average learner that is persistent would resolve the need for hard coded, manually tuned values. Indiana people usually drive on Indiana roads, which follow lane width construction best practices (for their region), Californians, Europeans, etc. |
Slow decay sounds good. Let me know when you're done coding that ;-) |
@zorrobyte It seems that the issue you're describing is due to the existing "decay" rate being too high. The current decay rate will cause lane width to transition back to the speed_lane_width in about 1 second after a lane line disappears. If the coefficient in the highlighted line below was changed to 0.01, the rate would be about 5 seconds. |
That makes sense @Gernby 0.05*20hz = 1 sec. I'll test this fix and report my findings (I've set mine to 10sec) |
I think that the coefficient 2 lines down should be reduced by the same factor, or it may create weird behaviors |
I just realized that my ret.steerActuatorDelay was set to 0.8 and not 0.08 as I expected. |
Damn, and I thought Comma's stock value of 0.5 was high... |
… with crossing lane lines
I think this was a good PR by @Gernby and I've modified my setup to use even smaller values than the PR (I set speed_lane_width to 2.8). I live in an area with small lanes (Los Angeles), which is probably not the norm, and when one lane line is not detected well stock OP (devel) tends to pull into the other lane. Basically, if your lane width is overestimated by the speed_lane_width variable your vehicle will have the effect of moving away from the high-probability lane line, which makes little sense IMO. It seems safer to have the default setup hug the one visible lane line vs potentially move into the other lane. |
@jasonhamilton see #755 |
@zorrobyte Thanks! That code looks promising! |
add fix of openpilot dev commaai#737
* 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)
… with crossing lane lines
* 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 38650f842..e1955ba06 e1955ba06 Nissan: Added nissan_2017.dbc (commaai#173) c89eb71df properly generate Lexus 350 dbc file d08059c77 Lexus RX 350 DBC (commaai#170) git-subtree-dir: opendbc git-subtree-split: e1955ba06e3308dbbfb4bcda78d0e6495bc9ff7e * 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 e1955ba06..7684440b1 7684440b1 chrysler: increase size of ACCEL_134 (commaai#174) git-subtree-dir: opendbc git-subtree-split: 7684440b14253f03b7420c4b24da5fbdeb0b9954 * 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
… with crossing lane lines
… with crossing lane lines
… with crossing lane lines
… with crossing lane lines
… with crossing lane lines
… with crossing lane lines
Update interface.py
This is to fix the new lane centering issue that was introduced by changes to the 0.6 MPC. The new MPC logic does improve OP performance with single lane lines IF the lane is wide. However, if the lane is not wider than the US Interstate Highway standard, then the values below will cause the MPC to steer the vehicle too far away from the 1 visible lane line. This fix will prevent that by using a more conservative default width, which will draw the vehicle closer to the 1 visible lane line.