How to schedule something slower than default period of 0.02 s

I want to schedule a periodic method to run slower than WPILib’s default control period of 0.02 s. I want my control loops and actuators to still run at 0.02 s, but I want my smart dashboard calls to be in a separate loop. I see I can schedule methods through TimesliceRobot and CommandScheduler, however I cannot specify a custom period. Is there an easy way to accomplish this? Perhaps I can start my own separate thread for smart dashboard calls.

You can use the addPeriodic method of the TimedRobot class.

https://first.wpi.edu/wpilib/allwpilib/docs/release/java/edu/wpi/first/wpilibj/TimedRobot.html#addPeriodic(java.lang.Runnable,double)

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