Settle distance moves faster with a minimum push near the target - #102
Merged
Merged
Conversation
The distance PID's output shrinks with the distance left, so stopped drives crawled their last few inches at the friction limit: a 24 in drive on a 200 rpm base took 3.9 s and stopped 1.3 in short in the physics simulator. driveTo() and moveToPoint() keep at least settle_min_voltage (1.5 V) while outside the small exit band. boomerang() resumed approach whenever its final turn drifted just outside the position band, and could loop until its time limit; it now resumes only past twice the band.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The distance PID's output shrinks with the distance left. Near the target it falls to about what the drive needs to overcome friction, so the robot crawls. Then it exits on the "within 1.5 in for 250 ms" rule, short of the target. In the physics simulator, a 24 in drive on a 200 rpm base spent its last 3 in at 0.6–1.2 V, took 3.9 s and stopped 1.3 in short.
Change
MotionConfig::settle_min_voltage(new, 1.5 V; 0 turns it off): stoppeddriveTo()andmoveToPoint()push with at least this voltage, toward the target, while outsidedistance_exit.small_error(0.5 in).moveToPoint(): the floor only covers the part of the distance left that lies along the heading, so a target off to the side isn't pushed into an orbit.exitfalse) are unchanged.boomerang()hysteresis: after it starts its final turn, it goes back to driving only when drift exceeds twice the position band. Before, it went back at the band edge, so a final turn that shifted the robot slightly could loop pivot, approach, turn until the time limit. That's what madestress/ramsete_low_gripregress with the floor alone (RAMSETE's settle ends with a boomerang).Results
Full simulator matrix. No baseline scenario fails. The baseline is updated.
24 in drives with tracking wheels:
Newly passing:
four_motor_200/point_diagonalwith tracking wheels, plain and with the fusion;six_motor_450/point_diagonalandspeed_base/ramsete_s_curvewith drive encoders.Not fixed
four_motor_200/boomerangandspeed_base/boomerangstill time out, now at 43° and 102° off heading. The cause is how the boomerang approaches, not settling; it's #101. Steering to the final heading inside 6 in was tried and made every boomerang worse, so it's not in this PR.Tests
motion_safety_test: a drive that needs 1 V to start moving. Without the floor,driveTo(24 in)stalls at 21.48 in and runs out its 4 s. With it, the drive reaches 23.15 in in 2.84 s. 1216 checks.make test: 56/56 pass.