Input lag/delay on inputs sent to robot

Hello!
We’ve just finished building and wiring our robot for the BunnyBots competition. However, we’re now running into a strange issue. We’re encountering input delays in the seconds (3-5) over the radio, and input delays around half a second over a wired (USB-B) connection.

We’ve tried running the robot over two different laptops (same model) and two different USB-B cables. There is no delay when enabling or disabling the robot, only executing inputs. Viewing the controller inputs in Driverstation there is no delay between pressing buttons on the controller and them showing up in driver station.

We can run another robot, essentially just a swerve drivebase, with no input delay over both radio and USB-B cable using the same laptops. We ran the code from that drivebase on the delayed robot and encountered the same delay.

Looking at the logs, there doesn’t appear to be anything hugely out of the norm at first glace. Packet loss seems to be fine. Worth noting is that Driverstation lists the latency as being extremely low, which (combined with no delay enabling and disabling) seems to me to rule out the issue being the result of a laggy connection. If we have a motor run at a constant speed in a subsystem’s periodic method, it spins up immediately on enabling with no delay.

As for the hardware: Brand new RoboRio2 (brand new meaning untested), a known working radio, all our components besides the Rio are known to work as far as I’m aware.

Any ideas for troubleshooting?

By input delays do you mean just the joystick/operator controller or do you mean all input - DI, AI, etc. Hard to be specific without all the code but you need to narrow down the areas that could be delayed with some output that you can observe. You can output to the riolog, SmartDashboard, ShuffleBoard, digital output to blink LEDs, etc. You might need System.out.flush() on the riolog (I can’t remember) and I’m pretty sure you would on the driverstation console. The other technique you have is read the code - pretend you’re the computer and follow the logic looking for things you didn’t mean to happen.

Just as an update, we fixed the issue by updating our CANCoders as we noticed there was a lot of error printouts.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.