[commands] C++: Add CommandPtr overload for SetDefaultCommand (#4488)

This commit is contained in:
Starlight220
2022-10-21 16:35:58 +03:00
committed by GitHub
parent 0ca274866b
commit 9c7e66a27d
4 changed files with 46 additions and 0 deletions

View File

@@ -4,6 +4,8 @@
#include "frc2/command/Subsystem.h"
#include "frc2/command/CommandPtr.h"
using namespace frc2;
Subsystem::~Subsystem() {
CommandScheduler::GetInstance().UnregisterSubsystem(this);
@@ -13,6 +15,11 @@ void Subsystem::Periodic() {}
void Subsystem::SimulationPeriodic() {}
void Subsystem::SetDefaultCommand(CommandPtr&& defaultCommand) {
CommandScheduler::GetInstance().SetDefaultCommand(this,
std::move(defaultCommand));
}
Command* Subsystem::GetDefaultCommand() const {
return CommandScheduler::GetInstance().GetDefaultCommand(this);
}