What is Command-based Programming?

In FRC robots, most of them tend to structure their code so that they are "Command-Based". Well, what is "Command Based"? Command Based code is using commands to transmit data across classes.

In the RobotContainer class, we store our Triggers. These triggers are ran depending on various stimuli, such as when the user presses a specific button on their controller.

These triggers call commands. These commands are objects that carry data to subsystems- the different components of the robot such as its arm. The data the command carries depends- it can be the angle you want your robot's arm to point at, or the speed you want its wheels to move at. They have parameters, that you can use to define the data you want to send.

All of this might sound intimidating, but Subsystems, Commands, and Triggers are all just types of classes we will create here.

Command Scheduler

CommandScheduler is the main class that lets Command-Based programming in our project work. CommandScheduler is imported, and not really It is the class that stores and runs commands, and lets you update stuff in subsystems. More detail is explained in CommandScheduler.

Last updated