Class UnjamCommand

Inheritance Relationships

Base Type

Class Documentation

class UnjamCommand : public tap::control::Command

Command that takes control of a setpoint subsystem moves it back and forth. One back and forward motion counts as a cycle. Unjamming cycles start by trying to move in negative direction before trying to move in positive direction.

If the unjam command successfully clears its forward and backward threshold it will return the setpoint of the subsystem back to its original value and call the setpoint subsystem’s clear jam method once the subsystem has reached it’s original value or once interrupted. If not successful, setpoint is set to current value so as to not damage motors.

If the subsystem fails to return to the original value after clearing its forward and backward thresholds it will continue the unjamming sequence with what remaining cycles it has.

Like most setpoint commands this one will not schedule/will deschedule if setpointSubsystem goes offline.

Note

: If the command does not seem to successfully clear your subsystem’s jam status try increasing the maxUnjamWaitTime. The command may not have enough time to return to the original setpoint before unjamming as this distance is potentially much greater than the unjam displacement.

Public Functions

UnjamCommand(SetpointSubsystem *setpointSubsystem, float unjamDisplacement, float unjamThreshold, uint32_t maxWaitTime, uint_fast16_t targetCycleCount)
Parameters:
  • setpointSubsystem[in] The associated agitator subsystem to control.

  • unjamDisplacement[in] How far to attempt to displace the subsystem during an unjam. This value should be positive! Absolute value will be taken if negative.

  • unjamThreshold[in] The minimum displacement to be reached both forwards and backwards before the subsystem is considered unjammed. This value must be positive. Absolute value will be taken if negative.

  • maxWaitTime[in] The maximum amount of time the controller will wait for the subsystem to reach unjamDisplacement in milliseconds before trying to move in the opposite direction.

  • targetCycleCount[in] the number of cycles to attempt to wiggle the subsystem

virtual bool isReady() override
virtual void initialize() override
virtual void execute() override
virtual void end(bool interrupted) override
virtual bool isFinished() const override
inline virtual const char *getName() const override