frc2399 / 2022-Season

This is our NEW repository for the 2022 Season.
Other
0 stars 5 forks source link

Add code to debounce limit switches #63

Open hschilling opened 2 years ago

edf42001 commented 2 years ago

image

https://docs.wpilib.org/en/stable/docs/software/advanced-controls/filters/debouncer.html

Things to consider: Debouncing adds a small delay between switch press and reaction time. Notice the three debounce modes:

edf42001 commented 2 years ago

Storytime: We used a limit switch to reset the encoder value of our elevator. When the elevator came off the limit switch, the switch bounced back, which reset the elevator when it was not at the home position. Then when it tried to move it slammed into the top of its track because it didn't know where it was. One way we fixed this was debouncing.

edf42001 commented 2 years ago

Video (Middle robot, red alliance): https://www.youtube.com/watch?v=_1gsjjIUMMY&t=6s

In this scenario, the issue is not with the pressing of the limit switch, but the releasing. Which of the three debouncing modes would be best here?