CommandScheduler
Updates your subsystems and runs your commands.
Contrary to popular belief, the robot doesn't run on a combination of the dark arts and human sacrifices. It uses CommandScheduler!
CommandScheduler is a singleton class that runs commands that are scheduled. Despite the name, it also manages subsystems by running the periodic() method.
CommandScheduler does its logic every time in RobotPeriodic() back in theThe Robot Class class. Every time it updates, it checks all the commands and subsystems stored in the robot.
Order of Scheduling
CommandScheduler has a pretty orderly way of running stuff. The order is:
1) Periodic() from subsystems
2) Commands scheduled from Triggers
3) Commands added via schedule()
4) Subsystems' default commands
Every time CommandScheduler updates (about once every 20 milliseconds), it checks for commands in this order.
Normally whatever level a command is on doesn't really matter. However- try to use commands scheduled from triggers the most. These types of commands are generally easier to control and see, as they are all stored in the RobotContainer class.
Last updated