Button class methods not working

So, we are programming a command-based robot and are trying to attach our commands to buttons on our joystick. However, whenever we do this in the code and deploy, the DriverStation tells us the loop time is overrun by .02 seconds so the buttons never run the commands. Only the toggleWhenPressed() method works but we can’t just use this because its impractical.

How do we fix this?

You probably have some sort of loop or delay that is hanging your 50Hz update loops. You’ll need to either find that or post your code so we can help find it.

1 Like

It’s likely in whatever command is getting run when the button is pressed.

1 Like

I’m sure that the execute method of your command is taking longer than 20 ms to run, which is giving you the loop overrun.

The rest of why things aren’t working is dependent on your code, which we can’t see at the moment to help further.