2022-06-24 20:52:53 +03: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.
|
|
|
|
|
|
|
|
|
|
#include "frc2/command/WrapperCommand.h"
|
|
|
|
|
|
2022-08-30 07:53:47 +03:00
|
|
|
#include "frc2/command/Command.h"
|
|
|
|
|
|
2022-06-24 20:52:53 +03:00
|
|
|
using namespace frc2;
|
|
|
|
|
|
|
|
|
|
WrapperCommand::WrapperCommand(std::unique_ptr<Command>&& command) {
|
2023-12-23 15:12:13 -05:00
|
|
|
CommandScheduler::GetInstance().RequireUngroupedAndUnscheduled(command.get());
|
2022-06-24 20:52:53 +03:00
|
|
|
m_command = std::move(command);
|
2022-12-07 07:13:31 +02:00
|
|
|
m_command->SetComposed(true);
|
2022-12-16 04:28:52 +02:00
|
|
|
// copy the wrapped command's name
|
|
|
|
|
SetName(m_command->GetName());
|
2022-06-24 20:52:53 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WrapperCommand::Initialize() {
|
|
|
|
|
m_command->Initialize();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WrapperCommand::Execute() {
|
|
|
|
|
m_command->Execute();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool WrapperCommand::IsFinished() {
|
|
|
|
|
return m_command->IsFinished();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WrapperCommand::End(bool interrupted) {
|
|
|
|
|
m_command->End(interrupted);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool WrapperCommand::RunsWhenDisabled() const {
|
|
|
|
|
return m_command->RunsWhenDisabled();
|
|
|
|
|
}
|
2022-08-30 07:53:47 +03:00
|
|
|
|
|
|
|
|
Command::InterruptionBehavior WrapperCommand::GetInterruptionBehavior() const {
|
|
|
|
|
return m_command->GetInterruptionBehavior();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
wpi::SmallSet<Subsystem*, 4> WrapperCommand::GetRequirements() const {
|
|
|
|
|
return m_command->GetRequirements();
|
|
|
|
|
}
|
2024-04-21 22:30:43 -05:00
|
|
|
|
|
|
|
|
void WrapperCommand::InitSendable(wpi::SendableBuilder& builder) {
|
|
|
|
|
m_command->InitSendable(builder);
|
|
|
|
|
}
|