Fang-Robotics-MCB
Fang Robotics Team Codebase
Loading...
Searching...
No Matches
tap::control::setpoint::UnjamIntegralCommand Class Reference

#include <unjam_integral_command.hpp>

Inheritance diagram for tap::control::setpoint::UnjamIntegralCommand:
Collaboration diagram for tap::control::setpoint::UnjamIntegralCommand:

Classes

struct  Config
 Config struct that the user passes into the UnjamIntegralCommand's constructor. More...
 

Public Member Functions

 UnjamIntegralCommand (IntegrableSetpointSubsystem &integrableSetpointSubsystem, const Config &config)
 
bool isReady () override
 
void initialize () override
 
void execute () override
 
void end (bool interrupted) override
 
bool isFinished () const override
 
const char * getName () const override
 
- Public Member Functions inherited from tap::control::Command
 Command ()
 
virtual ~Command ()
 
mockable subsystem_scheduler_bitmap_t getRequirementsBitwise () const
 
int getGlobalIdentifier () const
 
mockable void addSubsystemRequirement (Subsystem *requirement)
 

Additional Inherited Members

- Protected Attributes inherited from tap::control::Command
command_scheduler_bitmap_t commandRequirementsBitwise = 0
 

Detailed Description

Command that takes control of a velocity 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 will clear the velocity setpoint subsystem's jam and end. If not successful after some number of cycle counts, the command will give up and end without clearing the jam.

Unlike the unjam command, this command will displace the integral by some amount in order to facilitate unjamming.

Like most velocity commands this one will not schedule/will deschedule if IntegrableSetpointSubsystem goes offline.

Constructor & Destructor Documentation

◆ UnjamIntegralCommand()

tap::control::setpoint::UnjamIntegralCommand::UnjamIntegralCommand ( IntegrableSetpointSubsystem integrableSetpointSubsystem,
const Config config 
)
Parameters
[in]integrableSetpointSubsystemThe associated agitator subsystem to control.

Member Function Documentation

◆ end()

void tap::control::setpoint::UnjamIntegralCommand::end ( bool  interrupted)
overridevirtual

The action to take when the command ends. Called when either the command finishes normally, or when it interrupted/canceled.

Parameters
[in]interruptedwhether the command was interrupted/canceled.

Implements tap::control::Command.

◆ execute()

void tap::control::setpoint::UnjamIntegralCommand::execute ( )
overridevirtual

The main body of a command. Called repeatedly while the command is scheduled by a CommandScheduler.

Implements tap::control::Command.

◆ getName()

const char * tap::control::setpoint::UnjamIntegralCommand::getName ( ) const
inlineoverridevirtual
Returns
the name of the command, to be implemented by derived classes.

Implements tap::control::Command.

◆ initialize()

void tap::control::setpoint::UnjamIntegralCommand::initialize ( )
overridevirtual

The initial subroutine of a command. Called once when the command is initially scheduled by a CommandScheduler.

Note that command instances are re-used: a single command could be initialized, run, finished, then later initialized again. Ensure that initialize() resets any state stored in the command!

Implements tap::control::Command.

◆ isFinished()

bool tap::control::setpoint::UnjamIntegralCommand::isFinished ( ) const
overridevirtual

Whether the command has finished. Once a Command finishes, the scheduler will call the end() function and un-schedule it. If a Command is naturally finished (i.e. isFinished() == true), then the CommandScheduler will pass in false to end(). If, for example, another Command is added that in turn stops the Command from executing, then the CommandScheduler will pass in true to end().

Returns
whether the command has finished.

Implements tap::control::Command.

◆ isReady()

bool tap::control::setpoint::UnjamIntegralCommand::isReady ( )
overridevirtual

A check called right before a command is scheduled to determine whether or not a command should be scheduled. If return is true then the command is scheduled, if false then the command is not scheduled.

Not forced to be overridden, returns true by default.

Reimplemented from tap::control::Command.


The documentation for this class was generated from the following files: