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

#include <comprised_command.hpp>

Inheritance diagram for tap::control::ComprisedCommand:
Collaboration diagram for tap::control::ComprisedCommand:

Public Member Functions

 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 const char * getName () const =0
 
virtual bool isReady ()
 
virtual void initialize ()=0
 
virtual void execute ()=0
 
virtual void end (bool interrupted)=0
 
virtual bool isFinished () const =0
 

Protected Attributes

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

Detailed Description

A class with all the features of a Command but with the addition of a CommandScheduler that can be used to schedule multiple Commands inside a single Command. If you are making a comprised command, operations in this Command should operate at a high level. In essence, a comprised acts as a vessel for a state machine that when it wants to change the state of the robot, it adds/removes commands to its command scheduler instead of directly interacting with a subsystem.

For example, consider this use case: You have a Command that actuates a piston to grab something and another Command that flips a wrist that has the piston out. It would be nice to reuse these Commands and make a Command that flips the wrist out and then actuates the piston in quick succession. To do so, you can create a ComprisedCommand that consists of the two Commands described above. In this ComprisedCommand, first schedule the Command that flips the wrist out, then when that Command is done, schedule the Command that actuates the piston.

When you are using this the comprisedCommandScheduler, be sure to register Subsystems and add Subsystem dependencies for the Commands that will be added to the scheduler.

Constructor & Destructor Documentation

◆ ComprisedCommand()

tap::control::ComprisedCommand::ComprisedCommand ( Drivers drivers)
inline

Member Data Documentation

◆ comprisedCommandScheduler

CommandScheduler tap::control::ComprisedCommand::comprisedCommandScheduler
protected

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