|
Fang-Robotics-MCB
Fang Robotics Team Codebase
|
#include <hold_repeat_command_mapping.hpp>


Public Member Functions | |
| HoldRepeatCommandMapping (Drivers *drivers, const std::vector< Command * > cmds, const RemoteMapState &rms, bool endCommandsWhenNotHeld, int maxTimesToSchedule=-1) | |
| ~HoldRepeatCommandMapping () override=default | |
| void | executeCommandMapping (const RemoteMapState &currState) override |
| mockable void | setMaxTimesToSchedule (int maxTimes) |
| Set the maximum times each of commands should be re-scheduled. | |
Public Member Functions inherited from tap::control::CommandMapping | |
| CommandMapping (Drivers *drivers, const std::vector< Command * > cmds, const RemoteMapState &rms) | |
| virtual | ~CommandMapping ()=default |
| virtual bool | mappingSubset (const RemoteMapState &mapState) |
| const RemoteMapState & | getAssociatedRemoteMapState () const |
| const std::vector< Command * > & | getAssociatedCommands () const |
Protected Member Functions | |
| void | incrementRescheduleCount (int cmdIndex) |
| bool | okToScheduleCommand (int cmdIndex) const |
Protected Member Functions inherited from tap::control::CommandMapping | |
| void | addCommands () |
| void | removeCommands () |
| bool | noCommandsScheduled () const |
Protected Attributes | |
| bool | held |
| bool | endCommandsWhenNotHeld |
| int | maxTimesToSchedule |
| std::vector< int > | rescheduleCounts |
Protected Attributes inherited from tap::control::CommandMapping | |
| const RemoteMapState | mapState |
| std::vector< Command * > | mappedCommands |
| Drivers * | drivers |
Additional Inherited Members | |
Static Public Member Functions inherited from tap::control::CommandMapping | |
| static bool | negKeysSubset (const RemoteMapState &state1, const RemoteMapState &state2) |
A CommandMapping that adds Commands when the contained mapping is a subset of the remote mapping. If a Command finishes and the contained mapping is still a subset of the remote mapping, it is added again. It then removes the Commands when the mapping is no longer a subset if endCommandsWhenNotHeld is true, or doesn't end commands if endCommandsWhenNotHeld is false. Furthermore, will stop scheduling commands if maxTimesToSchedule is not -1 after the command has been added to the scheduler maxTimesToSchedule.
Additionally, When neg keys are being used and the mapping's neg keys are a subset of the remote map state, the Commands are removed.
|
inline |
Constructor must take the set of Commands and the RemoteMapState.
| [in] | drivers | Global drivers instance. |
| [in] | cmds | vector of commands that will be scheduled by this command mapping. |
| [in] | rms | RemoteMapState that controls when commands will be scheduled. |
| [in] | endCommandsWhenNotHeld | If true, the commands will be forcibly ended by the command mapping when no longer being held. Otherwise, the commands will naturally finish. |
| [in] | maxTimesToSchedule | Number of times to reschedule each of the commands. If -1 is passed in, the command mapping will continue to reschedule the commands forever. If there are multiple commands that have the potential to end, each command will be scheduled maxTimesToSchedule. |
|
overridedefault |
Default destructor.
|
overridevirtual |
Using currState, determines whether or not to add or remove Commands from the main scheduler. Up the the implementer to determine what the criteria for adding and removing Commands should be.
| [in] | currState | The current state of the remote. |
Implements tap::control::CommandMapping.
|
inlineprotected |
|
inlineprotected |
|
inline |
Set the maximum times each of commands should be re-scheduled.
|
protected |
|
protected |
|
protected |
|
protected |