Quote:
Originally Posted by Andrew Schreiber
|
Our
11 code has the full implementation of it (for a 2-speed), but the code is a bit messy and I would implement it differently now. It's drivetrain/autotrans.vi. Upshift was enabled (and the driver feedback was all good), both downshifts were disabled due to driver feedback (Specifically he would rely on coasting into the peg with a tube, and the coast down would throw off his maneuvering as he was slowing down). Better calibration could have likely improved this.
The logic is fairly simple. We do three types of shifts:
Upshifts
Coast down shifts
Kick down shifts
Acceleration should be multiplied by the sign of velocity (or the abs of velocity should be used to calculate acceleration) to normalize for changes in direction.
Upshifts are based on thresholds for speed (greater than), abs of avg of throttles (for skid steer - this is pre-halo and culver drives) (greater than), vehicle acceleration (greater than), abs of diff of throttles (less than) (not turning)
Coast down shifts are based on absolute low speed (~2fps).
Kick downs are based on speed (we used 8 fps, which is higher than redline in low) (less than), abs of avg of throttles (greater than), not turning, vehicle acceleration negative and less than calibration (large negative number).
Upshift handles normal upshift driving.
Coast down shifts back when the vehicle speed is close to zero so it can upshift again at he next launch.
Kick down shifts down when you hit something and need to push.
This algorithm worked well enough for FRC. The corner cases (when turning) are simply ignored by the autoshifter, which was 'good enough'. We also impose a minimum time between shifts to prevent gear hunting, most automatic shift implementations see this and our solution is a 500ms inhibit timer.