Add periodic method to subsystems (#528)

Fixes #526.
This commit is contained in:
Austin Shalit
2017-07-02 23:02:41 -07:00
committed by Peter Johnson
parent 2da26c0579
commit aa0a874ad0
5 changed files with 27 additions and 0 deletions

View File

@@ -121,6 +121,13 @@ void Scheduler::Run() {
}
}
// Call every subsystem's periodic method
for (auto subsystemIter = m_subsystems.begin();
subsystemIter != m_subsystems.end(); subsystemIter++) {
Subsystem* subsystem = *subsystemIter;
subsystem->Periodic();
}
m_runningCommandsChanged = false;
// Loop through the commands

View File

@@ -104,6 +104,11 @@ void Subsystem::SetCurrentCommand(Command* command) {
*/
Command* Subsystem::GetCurrentCommand() const { return m_currentCommand; }
/**
* When the run method of the scheduler is called this method will be called.
*/
void Subsystem::Periodic() {}
/**
* Call this to alert Subsystem that the current command is actually the
* command.