2020-12-26 14:12:05 -08:00
|
|
|
// Copyright (c) FIRST and other WPILib contributors.
|
|
|
|
|
// Open Source Software; you can modify and/or share it under the terms of
|
|
|
|
|
// the WPILib BSD license file in the root directory of this project.
|
2019-08-25 23:55:59 -04:00
|
|
|
|
|
|
|
|
#include "frc2/command/Subsystem.h"
|
|
|
|
|
|
2022-10-21 16:35:58 +03:00
|
|
|
#include "frc2/command/CommandPtr.h"
|
|
|
|
|
|
2019-08-25 23:55:59 -04:00
|
|
|
using namespace frc2;
|
|
|
|
|
Subsystem::~Subsystem() {
|
|
|
|
|
CommandScheduler::GetInstance().UnregisterSubsystem(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Subsystem::Periodic() {}
|
|
|
|
|
|
2020-07-06 23:32:18 -07:00
|
|
|
void Subsystem::SimulationPeriodic() {}
|
|
|
|
|
|
2022-10-21 16:35:58 +03:00
|
|
|
void Subsystem::SetDefaultCommand(CommandPtr&& defaultCommand) {
|
|
|
|
|
CommandScheduler::GetInstance().SetDefaultCommand(this,
|
|
|
|
|
std::move(defaultCommand));
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-25 23:55:59 -04:00
|
|
|
Command* Subsystem::GetDefaultCommand() const {
|
|
|
|
|
return CommandScheduler::GetInstance().GetDefaultCommand(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Command* Subsystem::GetCurrentCommand() const {
|
|
|
|
|
return CommandScheduler::GetInstance().Requiring(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Subsystem::Register() {
|
|
|
|
|
return CommandScheduler::GetInstance().RegisterSubsystem(this);
|
|
|
|
|
}
|