Fang-Robotics-MCB
Fang Robotics Team Codebase
Loading...
Searching...
No Matches
fang::chassis::FieldDriftCommand Class Reference

#include <field_drift_command.hpp>

Inheritance diagram for fang::chassis::FieldDriftCommand:
Collaboration diagram for fang::chassis::FieldDriftCommand:

Classes

struct  Config
 

Public Member Functions

 FieldDriftCommand (HolonomicSubsystem &holonomicSubsystem, ChassisInputHandler &inputHandler, const Config &config)
 
virtual ~FieldDriftCommand ()=default
 
const chargetName () const override
 
void initialize () override
 
void execute () override
 
void end (bool interrupted) override
 
bool isFinished () const
 
- 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 Member Functions

physics::Velocity2D getFieldTranslation () const
 
RPM getFieldRotation () const
 

Protected Attributes

HolonomicSubsystemholonomicSubsystem_
 
ChassisInputHandlerchassisInput_
 
const Config kConfig_
 
- Protected Attributes inherited from tap::control::Command
command_scheduler_bitmap_t commandRequirementsBitwise = 0
 

Static Protected Attributes

static constexpr const charkName {"Field Drift"}
 

Detailed Description

Moves the holonomic drive relative to the field. The orientation of the field is generally set in the direction that the robot faces on startup.

Constructor & Destructor Documentation

◆ FieldDriftCommand()

fang::chassis::FieldDriftCommand::FieldDriftCommand ( HolonomicSubsystem holonomicSubsystem,
ChassisInputHandler inputHandler,
const Config config 
)

This takes a chassis subsystem and the respective inputHandler

◆ ~FieldDriftCommand()

virtual fang::chassis::FieldDriftCommand::~FieldDriftCommand ( )
virtualdefault

Member Function Documentation

◆ end()

void fang::chassis::FieldDriftCommand::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 fang::chassis::FieldDriftCommand::execute ( )
overridevirtual

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

Implements tap::control::Command.

Reimplemented in fang::chassis::ShurikenCommand, and fang::chassis::TardisCommand.

◆ getFieldRotation()

RPM fang::chassis::FieldDriftCommand::getFieldRotation ( ) const
protected

Scales the rotation input on the remote into a rotation where counterclockwise is positive

◆ getFieldTranslation()

physics::Velocity2D fang::chassis::FieldDriftCommand::getFieldTranslation ( ) const
protected

Scales input translation into tangible values

◆ getName()

const char * fang::chassis::FieldDriftCommand::getName ( ) const
overridevirtual
Returns
the name of the command, to be implemented by derived classes.

Implements tap::control::Command.

Reimplemented in fang::chassis::ShurikenCommand, and fang::chassis::TardisCommand.

◆ initialize()

void fang::chassis::FieldDriftCommand::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 fang::chassis::FieldDriftCommand::isFinished ( ) const
virtual

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

◆ chassisInput_

ChassisInputHandler& fang::chassis::FieldDriftCommand::chassisInput_
protected

◆ holonomicSubsystem_

HolonomicSubsystem& fang::chassis::FieldDriftCommand::holonomicSubsystem_
protected

◆ kConfig_

const Config fang::chassis::FieldDriftCommand::kConfig_
protected

◆ kName

constexpr const char* fang::chassis::FieldDriftCommand::kName {"Field Drift"}
staticconstexprprotected

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