Agitator Controller - MatthewMArnold/taproot GitHub Wiki

This page is dedicated to a description of the agitator controller and how it has been integrated into the command/subsystem framework. taproot provides a significant portion of the framework for designing an agitator in the form of the setpoint subsystem and associated commands. These allow developers to quickly design setpoint-based systems including agitators.

The setpoint subsystem is highly configurable and can also be used as primitives for engineer mechanisms. See the source code here. This page assumes you have read the page on the Command Subsystem Framework before looking at this page.

Setpoint Subsystem

The setpoint framework provides two subsystem interfaces and a variety of commands that may control these interfaces. These interfaces are the SetpointSubsystem and IntegrableSetpointSubsystem. The IntegrableSetpointSubsystem is identical to the SetpointSubsystem except that the setpoint is assumed to be integrable. As such, an additional getCurrentValueIntegral abstract function must be implemented by those who choose to extend this class. The benefit of defining an IntegrableSetpointSubsystem is that you can command the setpoint and measure the integral of the setpoint to see when you should 0 the setpoint.

As an example, consider an agitator. The agitator should move smoothly between two positions using a velocity PID controller. Thus you define a VelocityAgitator whose setpoint is velocity and whose integral is position, and the provided integrable setpoint commands will command the setpoint until the integral has changed by some amount of reached some position.

The setpoint framework also provides proven, tested, and highly configurable unjam detector and unjam command. This unjam logic has been rigerously tested on many different robots and has been proven to successfully unjam. Unjamming is a major struggle for many new teams, so it is important that taproot provides an unjamming solution for teams that have less development and testing time to use.

This documentation will highlight the integrable setpoint subsystem and its associated move unjam, and move unjam comprised command.

IntegrableSetpointSubsystem

This is an interface that enforces a variety of getters and setters required to fully control an integrable setpoint subsystem such as an agitator motor. This includes functions such as getCurrentValue, getSetpoint, setSetpoint, isJammed, and isOnline.

MoveIntegralCommand

This class is a command that aims to keep the an IntegrableSetpointSubsystem's setpoint at some target value until the integral of the setpoint over time equals a specified value.

  • Upon initialization, the subsystem's setpoint is set and the target integral computed.
  • The command is finished when the subsystem is jammed, the setpoint is offline, or the target integral has been reached.
  • Upon ending, the subsystem's setpoint is set to 0.

UnjamIntegralCommand

This class is responsible for unjamming an integrable command. The command keeps track of whether or not the jam has been cleared in a forward and backwards direction (that the agitator can move freely forwards and backwards, respectively). Once the command has successfully cleared the jam in both directions, the jam is considered to have been cleared and the command ends.

Below is a flowchart of the UnjamIntegralCommand's execution path.

SetpointContinuousJamChecker

This is a generic jam checker that is designed to be continuously called in a subsystem's refresh() function. A jam is detected by repeatedly calling check(), which returns true if the subsystem is jammed. To clear the jam, the user calls restart(). The jam checker continuously checks if the actual setpoint is within some threshold from the target setpoint. If the actual setpoint is not within the threshold of the target setpoint for some period, the subsystem will be considered jammed.

As an example, consider a velocity based integral setpoint subsystem. If the velocity target is 10 rad/second and the actual velocity is 0 rad/second for an extended period of time, the subsystem is clearly jammed.