2019-08-25 23:55:59 -04:00
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
/* Copyright (c) 2019 FIRST. All Rights Reserved. */
|
|
|
|
|
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
|
|
|
|
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
|
|
|
|
/* the project. */
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
#include "frc2/command/CommandScheduler.h"
|
|
|
|
|
|
2019-11-05 20:52:49 -08:00
|
|
|
#include <hal/HALBase.h>
|
2019-08-25 23:55:59 -04:00
|
|
|
#include <frc/RobotState.h>
|
|
|
|
|
#include <frc/WPIErrors.h>
|
|
|
|
|
#include <frc/smartdashboard/SendableBuilder.h>
|
2019-09-14 15:22:54 -05:00
|
|
|
#include <frc/smartdashboard/SendableRegistry.h>
|
2019-11-05 20:52:49 -08:00
|
|
|
#include <networktables/NetworkTableEntry.h>
|
|
|
|
|
#include <wpi/DenseMap.h>
|
2019-08-25 23:55:59 -04:00
|
|
|
|
2019-11-05 20:52:49 -08:00
|
|
|
#include "frc2/command/CommandGroupBase.h"
|
|
|
|
|
#include "frc2/command/CommandState.h"
|
|
|
|
|
#include "frc2/command/Subsystem.h"
|
2019-08-25 23:55:59 -04:00
|
|
|
|
|
|
|
|
using namespace frc2;
|
2019-11-05 20:52:49 -08:00
|
|
|
|
|
|
|
|
class CommandScheduler::Impl {
|
|
|
|
|
public:
|
|
|
|
|
// A map from commands to their scheduling state. Also used as a set of the
|
|
|
|
|
// currently-running commands.
|
|
|
|
|
wpi::DenseMap<Command*, CommandState> scheduledCommands;
|
|
|
|
|
|
|
|
|
|
// A map from required subsystems to their requiring commands. Also used as a
|
|
|
|
|
// set of the currently-required subsystems.
|
|
|
|
|
wpi::DenseMap<Subsystem*, Command*> requirements;
|
|
|
|
|
|
|
|
|
|
// A map from subsystems registered with the scheduler to their default
|
|
|
|
|
// commands. Also used as a list of currently-registered subsystems.
|
|
|
|
|
wpi::DenseMap<Subsystem*, std::unique_ptr<Command>> subsystems;
|
|
|
|
|
|
|
|
|
|
// The set of currently-registered buttons that will be polled every
|
|
|
|
|
// iteration.
|
|
|
|
|
wpi::SmallVector<wpi::unique_function<void()>, 4> buttons;
|
|
|
|
|
|
|
|
|
|
bool disabled{false};
|
|
|
|
|
|
|
|
|
|
// NetworkTable entries for use in Sendable impl
|
|
|
|
|
nt::NetworkTableEntry namesEntry;
|
|
|
|
|
nt::NetworkTableEntry idsEntry;
|
|
|
|
|
nt::NetworkTableEntry cancelEntry;
|
|
|
|
|
|
|
|
|
|
// Lists of user-supplied actions to be executed on scheduling events for
|
|
|
|
|
// every command.
|
|
|
|
|
wpi::SmallVector<Action, 4> initActions;
|
|
|
|
|
wpi::SmallVector<Action, 4> executeActions;
|
|
|
|
|
wpi::SmallVector<Action, 4> interruptActions;
|
|
|
|
|
wpi::SmallVector<Action, 4> finishActions;
|
|
|
|
|
|
|
|
|
|
// Flag and queues for avoiding concurrent modification if commands are
|
|
|
|
|
// scheduled/canceled during run
|
|
|
|
|
|
|
|
|
|
bool inRunLoop = false;
|
|
|
|
|
wpi::DenseMap<Command*, bool> toSchedule;
|
|
|
|
|
wpi::SmallVector<Command*, 4> toCancel;
|
|
|
|
|
};
|
|
|
|
|
|
2019-08-25 23:55:59 -04:00
|
|
|
template <typename TMap, typename TKey>
|
|
|
|
|
static bool ContainsKey(const TMap& map, TKey keyToCheck) {
|
|
|
|
|
return map.find(keyToCheck) != map.end();
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-05 20:52:49 -08:00
|
|
|
CommandScheduler::CommandScheduler() : m_impl(new Impl) {
|
2019-09-14 15:22:54 -05:00
|
|
|
frc::SendableRegistry::GetInstance().AddLW(this, "Scheduler");
|
|
|
|
|
}
|
2019-08-25 23:55:59 -04:00
|
|
|
|
2019-11-05 20:52:49 -08:00
|
|
|
CommandScheduler::~CommandScheduler() {}
|
|
|
|
|
|
2019-08-25 23:55:59 -04:00
|
|
|
CommandScheduler& CommandScheduler::GetInstance() {
|
|
|
|
|
static CommandScheduler scheduler;
|
|
|
|
|
return scheduler;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CommandScheduler::AddButton(wpi::unique_function<void()> button) {
|
2019-11-05 20:52:49 -08:00
|
|
|
m_impl->buttons.emplace_back(std::move(button));
|
2019-08-25 23:55:59 -04:00
|
|
|
}
|
|
|
|
|
|
2019-11-05 20:52:49 -08:00
|
|
|
void CommandScheduler::ClearButtons() { m_impl->buttons.clear(); }
|
2019-08-25 23:55:59 -04:00
|
|
|
|
|
|
|
|
void CommandScheduler::Schedule(bool interruptible, Command* command) {
|
2019-11-05 20:52:49 -08:00
|
|
|
if (m_impl->inRunLoop) {
|
|
|
|
|
m_impl->toSchedule.try_emplace(command, interruptible);
|
2019-10-18 10:56:12 -04:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-25 23:55:59 -04:00
|
|
|
if (command->IsGrouped()) {
|
|
|
|
|
wpi_setWPIErrorWithContext(CommandIllegalUse,
|
|
|
|
|
"A command that is part of a command group "
|
|
|
|
|
"cannot be independently scheduled");
|
|
|
|
|
return;
|
|
|
|
|
}
|
2019-11-05 20:52:49 -08:00
|
|
|
if (m_impl->disabled ||
|
2019-08-25 23:55:59 -04:00
|
|
|
(frc::RobotState::IsDisabled() && !command->RunsWhenDisabled()) ||
|
2019-11-05 20:52:49 -08:00
|
|
|
ContainsKey(m_impl->scheduledCommands, command)) {
|
2019-08-25 23:55:59 -04:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const auto& requirements = command->GetRequirements();
|
|
|
|
|
|
|
|
|
|
wpi::SmallVector<Command*, 8> intersection;
|
|
|
|
|
|
|
|
|
|
bool isDisjoint = true;
|
|
|
|
|
bool allInterruptible = true;
|
2019-11-05 20:52:49 -08:00
|
|
|
for (auto&& i1 : m_impl->requirements) {
|
2019-08-25 23:55:59 -04:00
|
|
|
if (requirements.find(i1.first) != requirements.end()) {
|
|
|
|
|
isDisjoint = false;
|
2019-11-05 20:52:49 -08:00
|
|
|
allInterruptible &=
|
|
|
|
|
m_impl->scheduledCommands[i1.second].IsInterruptible();
|
2019-08-25 23:55:59 -04:00
|
|
|
intersection.emplace_back(i1.second);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isDisjoint || allInterruptible) {
|
|
|
|
|
if (allInterruptible) {
|
|
|
|
|
for (auto&& cmdToCancel : intersection) {
|
|
|
|
|
Cancel(cmdToCancel);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
command->Initialize();
|
2019-11-05 20:52:49 -08:00
|
|
|
m_impl->scheduledCommands[command] = CommandState{interruptible};
|
|
|
|
|
for (auto&& action : m_impl->initActions) {
|
2019-08-25 23:55:59 -04:00
|
|
|
action(*command);
|
|
|
|
|
}
|
|
|
|
|
for (auto&& requirement : requirements) {
|
2019-11-05 20:52:49 -08:00
|
|
|
m_impl->requirements[requirement] = command;
|
2019-08-25 23:55:59 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CommandScheduler::Schedule(Command* command) { Schedule(true, command); }
|
|
|
|
|
|
|
|
|
|
void CommandScheduler::Schedule(bool interruptible,
|
|
|
|
|
wpi::ArrayRef<Command*> commands) {
|
|
|
|
|
for (auto command : commands) {
|
|
|
|
|
Schedule(interruptible, command);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CommandScheduler::Schedule(bool interruptible,
|
|
|
|
|
std::initializer_list<Command*> commands) {
|
|
|
|
|
for (auto command : commands) {
|
|
|
|
|
Schedule(interruptible, command);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CommandScheduler::Schedule(wpi::ArrayRef<Command*> commands) {
|
|
|
|
|
for (auto command : commands) {
|
|
|
|
|
Schedule(true, command);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CommandScheduler::Schedule(std::initializer_list<Command*> commands) {
|
|
|
|
|
for (auto command : commands) {
|
|
|
|
|
Schedule(true, command);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CommandScheduler::Run() {
|
2019-11-05 20:52:49 -08:00
|
|
|
if (m_impl->disabled) {
|
2019-08-25 23:55:59 -04:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Run the periodic method of all registered subsystems.
|
2019-11-05 20:52:49 -08:00
|
|
|
for (auto&& subsystem : m_impl->subsystems) {
|
2019-08-25 23:55:59 -04:00
|
|
|
subsystem.getFirst()->Periodic();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Poll buttons for new commands to add.
|
2019-11-05 20:52:49 -08:00
|
|
|
for (auto&& button : m_impl->buttons) {
|
2019-08-25 23:55:59 -04:00
|
|
|
button();
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-05 20:52:49 -08:00
|
|
|
m_impl->inRunLoop = true;
|
2019-08-25 23:55:59 -04:00
|
|
|
// Run scheduled commands, remove finished commands.
|
2019-11-05 20:52:49 -08:00
|
|
|
for (auto iterator = m_impl->scheduledCommands.begin();
|
|
|
|
|
iterator != m_impl->scheduledCommands.end(); iterator++) {
|
2019-08-25 23:55:59 -04:00
|
|
|
Command* command = iterator->getFirst();
|
|
|
|
|
|
|
|
|
|
if (!command->RunsWhenDisabled() && frc::RobotState::IsDisabled()) {
|
|
|
|
|
Cancel(command);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
command->Execute();
|
2019-11-05 20:52:49 -08:00
|
|
|
for (auto&& action : m_impl->executeActions) {
|
2019-08-25 23:55:59 -04:00
|
|
|
action(*command);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (command->IsFinished()) {
|
|
|
|
|
command->End(false);
|
2019-11-05 20:52:49 -08:00
|
|
|
for (auto&& action : m_impl->finishActions) {
|
2019-08-25 23:55:59 -04:00
|
|
|
action(*command);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (auto&& requirement : command->GetRequirements()) {
|
2019-11-05 20:52:49 -08:00
|
|
|
m_impl->requirements.erase(requirement);
|
2019-08-25 23:55:59 -04:00
|
|
|
}
|
|
|
|
|
|
2019-11-05 20:52:49 -08:00
|
|
|
m_impl->scheduledCommands.erase(iterator);
|
2019-08-25 23:55:59 -04:00
|
|
|
}
|
|
|
|
|
}
|
2019-11-05 20:52:49 -08:00
|
|
|
m_impl->inRunLoop = false;
|
2019-10-18 10:56:12 -04:00
|
|
|
|
2019-11-05 20:52:49 -08:00
|
|
|
for (auto&& commandInterruptible : m_impl->toSchedule) {
|
2019-10-18 10:56:12 -04:00
|
|
|
Schedule(commandInterruptible.second, commandInterruptible.first);
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-05 20:52:49 -08:00
|
|
|
for (auto&& command : m_impl->toCancel) {
|
2019-10-18 10:56:12 -04:00
|
|
|
Cancel(command);
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-05 20:52:49 -08:00
|
|
|
m_impl->toSchedule.clear();
|
|
|
|
|
m_impl->toCancel.clear();
|
2019-08-25 23:55:59 -04:00
|
|
|
|
|
|
|
|
// Add default commands for un-required registered subsystems.
|
2019-11-05 20:52:49 -08:00
|
|
|
for (auto&& subsystem : m_impl->subsystems) {
|
|
|
|
|
auto s = m_impl->requirements.find(subsystem.getFirst());
|
|
|
|
|
if (s == m_impl->requirements.end() && subsystem.getSecond()) {
|
2019-08-25 23:55:59 -04:00
|
|
|
Schedule({subsystem.getSecond().get()});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CommandScheduler::RegisterSubsystem(Subsystem* subsystem) {
|
2019-11-05 20:52:49 -08:00
|
|
|
m_impl->subsystems[subsystem] = nullptr;
|
2019-08-25 23:55:59 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CommandScheduler::UnregisterSubsystem(Subsystem* subsystem) {
|
2019-11-05 20:52:49 -08:00
|
|
|
auto s = m_impl->subsystems.find(subsystem);
|
|
|
|
|
if (s != m_impl->subsystems.end()) {
|
|
|
|
|
m_impl->subsystems.erase(s);
|
2019-08-25 23:55:59 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CommandScheduler::RegisterSubsystem(
|
|
|
|
|
std::initializer_list<Subsystem*> subsystems) {
|
|
|
|
|
for (auto* subsystem : subsystems) {
|
|
|
|
|
RegisterSubsystem(subsystem);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CommandScheduler::UnregisterSubsystem(
|
|
|
|
|
std::initializer_list<Subsystem*> subsystems) {
|
|
|
|
|
for (auto* subsystem : subsystems) {
|
|
|
|
|
UnregisterSubsystem(subsystem);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Command* CommandScheduler::GetDefaultCommand(const Subsystem* subsystem) const {
|
2019-11-05 20:52:49 -08:00
|
|
|
auto&& find = m_impl->subsystems.find(subsystem);
|
|
|
|
|
if (find != m_impl->subsystems.end()) {
|
2019-08-25 23:55:59 -04:00
|
|
|
return find->second.get();
|
|
|
|
|
} else {
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CommandScheduler::Cancel(Command* command) {
|
2019-11-05 20:52:49 -08:00
|
|
|
if (m_impl->inRunLoop) {
|
|
|
|
|
m_impl->toCancel.emplace_back(command);
|
2019-10-18 10:56:12 -04:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-05 20:52:49 -08:00
|
|
|
auto find = m_impl->scheduledCommands.find(command);
|
|
|
|
|
if (find == m_impl->scheduledCommands.end()) return;
|
2019-08-25 23:55:59 -04:00
|
|
|
command->End(true);
|
2019-11-05 20:52:49 -08:00
|
|
|
for (auto&& action : m_impl->interruptActions) {
|
2019-08-25 23:55:59 -04:00
|
|
|
action(*command);
|
|
|
|
|
}
|
2019-11-05 20:52:49 -08:00
|
|
|
m_impl->scheduledCommands.erase(find);
|
|
|
|
|
for (auto&& requirement : m_impl->requirements) {
|
2019-08-25 23:55:59 -04:00
|
|
|
if (requirement.second == command) {
|
2019-11-05 20:52:49 -08:00
|
|
|
m_impl->requirements.erase(requirement.first);
|
2019-08-25 23:55:59 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CommandScheduler::Cancel(wpi::ArrayRef<Command*> commands) {
|
|
|
|
|
for (auto command : commands) {
|
|
|
|
|
Cancel(command);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CommandScheduler::Cancel(std::initializer_list<Command*> commands) {
|
|
|
|
|
for (auto command : commands) {
|
|
|
|
|
Cancel(command);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CommandScheduler::CancelAll() {
|
2019-11-05 20:52:49 -08:00
|
|
|
for (auto&& command : m_impl->scheduledCommands) {
|
2019-08-25 23:55:59 -04:00
|
|
|
Cancel(command.first);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
double CommandScheduler::TimeSinceScheduled(const Command* command) const {
|
2019-11-05 20:52:49 -08:00
|
|
|
auto find = m_impl->scheduledCommands.find(command);
|
|
|
|
|
if (find != m_impl->scheduledCommands.end()) {
|
2019-08-25 23:55:59 -04:00
|
|
|
return find->second.TimeSinceInitialized();
|
|
|
|
|
} else {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
bool CommandScheduler::IsScheduled(
|
|
|
|
|
wpi::ArrayRef<const Command*> commands) const {
|
|
|
|
|
for (auto command : commands) {
|
|
|
|
|
if (!IsScheduled(command)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool CommandScheduler::IsScheduled(
|
|
|
|
|
std::initializer_list<const Command*> commands) const {
|
|
|
|
|
for (auto command : commands) {
|
|
|
|
|
if (!IsScheduled(command)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool CommandScheduler::IsScheduled(const Command* command) const {
|
2019-11-05 20:52:49 -08:00
|
|
|
return m_impl->scheduledCommands.find(command) !=
|
|
|
|
|
m_impl->scheduledCommands.end();
|
2019-08-25 23:55:59 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Command* CommandScheduler::Requiring(const Subsystem* subsystem) const {
|
2019-11-05 20:52:49 -08:00
|
|
|
auto find = m_impl->requirements.find(subsystem);
|
|
|
|
|
if (find != m_impl->requirements.end()) {
|
2019-08-25 23:55:59 -04:00
|
|
|
return find->second;
|
|
|
|
|
} else {
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-05 20:52:49 -08:00
|
|
|
void CommandScheduler::Disable() { m_impl->disabled = true; }
|
2019-08-25 23:55:59 -04:00
|
|
|
|
2019-11-05 20:52:49 -08:00
|
|
|
void CommandScheduler::Enable() { m_impl->disabled = false; }
|
2019-08-25 23:55:59 -04:00
|
|
|
|
|
|
|
|
void CommandScheduler::OnCommandInitialize(Action action) {
|
2019-11-05 20:52:49 -08:00
|
|
|
m_impl->initActions.emplace_back(std::move(action));
|
2019-08-25 23:55:59 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CommandScheduler::OnCommandExecute(Action action) {
|
2019-11-05 20:52:49 -08:00
|
|
|
m_impl->executeActions.emplace_back(std::move(action));
|
2019-08-25 23:55:59 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CommandScheduler::OnCommandInterrupt(Action action) {
|
2019-11-05 20:52:49 -08:00
|
|
|
m_impl->interruptActions.emplace_back(std::move(action));
|
2019-08-25 23:55:59 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CommandScheduler::OnCommandFinish(Action action) {
|
2019-11-05 20:52:49 -08:00
|
|
|
m_impl->finishActions.emplace_back(std::move(action));
|
2019-08-25 23:55:59 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CommandScheduler::InitSendable(frc::SendableBuilder& builder) {
|
|
|
|
|
builder.SetSmartDashboardType("Scheduler");
|
2019-11-05 20:52:49 -08:00
|
|
|
m_impl->namesEntry = builder.GetEntry("Names");
|
|
|
|
|
m_impl->idsEntry = builder.GetEntry("Ids");
|
|
|
|
|
m_impl->cancelEntry = builder.GetEntry("Cancel");
|
2019-08-25 23:55:59 -04:00
|
|
|
|
|
|
|
|
builder.SetUpdateTable([this] {
|
|
|
|
|
double tmp[1];
|
|
|
|
|
tmp[0] = 0;
|
2019-11-05 20:52:49 -08:00
|
|
|
auto toCancel = m_impl->cancelEntry.GetDoubleArray(tmp);
|
2019-08-25 23:55:59 -04:00
|
|
|
for (auto cancel : toCancel) {
|
|
|
|
|
uintptr_t ptrTmp = static_cast<uintptr_t>(cancel);
|
|
|
|
|
Command* command = reinterpret_cast<Command*>(ptrTmp);
|
2019-11-05 20:52:49 -08:00
|
|
|
if (m_impl->scheduledCommands.find(command) !=
|
|
|
|
|
m_impl->scheduledCommands.end()) {
|
2019-08-25 23:55:59 -04:00
|
|
|
Cancel(command);
|
|
|
|
|
}
|
2019-11-05 20:52:49 -08:00
|
|
|
m_impl->cancelEntry.SetDoubleArray(wpi::ArrayRef<double>{});
|
2019-08-25 23:55:59 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
wpi::SmallVector<std::string, 8> names;
|
|
|
|
|
wpi::SmallVector<double, 8> ids;
|
2019-11-05 20:52:49 -08:00
|
|
|
for (auto&& command : m_impl->scheduledCommands) {
|
2019-08-25 23:55:59 -04:00
|
|
|
names.emplace_back(command.first->GetName());
|
|
|
|
|
uintptr_t ptrTmp = reinterpret_cast<uintptr_t>(command.first);
|
|
|
|
|
ids.emplace_back(static_cast<double>(ptrTmp));
|
|
|
|
|
}
|
2019-11-05 20:52:49 -08:00
|
|
|
m_impl->namesEntry.SetStringArray(names);
|
|
|
|
|
m_impl->idsEntry.SetDoubleArray(ids);
|
2019-08-25 23:55:59 -04:00
|
|
|
});
|
|
|
|
|
}
|
2019-11-05 20:52:49 -08:00
|
|
|
|
|
|
|
|
void CommandScheduler::SetDefaultCommandImpl(Subsystem* subsystem,
|
|
|
|
|
std::unique_ptr<Command> command) {
|
|
|
|
|
m_impl->subsystems[subsystem] = std::move(command);
|
|
|
|
|
}
|