> For the complete documentation index, see [llms.txt](https://velocity-raptors-9450.gitbook.io/intro-to-frc-programming-romi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://velocity-raptors-9450.gitbook.io/intro-to-frc-programming-romi/romi-command-based/commands/side-tangent-commandscheduler.md).

# Side Tangent- CommandScheduler

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` that runs commands that are scheduled. It's essentially the only thing (software wise) that makes the robot do stuff.

CommandScheduler does its logic every time in `RobotPeriodic()`  back in the[The Robot Class](/intro-to-frc-programming-romi/romi-command-based/the-robot-class.md) class. Every time it updates, it checks all the commands and subsystems stored in the robot.&#x20;

## Schedule()

If you ever need to manually schedule a command you can simply call this on the command:

```
command.schedule()
```

Doing this automatically schedules the command without needing a trigger (Go to [Commands](/intro-to-frc-programming-romi/romi-command-based/commands.md) for some context). However, it will have a different priority than trigger-bound commands, as shown below.

## Order of Scheduling

CommandSchedule 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.
