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

#include <move_unjam_comprised_command.hpp>

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

Public Member Functions

 MoveUnjamComprisedCommand (tap::Drivers *drivers, SetpointSubsystem *setpointSubsystem, float moveDisplacement, uint32_t moveTime, uint32_t pauseAfterMoveTime, bool setToTargetOnEnd, float setpointTolerance, float unjamDisplacement, float unjamThreshold, uint32_t maxUnjamWaitTime, uint_fast16_t unjamCycleCount)
 
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::ComprisedCommand
 ComprisedCommand (Drivers *drivers)
 
- 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)
 
virtual bool isReady ()
 

Protected Attributes

SetpointSubsystemsetpointSubsystem
 
MoveCommand agitatorRotateCommand
 
UnjamCommand agitatorUnjamCommand
 
bool unjamSequenceCommencing
 
bool agitatorDisconnectFault
 
- Protected Attributes inherited from tap::control::ComprisedCommand
CommandScheduler comprisedCommandScheduler
 
- Protected Attributes inherited from tap::control::Command
command_scheduler_bitmap_t commandRequirementsBitwise = 0
 

Detailed Description

A comprised command that combines the unjam and move commands.

Assuming no jams occur, this command behaves like a MoveCommand. It will schedule once and end once the target displacement is reached. If it gets jammed while trying to move then the command will then schedule a UnjamCommand. At this point the command will end when the UnjamCommand ends.

See UnjamCommand and MoveCommand for more details on their respective logic.

Constructor & Destructor Documentation

◆ MoveUnjamComprisedCommand()

tap::control::setpoint::MoveUnjamComprisedCommand::MoveUnjamComprisedCommand ( tap::Drivers drivers,
SetpointSubsystem setpointSubsystem,
float  moveDisplacement,
uint32_t  moveTime,
uint32_t  pauseAfterMoveTime,
bool  setToTargetOnEnd,
float  setpointTolerance,
float  unjamDisplacement,
float  unjamThreshold,
uint32_t  maxUnjamWaitTime,
uint_fast16_t  unjamCycleCount 
)
Parameters
[in]driversA pointer to the Drivers struct.
[in]setpointSubsystemThe subsystem to interact with.
[in]moveDisplacementThe displacement the command will apply to the subsystem
[in]moveTimeSee MoveCommand for more details, passed on directly to its constructor.
[in]pauseAfterMoveTimeSee MoveCommand for more details, passed on directly to its constructor.
[in]setToTargetOnEndSee MoveCommand for more details, passed on directly to its constructor.
[in]setpointToleranceSee MoveCommand for more details, passed on directly to its constructor.
[in]unjamDisplacementSee UnjamCommand's constructor for more details, passed on directly to this command's constructor.
[in]unjamThresholdSee UnjamCommand's constructor for more details, passed on directly to this command's constructor.
[in]unjamCycleCountSee UnjamCommand's constructor for more details, passed on directly to this command's constructor.
[in]maxUnjamWaitTimeSee UnjamCommand's constructor for more details, passed on directly to this command's constructor.

Member Function Documentation

◆ end()

void tap::control::setpoint::MoveUnjamComprisedCommand::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::MoveUnjamComprisedCommand::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::MoveUnjamComprisedCommand::getName ( ) const
inlineoverridevirtual
Returns
the name of the command, to be implemented by derived classes.

Implements tap::control::Command.

◆ initialize()

void tap::control::setpoint::MoveUnjamComprisedCommand::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::MoveUnjamComprisedCommand::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.

Member Data Documentation

◆ agitatorDisconnectFault

bool tap::control::setpoint::MoveUnjamComprisedCommand::agitatorDisconnectFault
protected

◆ agitatorRotateCommand

MoveCommand tap::control::setpoint::MoveUnjamComprisedCommand::agitatorRotateCommand
protected

◆ agitatorUnjamCommand

UnjamCommand tap::control::setpoint::MoveUnjamComprisedCommand::agitatorUnjamCommand
protected

◆ setpointSubsystem

SetpointSubsystem* tap::control::setpoint::MoveUnjamComprisedCommand::setpointSubsystem
protected

◆ unjamSequenceCommencing

bool tap::control::setpoint::MoveUnjamComprisedCommand::unjamSequenceCommencing
protected

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