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

#include <move_absolute_command.hpp>

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

Public Member Functions

 MoveAbsoluteCommand (tap::control::setpoint::SetpointSubsystem *setpointSubsystem, float setpoint, float speed, float setpointTolerance, bool shouldAutomaticallyClearJam, bool setSetpointToTargetOnEnd)
 
const char * getName () const override
 
bool isReady () override
 
void initialize () override
 
void execute () override
 
void end (bool interrupted) override
 
bool isFinished () 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)
 

Protected Attributes

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

Detailed Description

A command that uses an SetpointSubsystem to move to the same position/value everytime, attemping to rotate at the given velocity. (Coordinates may shift if motor disconnects). This command ends immediately if the agitator is jammed, and upon ending will stop the connected agitator by setting its target position to its current position.

Subsystem values are relative, and the "0"-value is changed when the agitator is calibrated.

Constructor & Destructor Documentation

◆ MoveAbsoluteCommand()

tap::control::setpoint::MoveAbsoluteCommand::MoveAbsoluteCommand ( tap::control::setpoint::SetpointSubsystem setpointSubsystem,
float  setpoint,
float  speed,
float  setpointTolerance,
bool  shouldAutomaticallyClearJam,
bool  setSetpointToTargetOnEnd 
)
explicit
Parameters
[in]setpointSubsystemthe subsystem this command manipulates.
[in]setpointthe target value the controlled variable should reach
[in]speedThe speed the subsystem should attempt to move its value at in units/second (where "units" are the same as those the setpoint uses)
[in]setpointTolerancethe command will consider the target value as reached when it's distance to the target is within this value
[in]shouldAutomaticallyClearJamthe command will clear the subsystem's jam state without any unjamming performed
[in]setSetpointToTargetOnEndthe command will set the subsystem's setpoint to the target value when ending if true, otherwise it will set the setpoint to the subsystem's current value.

Member Function Documentation

◆ end()

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

Implements tap::control::Command.

◆ initialize()

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

Member Data Documentation

◆ setpointSubsystem

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

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