team-fusionx / CarND-Capstone

Team FusionX - Capstone Project for Udacity Self-Driving Car Nanodegree
MIT License
8 stars 3 forks source link

DBW node resets braking LPF when going from manual braking to acceleration, to prevent slow speed up from stop. #133

Closed dinoboy197 closed 6 years ago

dinoboy197 commented 6 years ago

Per Slack conversation.

This resets the DBW brake low pass filter when switching to acceleration after manual braking. This should allow the vehicle to accelerate immediately, rather than waiting for the filtered braking value to lower through the lpf for several cycles.

dinoboy197 commented 6 years ago

I'm on the road and don't have enough battery power to get the simulator up and running to do exhaustive tests, but I can test later on tonight.

teeekay commented 6 years ago

This works when the order of the elif blocks on lines 105 to 125 of twist_controller_mod.py is reversed.

edufford commented 6 years ago

As @teeekay suggested, switching the elif condition order for PID braking and accel control give the accel thresholds higher priority to clear the manual brake filter in the near-zero speed area transition, where the tiny speed values cause some ambiguity in the mode selection.

Originally I think PID braking was given higher priority than accel on principle to ensure braking was maintained during a slow down, but that was before we had the is_decelerating flag so maybe it's ok to switch the order for this issue.

An alternate way could be to guard the error threshold to prevent it from shrinking to near zero as the velocity approaches zero, but that would be more complicated and would need more side-effect checking for all the mode transitions so maybe not worth it at this point.

edufford commented 6 years ago

Actually, I just realized that switching the elif condition order would make it so that PID braking would not be able to activate whenever is_decelerating is False, such as for a speed overshoot while driving. Maybe it would be better to try the error threshold min guard method instead.