RobotPeriodic method in Timed Robot

Hello,
As our robot is beginning to take shape, and our programming team is able to become more independent (they were able to figure out the network tables for the limelight and program the robot to react to it without much guidance :grinning:), I am creating a new set of tutorials for them to take our robot to the next level.

We are currently planning on using the timed robot framework this year (We are considering exploring other frameworks in the off-season), but it occurred to me today as I create these tutorials, that there is a lot of data this year that we would like access periodically in both teleop and auto.

My question is, can we utilize the robotPeriodic method in the TimedRobot framework without being concerned with race conditions or slowing down the auto and teleop loops, or should we just make the leap to a more advanced framework?

~Mr. R^2

RobotPeriodic runs in the same loop after the autonomous or teleop periodic function runs. It was designed for doing exactly what you say, code that needs to happen in both modes.

1 Like

Thank you. Is it fast enough to use for encoders and the Navx Gyro as PID and Odometry inputs?

It runs in the same 50Hz loop, but yes, it should be fast enough for that. Granted, that depends what other processing your code is doing in the same cycle, so YMMV

1 Like