Debouncing

One simple, quick question:

Do the joysticks (and other arbitrary toggle switches on the OI) need to be debounced in software, eg. checking to make sure that a joystick button value stays constant for a certain number of new data packets before accepting it?

Thanks in advance,
Robinson

Robinson,

Most people do not because a switch bounce is usually 3 or more orders of magnitude faster than the OI update rate. Only once in 13 years has my team needed a debounce routine on an OI input.

However, your mileage may vary…

Regards,

Mike

Thanks.

I second.

Last year, on the advice of an electrical engineer mentor, I wrote a fairly long [LEFT]debounce subroutine that I called for every switch input, totally forgetting how slow the processor is.
[/LEFT]
Long story short, it caused a lot of problems and wasted a lot of my time (a good half-week, and I was the only programmer). I realized later how silly that was, because we never ever had any bounce problems without it.

I agree, we did not debounce our custom switches last year and saw no issues.

Don

Our team used a debouncer last year, because we’ve had issues with buttons in the past (notably a joystick trigger in 2005, where sometimes it would see itself flipping on/off very quickly and try to actuate a pneumatic cylinder equally as fast).

I plan on using it again this year, and for the magnetic reed switches on cylinders in addition to buttons.

However, whether or not they are necessary is entirely dependent on how you control things, and whether or not your team is having issues with buttons. It’s not difficult to do, but if there’s no problem, those few hours on that are better spent elsewhere.

Thanks for the advice everybody. I guess while I have no robot to play with I will go ahead and write debouncing code to use with any toggle switches we may have on the OI. I don’t see a disadvantage to the 100ms spent debouncing, as that is still an order of magnitude faster than the robot would operate anyway.

Thanks again,
Robinson