Subsystems

What is it?

A subsystem on a robot is a distinct part of the robot that performs a certain function. Within the command based robot framework, subsystems are encapsulated (represented) by classes.

Subsystems can contain the following attributes:

  1. Sensors: Things that sense including buttons, potentiometers, encoders and more.
  2. Actuators: Things that move or act in the physical world, usually motors or pneumatics.
  3. State: The current status of the subsystem. This can include data recorded from sensors such as the position of an arm, the number of balls stored in a collector, information on progress towards a goal, a desired PID setpoint, and much more.
  4. Capabilities: Higher level actions that the subsystem can be told to perform by various commands. These are usually implemented by functions that update the subsystems state in some way.
  5. Note: Simple subsystems may be missing one or more of these attributes.

What is a default command?

Default commands are commands that run on a subsystem when no other command is running that requires the subsystem. They are the default behavior for the subsystem. This is often as simple as a do nothing command so that when a command driving the robot stops, the drive train of the robot stops as opposed to continuing the last motion it was given. It’s also possible to have more complicated default commands such as a turret that continuously tracks a target when not doing anything else.

Default commands are created just like any other command. The only minor difference when creating default commands is that you should generally have the isFinished() method return false so that the command is running continuously as opposed to stopping and restarting continuously when no other command is running.

See Also