PID Subsystem

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. PID commands include a built-in PID controller. For an explanation of PID, see PID Controller.

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

Properties

Default Command
The command that runs when no other command is running on this subsystem. This command controls the default behaviour of this subsystem.
Send to SmartDashboard
Whether or not to send this PID Controller to the SmartDashboard for easy tuning and viewing.
Input
The sensor that tells the PID loop where it is.
Output
The actuator that controls movement of the mechanism.
P
The proportional constant for this PID Controller.
I
The integral constant for this PID Controller.
D
The derivative constant for this PID Controller.
F
The forcing constant for this PID Controller.
Tolerance
How close is close enough for the PID Controller to be considered on target, or at the right location.
Continuous
When true, the PID controller is to consider the input to be continuous. Rather than using the max and min as constraints, it considers them to be the same point and automatically calculates the shortest route to the setpoint.
Limit Input
Whether or not to limit the range of acceptable input values.
Minimum Input
The minimum input value, any value lower than this will be considered to have this value.
Maximum Input
The maximum input value, any value higher than this will be considered to have this value.
Limit Output
Whether or not to limit the range of acceptable output values.
Minimum Output
The minimum output value, any output that would have value lower will be output as this value.
Maximum Output
The maximum output value, any output that would have value higher will be output as this value.

Organization

Subsystem are primarily used as an organizational concept. In object oriented programming, they also are a very good basis for dividing up your robot into separate classes that encapsulate the relevant behaviour.

See Also

UNFINISHED