mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
SCRIPT namespace replacements
This commit is contained in:
committed by
Peter Johnson
parent
ae6c043632
commit
9aca8e0fd6
@@ -13,10 +13,10 @@
|
||||
#include "wpi/util/sendable/SendableBuilder.hpp"
|
||||
#include "wpi/util/sendable/SendableRegistry.hpp"
|
||||
|
||||
using namespace frc2;
|
||||
using namespace wpi::cmd;
|
||||
|
||||
Command::Command() {
|
||||
wpi::SendableRegistry::Add(this, GetTypeName(*this));
|
||||
wpi::util::SendableRegistry::Add(this, GetTypeName(*this));
|
||||
}
|
||||
|
||||
Command::~Command() {
|
||||
@@ -32,7 +32,7 @@ void Command::Initialize() {}
|
||||
void Command::Execute() {}
|
||||
void Command::End(bool interrupted) {}
|
||||
|
||||
wpi::SmallSet<Subsystem*, 4> Command::GetRequirements() const {
|
||||
wpi::util::SmallSet<Subsystem*, 4> Command::GetRequirements() const {
|
||||
return m_requirements;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ void Command::AddRequirements(Requirements requirements) {
|
||||
m_requirements.insert(requirements.begin(), requirements.end());
|
||||
}
|
||||
|
||||
void Command::AddRequirements(wpi::SmallSet<Subsystem*, 4> requirements) {
|
||||
void Command::AddRequirements(wpi::util::SmallSet<Subsystem*, 4> requirements) {
|
||||
m_requirements.insert(requirements.begin(), requirements.end());
|
||||
}
|
||||
|
||||
@@ -49,22 +49,22 @@ void Command::AddRequirements(Subsystem* requirement) {
|
||||
}
|
||||
|
||||
void Command::SetName(std::string_view name) {
|
||||
wpi::SendableRegistry::SetName(this, name);
|
||||
wpi::util::SendableRegistry::SetName(this, name);
|
||||
}
|
||||
|
||||
std::string Command::GetName() const {
|
||||
return wpi::SendableRegistry::GetName(this);
|
||||
return wpi::util::SendableRegistry::GetName(this);
|
||||
}
|
||||
|
||||
std::string Command::GetSubsystem() const {
|
||||
return wpi::SendableRegistry::GetSubsystem(this);
|
||||
return wpi::util::SendableRegistry::GetSubsystem(this);
|
||||
}
|
||||
|
||||
void Command::SetSubsystem(std::string_view subsystem) {
|
||||
wpi::SendableRegistry::SetSubsystem(this, subsystem);
|
||||
wpi::util::SendableRegistry::SetSubsystem(this, subsystem);
|
||||
}
|
||||
|
||||
CommandPtr Command::WithTimeout(units::second_t duration) && {
|
||||
CommandPtr Command::WithTimeout(wpi::units::second_t duration) && {
|
||||
return std::move(*this).ToPtr().WithTimeout(duration);
|
||||
}
|
||||
|
||||
@@ -178,7 +178,7 @@ bool Command::IsComposed() const {
|
||||
|
||||
void Command::SetComposed(bool isComposed) {
|
||||
if (isComposed) {
|
||||
m_previousComposition = wpi::GetStackTrace(1);
|
||||
m_previousComposition = wpi::util::GetStackTrace(1);
|
||||
} else {
|
||||
m_previousComposition.reset();
|
||||
}
|
||||
@@ -188,7 +188,7 @@ std::optional<std::string> Command::GetPreviousCompositionSite() const {
|
||||
return m_previousComposition;
|
||||
}
|
||||
|
||||
void Command::InitSendable(wpi::SendableBuilder& builder) {
|
||||
void Command::InitSendable(wpi::util::SendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("Command");
|
||||
builder.AddStringProperty(".name", [this] { return GetName(); }, nullptr);
|
||||
builder.AddBooleanProperty(
|
||||
@@ -220,7 +220,7 @@ void Command::InitSendable(wpi::SendableBuilder& builder) {
|
||||
"runsWhenDisabled", [this] { return RunsWhenDisabled(); }, nullptr);
|
||||
}
|
||||
|
||||
namespace frc2 {
|
||||
namespace wpi::cmd {
|
||||
bool RequirementsDisjoint(Command* first, Command* second) {
|
||||
bool disjoint = true;
|
||||
auto&& requirements = second->GetRequirements();
|
||||
@@ -229,4 +229,4 @@ bool RequirementsDisjoint(Command* first, Command* second) {
|
||||
}
|
||||
return disjoint;
|
||||
}
|
||||
} // namespace frc2
|
||||
} // namespace wpi::cmd
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "wpi/commands2/WrapperCommand.hpp"
|
||||
#include "wpi/system/Errors.hpp"
|
||||
|
||||
using namespace frc2;
|
||||
using namespace wpi::cmd;
|
||||
|
||||
CommandPtr::CommandPtr(std::unique_ptr<Command>&& command)
|
||||
: m_ptr(std::move(command)) {
|
||||
@@ -32,12 +32,12 @@ CommandPtr::CommandPtr(std::unique_ptr<Command>&& command)
|
||||
CommandPtr::CommandPtr(CommandPtr&& rhs) {
|
||||
m_ptr = std::move(rhs.m_ptr);
|
||||
AssertValid();
|
||||
rhs.m_moveOutSite = wpi::GetStackTrace(1);
|
||||
rhs.m_moveOutSite = wpi::util::GetStackTrace(1);
|
||||
}
|
||||
|
||||
void CommandPtr::AssertValid() const {
|
||||
if (!m_ptr) {
|
||||
throw FRC_MakeError(frc::err::CommandIllegalUse,
|
||||
throw FRC_MakeError(wpi::err::CommandIllegalUse,
|
||||
"Moved-from CommandPtr object used!\nMoved out at:\n{}",
|
||||
m_moveOutSite);
|
||||
}
|
||||
@@ -131,7 +131,7 @@ CommandPtr CommandPtr::BeforeStarting(CommandPtr&& before) && {
|
||||
return std::move(*this);
|
||||
}
|
||||
|
||||
CommandPtr CommandPtr::WithTimeout(units::second_t duration) && {
|
||||
CommandPtr CommandPtr::WithTimeout(wpi::units::second_t duration) && {
|
||||
AssertValid();
|
||||
std::vector<std::unique_ptr<Command>> temp;
|
||||
temp.emplace_back(std::move(m_ptr));
|
||||
|
||||
@@ -24,39 +24,39 @@
|
||||
#include "wpi/util/sendable/SendableBuilder.hpp"
|
||||
#include "wpi/util/sendable/SendableRegistry.hpp"
|
||||
|
||||
using namespace frc2;
|
||||
using namespace wpi::cmd;
|
||||
|
||||
class CommandScheduler::Impl {
|
||||
public:
|
||||
// A set of the currently-running commands.
|
||||
wpi::SmallSet<Command*, 12> scheduledCommands;
|
||||
wpi::util::SmallSet<Command*, 12> 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;
|
||||
wpi::util::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;
|
||||
wpi::util::DenseMap<Subsystem*, std::unique_ptr<Command>> subsystems;
|
||||
|
||||
frc::EventLoop defaultButtonLoop;
|
||||
wpi::EventLoop defaultButtonLoop;
|
||||
// The set of currently-registered buttons that will be polled every
|
||||
// iteration.
|
||||
frc::EventLoop* activeButtonLoop{&defaultButtonLoop};
|
||||
wpi::EventLoop* activeButtonLoop{&defaultButtonLoop};
|
||||
|
||||
bool disabled{false};
|
||||
|
||||
// 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<InterruptAction, 4> interruptActions;
|
||||
wpi::SmallVector<Action, 4> finishActions;
|
||||
wpi::util::SmallVector<Action, 4> initActions;
|
||||
wpi::util::SmallVector<Action, 4> executeActions;
|
||||
wpi::util::SmallVector<InterruptAction, 4> interruptActions;
|
||||
wpi::util::SmallVector<Action, 4> finishActions;
|
||||
|
||||
// Map of Command* -> CommandPtr for CommandPtrs transferred to the scheduler
|
||||
// via Schedule(CommandPtr&&). These are erased (destroyed) at the very end of
|
||||
// the loop cycle when the command lifecycle is complete.
|
||||
wpi::DenseMap<Command*, CommandPtr> ownedCommands;
|
||||
wpi::util::DenseMap<Command*, CommandPtr> ownedCommands;
|
||||
};
|
||||
|
||||
template <typename TMap, typename TKey>
|
||||
@@ -65,15 +65,15 @@ static bool ContainsKey(const TMap& map, TKey keyToCheck) {
|
||||
}
|
||||
|
||||
CommandScheduler::CommandScheduler()
|
||||
: m_impl(new Impl), m_watchdog(frc::TimedRobot::kDefaultPeriod, [] {
|
||||
: m_impl(new Impl), m_watchdog(wpi::TimedRobot::kDefaultPeriod, [] {
|
||||
std::puts("CommandScheduler loop time overrun.");
|
||||
}) {
|
||||
HAL_ReportUsage("CommandScheduler", "");
|
||||
wpi::SendableRegistry::Add(this, "Scheduler");
|
||||
wpi::util::SendableRegistry::Add(this, "Scheduler");
|
||||
}
|
||||
|
||||
CommandScheduler::~CommandScheduler() {
|
||||
wpi::SendableRegistry::Remove(this);
|
||||
wpi::util::SendableRegistry::Remove(this);
|
||||
std::unique_ptr<Impl>().swap(m_impl);
|
||||
}
|
||||
|
||||
@@ -82,19 +82,19 @@ CommandScheduler& CommandScheduler::GetInstance() {
|
||||
return scheduler;
|
||||
}
|
||||
|
||||
void CommandScheduler::SetPeriod(units::second_t period) {
|
||||
void CommandScheduler::SetPeriod(wpi::units::second_t period) {
|
||||
m_watchdog.SetTimeout(period);
|
||||
}
|
||||
|
||||
frc::EventLoop* CommandScheduler::GetActiveButtonLoop() const {
|
||||
wpi::EventLoop* CommandScheduler::GetActiveButtonLoop() const {
|
||||
return m_impl->activeButtonLoop;
|
||||
}
|
||||
|
||||
void CommandScheduler::SetActiveButtonLoop(frc::EventLoop* loop) {
|
||||
void CommandScheduler::SetActiveButtonLoop(wpi::EventLoop* loop) {
|
||||
m_impl->activeButtonLoop = loop;
|
||||
}
|
||||
|
||||
frc::EventLoop* CommandScheduler::GetDefaultButtonLoop() const {
|
||||
wpi::EventLoop* CommandScheduler::GetDefaultButtonLoop() const {
|
||||
return &(m_impl->defaultButtonLoop);
|
||||
}
|
||||
|
||||
@@ -102,13 +102,13 @@ void CommandScheduler::Schedule(Command* command) {
|
||||
RequireUngrouped(command);
|
||||
|
||||
if (m_impl->disabled || m_impl->scheduledCommands.contains(command) ||
|
||||
(frc::RobotState::IsDisabled() && !command->RunsWhenDisabled())) {
|
||||
(wpi::RobotState::IsDisabled() && !command->RunsWhenDisabled())) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto& requirements = command->GetRequirements();
|
||||
|
||||
wpi::SmallVector<Command*, 8> intersection;
|
||||
wpi::util::SmallVector<Command*, 8> intersection;
|
||||
|
||||
bool isDisjoint = true;
|
||||
bool allInterruptible = true;
|
||||
@@ -171,7 +171,7 @@ void CommandScheduler::Run() {
|
||||
// Run the periodic method of all registered subsystems.
|
||||
for (auto&& subsystem : m_impl->subsystems) {
|
||||
subsystem.getFirst()->Periodic();
|
||||
if constexpr (frc::RobotBase::IsSimulation()) {
|
||||
if constexpr (wpi::RobotBase::IsSimulation()) {
|
||||
subsystem.getFirst()->SimulationPeriodic();
|
||||
}
|
||||
m_watchdog.AddEpoch(subsystem.getFirst()->GetName() + ".Periodic()");
|
||||
@@ -179,14 +179,14 @@ void CommandScheduler::Run() {
|
||||
|
||||
// Cache the active instance to avoid concurrency problems if SetActiveLoop()
|
||||
// is called from inside the button bindings.
|
||||
frc::EventLoop* loopCache = m_impl->activeButtonLoop;
|
||||
wpi::EventLoop* loopCache = m_impl->activeButtonLoop;
|
||||
// Poll buttons for new commands to add.
|
||||
loopCache->Poll();
|
||||
m_watchdog.AddEpoch("buttons.Run()");
|
||||
|
||||
bool isDisabled = frc::RobotState::IsDisabled();
|
||||
bool isDisabled = wpi::RobotState::IsDisabled();
|
||||
// create a new set to avoid iterator invalidation.
|
||||
for (Command* command : wpi::SmallSet(m_impl->scheduledCommands)) {
|
||||
for (Command* command : wpi::util::SmallSet(m_impl->scheduledCommands)) {
|
||||
if (!IsScheduled(command)) {
|
||||
continue; // skip as the normal scheduledCommands was modified
|
||||
}
|
||||
@@ -284,7 +284,7 @@ void CommandScheduler::UnregisterAllSubsystems() {
|
||||
void CommandScheduler::SetDefaultCommand(Subsystem* subsystem,
|
||||
CommandPtr&& defaultCommand) {
|
||||
if (!defaultCommand.get()->HasRequirement(subsystem)) {
|
||||
throw FRC_MakeError(frc::err::CommandIllegalUse, "{}",
|
||||
throw FRC_MakeError(wpi::err::CommandIllegalUse, "{}",
|
||||
"Default commands must require their subsystem!");
|
||||
}
|
||||
RequireUngrouped(defaultCommand.get());
|
||||
@@ -347,7 +347,7 @@ void CommandScheduler::Cancel(std::initializer_list<Command*> commands) {
|
||||
}
|
||||
|
||||
void CommandScheduler::CancelAll() {
|
||||
wpi::SmallVector<Command*, 16> commands;
|
||||
wpi::util::SmallVector<Command*, 16> commands;
|
||||
for (auto&& command : m_impl->scheduledCommands) {
|
||||
commands.emplace_back(command);
|
||||
}
|
||||
@@ -430,7 +430,7 @@ void CommandScheduler::OnCommandFinish(Action action) {
|
||||
void CommandScheduler::RequireUngrouped(const Command* command) {
|
||||
auto stacktrace = command->GetPreviousCompositionSite();
|
||||
if (stacktrace.has_value()) {
|
||||
throw FRC_MakeError(frc::err::CommandIllegalUse,
|
||||
throw FRC_MakeError(wpi::err::CommandIllegalUse,
|
||||
"Commands that have been composed may not be added to "
|
||||
"another composition or scheduled individually!"
|
||||
"\nOriginally composed at:\n{}",
|
||||
@@ -454,7 +454,7 @@ void CommandScheduler::RequireUngrouped(
|
||||
|
||||
void CommandScheduler::RequireUngroupedAndUnscheduled(const Command* command) {
|
||||
if (IsScheduled(command)) {
|
||||
throw FRC_MakeError(frc::err::CommandIllegalUse,
|
||||
throw FRC_MakeError(wpi::err::CommandIllegalUse,
|
||||
"Commands that have been scheduled individually may "
|
||||
"not be added to another composition!");
|
||||
}
|
||||
@@ -475,7 +475,7 @@ void CommandScheduler::RequireUngroupedAndUnscheduled(
|
||||
}
|
||||
}
|
||||
|
||||
void CommandScheduler::InitSendable(wpi::SendableBuilder& builder) {
|
||||
void CommandScheduler::InitSendable(wpi::util::SendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("Scheduler");
|
||||
builder.AddStringArrayProperty(
|
||||
"Names",
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "wpi/util/FunctionExtras.hpp"
|
||||
#include "wpi/util/deprecated.hpp"
|
||||
|
||||
using namespace frc2;
|
||||
using namespace wpi::cmd;
|
||||
|
||||
// Factories
|
||||
|
||||
@@ -73,7 +73,7 @@ CommandPtr cmd::Print(std::string_view msg) {
|
||||
return PrintCommand(msg).ToPtr();
|
||||
}
|
||||
|
||||
CommandPtr cmd::DeferredProxy(wpi::unique_function<Command*()> supplier) {
|
||||
CommandPtr cmd::DeferredProxy(wpi::util::unique_function<Command*()> supplier) {
|
||||
return Defer(
|
||||
[supplier = std::move(supplier)]() mutable {
|
||||
// There is no non-owning version of AsProxy(), so use the non-owning
|
||||
@@ -83,13 +83,13 @@ CommandPtr cmd::DeferredProxy(wpi::unique_function<Command*()> supplier) {
|
||||
{});
|
||||
}
|
||||
|
||||
CommandPtr cmd::DeferredProxy(wpi::unique_function<CommandPtr()> supplier) {
|
||||
CommandPtr cmd::DeferredProxy(wpi::util::unique_function<CommandPtr()> supplier) {
|
||||
return Defer([supplier = std::move(
|
||||
supplier)]() mutable { return supplier().AsProxy(); },
|
||||
{});
|
||||
}
|
||||
|
||||
CommandPtr cmd::Wait(units::second_t duration) {
|
||||
CommandPtr cmd::Wait(wpi::units::second_t duration) {
|
||||
return WaitCommand(duration).ToPtr();
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ CommandPtr cmd::Either(CommandPtr&& onTrue, CommandPtr&& onFalse,
|
||||
.ToPtr();
|
||||
}
|
||||
|
||||
CommandPtr cmd::Defer(wpi::unique_function<CommandPtr()> supplier,
|
||||
CommandPtr cmd::Defer(wpi::util::unique_function<CommandPtr()> supplier,
|
||||
Requirements requirements) {
|
||||
return DeferredCommand(std::move(supplier), requirements).ToPtr();
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include "wpi/util/sendable/SendableBuilder.hpp"
|
||||
|
||||
using namespace frc2;
|
||||
using namespace wpi::cmd;
|
||||
|
||||
ConditionalCommand::ConditionalCommand(std::unique_ptr<Command>&& onTrue,
|
||||
std::unique_ptr<Command>&& onFalse,
|
||||
@@ -69,7 +69,7 @@ Command::InterruptionBehavior ConditionalCommand::GetInterruptionBehavior()
|
||||
}
|
||||
}
|
||||
|
||||
void ConditionalCommand::InitSendable(wpi::SendableBuilder& builder) {
|
||||
void ConditionalCommand::InitSendable(wpi::util::SendableBuilder& builder) {
|
||||
Command::InitSendable(builder);
|
||||
builder.AddStringProperty(
|
||||
"onTrue", [this] { return m_onTrue->GetName(); }, nullptr);
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
#include "wpi/commands2/Commands.hpp"
|
||||
#include "wpi/util/sendable/SendableBuilder.hpp"
|
||||
|
||||
using namespace frc2;
|
||||
using namespace wpi::cmd;
|
||||
|
||||
DeferredCommand::DeferredCommand(wpi::unique_function<CommandPtr()> supplier,
|
||||
DeferredCommand::DeferredCommand(wpi::util::unique_function<CommandPtr()> supplier,
|
||||
Requirements requirements)
|
||||
: m_supplier{std::move(supplier)} {
|
||||
AddRequirements(requirements);
|
||||
@@ -40,7 +40,7 @@ bool DeferredCommand::IsFinished() {
|
||||
return m_command->IsFinished();
|
||||
}
|
||||
|
||||
void DeferredCommand::InitSendable(wpi::SendableBuilder& builder) {
|
||||
void DeferredCommand::InitSendable(wpi::util::SendableBuilder& builder) {
|
||||
Command::InitSendable(builder);
|
||||
builder.AddStringProperty(
|
||||
"deferred", [this] { return m_command->GetName(); }, nullptr);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
using namespace frc2;
|
||||
using namespace wpi::cmd;
|
||||
|
||||
FunctionalCommand::FunctionalCommand(std::function<void()> onInit,
|
||||
std::function<void()> onExecute,
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
using namespace frc2;
|
||||
using namespace wpi::cmd;
|
||||
|
||||
InstantCommand::InstantCommand(std::function<void()> toRun,
|
||||
Requirements requirements)
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
using namespace frc2;
|
||||
using namespace wpi::cmd;
|
||||
|
||||
NotifierCommand::NotifierCommand(std::function<void()> toRun,
|
||||
units::second_t period,
|
||||
wpi::units::second_t period,
|
||||
Requirements requirements)
|
||||
: m_toRun(toRun), m_notifier{std::move(toRun)}, m_period{period} {
|
||||
AddRequirements(requirements);
|
||||
@@ -24,7 +24,7 @@ NotifierCommand::NotifierCommand(NotifierCommand&& other)
|
||||
NotifierCommand::NotifierCommand(const NotifierCommand& other)
|
||||
: CommandHelper(other),
|
||||
m_toRun(other.m_toRun),
|
||||
m_notifier(frc::Notifier(other.m_toRun)),
|
||||
m_notifier(wpi::Notifier(other.m_toRun)),
|
||||
m_period(other.m_period) {}
|
||||
|
||||
void NotifierCommand::Initialize() {
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
using namespace frc2;
|
||||
using namespace wpi::cmd;
|
||||
|
||||
ParallelCommandGroup::ParallelCommandGroup(
|
||||
std::vector<std::unique_ptr<Command>>&& commands) {
|
||||
@@ -69,7 +69,7 @@ void ParallelCommandGroup::AddCommands(
|
||||
CommandScheduler::GetInstance().RequireUngroupedAndUnscheduled(commands);
|
||||
|
||||
if (isRunning) {
|
||||
throw FRC_MakeError(frc::err::CommandIllegalUse,
|
||||
throw FRC_MakeError(wpi::err::CommandIllegalUse,
|
||||
"Commands cannot be added to a CommandGroup "
|
||||
"while the group is running");
|
||||
}
|
||||
@@ -85,7 +85,7 @@ void ParallelCommandGroup::AddCommands(
|
||||
}
|
||||
m_commands.emplace_back(std::move(command), false);
|
||||
} else {
|
||||
throw FRC_MakeError(frc::err::CommandIllegalUse,
|
||||
throw FRC_MakeError(wpi::err::CommandIllegalUse,
|
||||
"Multiple commands in a parallel group cannot "
|
||||
"require the same subsystems");
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include "wpi/util/sendable/SendableBuilder.hpp"
|
||||
|
||||
using namespace frc2;
|
||||
using namespace wpi::cmd;
|
||||
|
||||
ParallelDeadlineGroup::ParallelDeadlineGroup(
|
||||
std::unique_ptr<Command>&& deadline,
|
||||
@@ -69,7 +69,7 @@ void ParallelDeadlineGroup::AddCommands(
|
||||
CommandScheduler::GetInstance().RequireUngroupedAndUnscheduled(commands);
|
||||
|
||||
if (!m_finished) {
|
||||
throw FRC_MakeError(frc::err::CommandIllegalUse,
|
||||
throw FRC_MakeError(wpi::err::CommandIllegalUse,
|
||||
"Commands cannot be added to a CommandGroup "
|
||||
"while the group is running");
|
||||
}
|
||||
@@ -85,7 +85,7 @@ void ParallelDeadlineGroup::AddCommands(
|
||||
}
|
||||
m_commands.emplace_back(std::move(command), false);
|
||||
} else {
|
||||
throw FRC_MakeError(frc::err::CommandIllegalUse,
|
||||
throw FRC_MakeError(wpi::err::CommandIllegalUse,
|
||||
"Multiple commands in a parallel group cannot "
|
||||
"require the same subsystems");
|
||||
}
|
||||
@@ -100,7 +100,7 @@ void ParallelDeadlineGroup::SetDeadline(std::unique_ptr<Command>&& deadline) {
|
||||
m_runWhenDisabled &= m_deadline->RunsWhenDisabled();
|
||||
}
|
||||
|
||||
void ParallelDeadlineGroup::InitSendable(wpi::SendableBuilder& builder) {
|
||||
void ParallelDeadlineGroup::InitSendable(wpi::util::SendableBuilder& builder) {
|
||||
Command::InitSendable(builder);
|
||||
|
||||
builder.AddStringProperty(
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
using namespace frc2;
|
||||
using namespace wpi::cmd;
|
||||
|
||||
ParallelRaceGroup::ParallelRaceGroup(
|
||||
std::vector<std::unique_ptr<Command>>&& commands) {
|
||||
@@ -56,7 +56,7 @@ void ParallelRaceGroup::AddCommands(
|
||||
CommandScheduler::GetInstance().RequireUngroupedAndUnscheduled(commands);
|
||||
|
||||
if (isRunning) {
|
||||
throw FRC_MakeError(frc::err::CommandIllegalUse,
|
||||
throw FRC_MakeError(wpi::err::CommandIllegalUse,
|
||||
"Commands cannot be added to a CommandGroup "
|
||||
"while the group is running");
|
||||
}
|
||||
@@ -72,7 +72,7 @@ void ParallelRaceGroup::AddCommands(
|
||||
}
|
||||
m_commands.emplace_back(std::move(command));
|
||||
} else {
|
||||
throw FRC_MakeError(frc::err::CommandIllegalUse,
|
||||
throw FRC_MakeError(wpi::err::CommandIllegalUse,
|
||||
"Multiple commands in a parallel group cannot "
|
||||
"require the same subsystems");
|
||||
}
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
|
||||
#include "wpi/util/print.hpp"
|
||||
|
||||
using namespace frc2;
|
||||
using namespace wpi::cmd;
|
||||
|
||||
PrintCommand::PrintCommand(std::string_view message)
|
||||
: CommandHelper{[str = std::string(message)] { wpi::print("{}\n", str); },
|
||||
: CommandHelper{[str = std::string(message)] { wpi::util::print("{}\n", str); },
|
||||
{}} {}
|
||||
|
||||
bool PrintCommand::RunsWhenDisabled() const {
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
#include "wpi/util/deprecated.hpp"
|
||||
#include "wpi/util/sendable/SendableBuilder.hpp"
|
||||
|
||||
using namespace frc2;
|
||||
using namespace wpi::cmd;
|
||||
|
||||
WPI_IGNORE_DEPRECATED
|
||||
ProxyCommand::ProxyCommand(wpi::unique_function<Command*()> supplier)
|
||||
ProxyCommand::ProxyCommand(wpi::util::unique_function<Command*()> supplier)
|
||||
: m_supplier(std::move(supplier)) {}
|
||||
|
||||
ProxyCommand::ProxyCommand(wpi::unique_function<CommandPtr()> supplier)
|
||||
ProxyCommand::ProxyCommand(wpi::util::unique_function<CommandPtr()> supplier)
|
||||
: ProxyCommand([supplier = std::move(supplier),
|
||||
holder = std::optional<CommandPtr>{}]() mutable {
|
||||
holder = supplier();
|
||||
@@ -38,7 +38,7 @@ ProxyCommand::ProxyCommand(std::unique_ptr<Command> command) {
|
||||
|
||||
void ProxyCommand::Initialize() {
|
||||
m_command = m_supplier();
|
||||
frc2::CommandScheduler::GetInstance().Schedule(m_command);
|
||||
wpi::cmd::CommandScheduler::GetInstance().Schedule(m_command);
|
||||
}
|
||||
|
||||
void ProxyCommand::End(bool interrupted) {
|
||||
@@ -55,7 +55,7 @@ bool ProxyCommand::IsFinished() {
|
||||
return m_command == nullptr || !m_command->IsScheduled();
|
||||
}
|
||||
|
||||
void ProxyCommand::InitSendable(wpi::SendableBuilder& builder) {
|
||||
void ProxyCommand::InitSendable(wpi::util::SendableBuilder& builder) {
|
||||
Command::InitSendable(builder);
|
||||
builder.AddStringProperty(
|
||||
"proxied",
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "wpi/util/sendable/SendableBuilder.hpp"
|
||||
|
||||
using namespace frc2;
|
||||
using namespace wpi::cmd;
|
||||
|
||||
RepeatCommand::RepeatCommand(std::unique_ptr<Command>&& command) {
|
||||
CommandScheduler::GetInstance().RequireUngroupedAndUnscheduled(command.get());
|
||||
@@ -58,7 +58,7 @@ Command::InterruptionBehavior RepeatCommand::GetInterruptionBehavior() const {
|
||||
return m_command->GetInterruptionBehavior();
|
||||
}
|
||||
|
||||
void RepeatCommand::InitSendable(wpi::SendableBuilder& builder) {
|
||||
void RepeatCommand::InitSendable(wpi::util::SendableBuilder& builder) {
|
||||
Command::InitSendable(builder);
|
||||
builder.AddStringProperty(
|
||||
"command", [this] { return m_command->GetName(); }, nullptr);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
using namespace frc2;
|
||||
using namespace wpi::cmd;
|
||||
|
||||
RunCommand::RunCommand(std::function<void()> toRun, Requirements requirements)
|
||||
: CommandHelper([] {}, std::move(toRun), [](bool interrupted) {},
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include "wpi/commands2/ScheduleCommand.hpp"
|
||||
|
||||
using namespace frc2;
|
||||
using namespace wpi::cmd;
|
||||
|
||||
ScheduleCommand::ScheduleCommand(std::span<Command* const> toSchedule) {
|
||||
for (auto cmd : toSchedule) {
|
||||
@@ -18,7 +18,7 @@ ScheduleCommand::ScheduleCommand(Command* toSchedule) {
|
||||
|
||||
void ScheduleCommand::Initialize() {
|
||||
for (auto command : m_toSchedule) {
|
||||
frc2::CommandScheduler::GetInstance().Schedule(command);
|
||||
wpi::cmd::CommandScheduler::GetInstance().Schedule(command);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "wpi/util/sendable/SendableBuilder.hpp"
|
||||
|
||||
using namespace frc2;
|
||||
using namespace wpi::cmd;
|
||||
|
||||
SequentialCommandGroup::SequentialCommandGroup(
|
||||
std::vector<std::unique_ptr<Command>>&& commands) {
|
||||
@@ -68,7 +68,7 @@ void SequentialCommandGroup::AddCommands(
|
||||
CommandScheduler::GetInstance().RequireUngroupedAndUnscheduled(commands);
|
||||
|
||||
if (m_currentCommandIndex != invalid_index) {
|
||||
throw FRC_MakeError(frc::err::CommandIllegalUse,
|
||||
throw FRC_MakeError(wpi::err::CommandIllegalUse,
|
||||
"Commands cannot be added to a CommandGroup "
|
||||
"while the group is running");
|
||||
}
|
||||
@@ -85,7 +85,7 @@ void SequentialCommandGroup::AddCommands(
|
||||
}
|
||||
}
|
||||
|
||||
void SequentialCommandGroup::InitSendable(wpi::SendableBuilder& builder) {
|
||||
void SequentialCommandGroup::InitSendable(wpi::util::SendableBuilder& builder) {
|
||||
Command::InitSendable(builder);
|
||||
builder.AddIntegerProperty(
|
||||
"index", [this] { return m_currentCommandIndex; }, nullptr);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
using namespace frc2;
|
||||
using namespace wpi::cmd;
|
||||
|
||||
StartEndCommand::StartEndCommand(std::function<void()> onInit,
|
||||
std::function<void()> onEnd,
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "wpi/commands2/Commands.hpp"
|
||||
#include "wpi/util/Demangle.hpp"
|
||||
|
||||
using namespace frc2;
|
||||
using namespace wpi::cmd;
|
||||
Subsystem::~Subsystem() {
|
||||
CommandScheduler::GetInstance().UnregisterSubsystem(this);
|
||||
}
|
||||
@@ -21,7 +21,7 @@ void Subsystem::Periodic() {}
|
||||
void Subsystem::SimulationPeriodic() {}
|
||||
|
||||
std::string Subsystem::GetName() const {
|
||||
return wpi::GetTypeName(*this);
|
||||
return wpi::util::GetTypeName(*this);
|
||||
}
|
||||
|
||||
void Subsystem::SetDefaultCommand(CommandPtr&& defaultCommand) {
|
||||
@@ -72,6 +72,6 @@ CommandPtr Subsystem::StartRun(std::function<void()> start,
|
||||
return cmd::StartRun(std::move(start), std::move(run), {this});
|
||||
}
|
||||
|
||||
CommandPtr Subsystem::Defer(wpi::unique_function<CommandPtr()> supplier) {
|
||||
CommandPtr Subsystem::Defer(wpi::util::unique_function<CommandPtr()> supplier) {
|
||||
return cmd::Defer(std::move(supplier), {this});
|
||||
}
|
||||
|
||||
@@ -11,19 +11,19 @@
|
||||
#include "wpi/util/sendable/SendableBuilder.hpp"
|
||||
#include "wpi/util/sendable/SendableRegistry.hpp"
|
||||
|
||||
using namespace frc2;
|
||||
using namespace wpi::cmd;
|
||||
|
||||
SubsystemBase::SubsystemBase() {
|
||||
wpi::SendableRegistry::Add(this, GetTypeName(*this));
|
||||
wpi::util::SendableRegistry::Add(this, GetTypeName(*this));
|
||||
CommandScheduler::GetInstance().RegisterSubsystem({this});
|
||||
}
|
||||
|
||||
SubsystemBase::SubsystemBase(std::string_view name) {
|
||||
wpi::SendableRegistry::Add(this, name);
|
||||
wpi::util::SendableRegistry::Add(this, name);
|
||||
CommandScheduler::GetInstance().RegisterSubsystem({this});
|
||||
}
|
||||
|
||||
void SubsystemBase::InitSendable(wpi::SendableBuilder& builder) {
|
||||
void SubsystemBase::InitSendable(wpi::util::SendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("Subsystem");
|
||||
builder.AddBooleanProperty(
|
||||
".hasDefault", [this] { return GetDefaultCommand() != nullptr; },
|
||||
@@ -54,21 +54,21 @@ void SubsystemBase::InitSendable(wpi::SendableBuilder& builder) {
|
||||
}
|
||||
|
||||
std::string SubsystemBase::GetName() const {
|
||||
return wpi::SendableRegistry::GetName(this);
|
||||
return wpi::util::SendableRegistry::GetName(this);
|
||||
}
|
||||
|
||||
void SubsystemBase::SetName(std::string_view name) {
|
||||
wpi::SendableRegistry::SetName(this, name);
|
||||
wpi::util::SendableRegistry::SetName(this, name);
|
||||
}
|
||||
|
||||
std::string SubsystemBase::GetSubsystem() const {
|
||||
return wpi::SendableRegistry::GetSubsystem(this);
|
||||
return wpi::util::SendableRegistry::GetSubsystem(this);
|
||||
}
|
||||
|
||||
void SubsystemBase::SetSubsystem(std::string_view name) {
|
||||
wpi::SendableRegistry::SetSubsystem(this, name);
|
||||
wpi::util::SendableRegistry::SetSubsystem(this, name);
|
||||
}
|
||||
|
||||
void SubsystemBase::AddChild(std::string name, wpi::Sendable* child) {
|
||||
wpi::SendableRegistry::Add(child, GetSubsystem(), name);
|
||||
void SubsystemBase::AddChild(std::string name, wpi::util::Sendable* child) {
|
||||
wpi::util::SendableRegistry::Add(child, GetSubsystem(), name);
|
||||
}
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
|
||||
#include "wpi/util/sendable/SendableBuilder.hpp"
|
||||
|
||||
using namespace frc2;
|
||||
using namespace wpi::cmd;
|
||||
|
||||
WaitCommand::WaitCommand(units::second_t duration) : m_duration{duration} {
|
||||
WaitCommand::WaitCommand(wpi::units::second_t duration) : m_duration{duration} {
|
||||
SetName(fmt::format("{}: {}", GetName(), duration));
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ bool WaitCommand::RunsWhenDisabled() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
void WaitCommand::InitSendable(wpi::SendableBuilder& builder) {
|
||||
void WaitCommand::InitSendable(wpi::util::SendableBuilder& builder) {
|
||||
Command::InitSendable(builder);
|
||||
builder.AddDoubleProperty(
|
||||
"duration", [this] { return m_duration.value(); }, nullptr);
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
|
||||
#include "wpi/system/Timer.hpp"
|
||||
|
||||
using namespace frc2;
|
||||
using namespace wpi::cmd;
|
||||
|
||||
WaitUntilCommand::WaitUntilCommand(std::function<bool()> condition)
|
||||
: m_condition{std::move(condition)} {}
|
||||
|
||||
WaitUntilCommand::WaitUntilCommand(units::second_t time)
|
||||
: m_condition{[=] { return frc::Timer::GetMatchTime() - time > 0_s; }} {}
|
||||
WaitUntilCommand::WaitUntilCommand(wpi::units::second_t time)
|
||||
: m_condition{[=] { return wpi::Timer::GetMatchTime() - time > 0_s; }} {}
|
||||
|
||||
bool WaitUntilCommand::IsFinished() {
|
||||
return m_condition();
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "wpi/commands2/Command.hpp"
|
||||
|
||||
using namespace frc2;
|
||||
using namespace wpi::cmd;
|
||||
|
||||
WrapperCommand::WrapperCommand(std::unique_ptr<Command>&& command) {
|
||||
CommandScheduler::GetInstance().RequireUngroupedAndUnscheduled(command.get());
|
||||
@@ -42,6 +42,6 @@ Command::InterruptionBehavior WrapperCommand::GetInterruptionBehavior() const {
|
||||
return m_command->GetInterruptionBehavior();
|
||||
}
|
||||
|
||||
wpi::SmallSet<Subsystem*, 4> WrapperCommand::GetRequirements() const {
|
||||
wpi::util::SmallSet<Subsystem*, 4> WrapperCommand::GetRequirements() const {
|
||||
return m_command->GetRequirements();
|
||||
}
|
||||
|
||||
@@ -4,128 +4,128 @@
|
||||
|
||||
#include "wpi/commands2/button/CommandGamepad.hpp"
|
||||
|
||||
using namespace frc2;
|
||||
using namespace wpi::cmd;
|
||||
|
||||
CommandGamepad::CommandGamepad(int port)
|
||||
: CommandGenericHID(port), m_hid{frc::Gamepad(port)} {}
|
||||
: CommandGenericHID(port), m_hid{wpi::Gamepad(port)} {}
|
||||
|
||||
frc::Gamepad& CommandGamepad::GetHID() {
|
||||
wpi::Gamepad& CommandGamepad::GetHID() {
|
||||
return m_hid;
|
||||
}
|
||||
|
||||
Trigger CommandGamepad::SouthFace(frc::EventLoop* loop) const {
|
||||
return Button(frc::Gamepad::Button::kSouthFace, loop);
|
||||
Trigger CommandGamepad::SouthFace(wpi::EventLoop* loop) const {
|
||||
return Button(wpi::Gamepad::Button::kSouthFace, loop);
|
||||
}
|
||||
|
||||
Trigger CommandGamepad::EastFace(frc::EventLoop* loop) const {
|
||||
return Button(frc::Gamepad::Button::kEastFace, loop);
|
||||
Trigger CommandGamepad::EastFace(wpi::EventLoop* loop) const {
|
||||
return Button(wpi::Gamepad::Button::kEastFace, loop);
|
||||
}
|
||||
|
||||
Trigger CommandGamepad::WestFace(frc::EventLoop* loop) const {
|
||||
return Button(frc::Gamepad::Button::kWestFace, loop);
|
||||
Trigger CommandGamepad::WestFace(wpi::EventLoop* loop) const {
|
||||
return Button(wpi::Gamepad::Button::kWestFace, loop);
|
||||
}
|
||||
|
||||
Trigger CommandGamepad::NorthFace(frc::EventLoop* loop) const {
|
||||
return Button(frc::Gamepad::Button::kNorthFace, loop);
|
||||
Trigger CommandGamepad::NorthFace(wpi::EventLoop* loop) const {
|
||||
return Button(wpi::Gamepad::Button::kNorthFace, loop);
|
||||
}
|
||||
|
||||
Trigger CommandGamepad::Back(frc::EventLoop* loop) const {
|
||||
return Button(frc::Gamepad::Button::kBack, loop);
|
||||
Trigger CommandGamepad::Back(wpi::EventLoop* loop) const {
|
||||
return Button(wpi::Gamepad::Button::kBack, loop);
|
||||
}
|
||||
|
||||
Trigger CommandGamepad::Guide(frc::EventLoop* loop) const {
|
||||
return Button(frc::Gamepad::Button::kGuide, loop);
|
||||
Trigger CommandGamepad::Guide(wpi::EventLoop* loop) const {
|
||||
return Button(wpi::Gamepad::Button::kGuide, loop);
|
||||
}
|
||||
|
||||
Trigger CommandGamepad::Start(frc::EventLoop* loop) const {
|
||||
return Button(frc::Gamepad::Button::kStart, loop);
|
||||
Trigger CommandGamepad::Start(wpi::EventLoop* loop) const {
|
||||
return Button(wpi::Gamepad::Button::kStart, loop);
|
||||
}
|
||||
|
||||
Trigger CommandGamepad::LeftStick(frc::EventLoop* loop) const {
|
||||
return Button(frc::Gamepad::Button::kLeftStick, loop);
|
||||
Trigger CommandGamepad::LeftStick(wpi::EventLoop* loop) const {
|
||||
return Button(wpi::Gamepad::Button::kLeftStick, loop);
|
||||
}
|
||||
|
||||
Trigger CommandGamepad::RightStick(frc::EventLoop* loop) const {
|
||||
return Button(frc::Gamepad::Button::kRightStick, loop);
|
||||
Trigger CommandGamepad::RightStick(wpi::EventLoop* loop) const {
|
||||
return Button(wpi::Gamepad::Button::kRightStick, loop);
|
||||
}
|
||||
|
||||
Trigger CommandGamepad::LeftShoulder(frc::EventLoop* loop) const {
|
||||
return Button(frc::Gamepad::Button::kLeftShoulder, loop);
|
||||
Trigger CommandGamepad::LeftShoulder(wpi::EventLoop* loop) const {
|
||||
return Button(wpi::Gamepad::Button::kLeftShoulder, loop);
|
||||
}
|
||||
|
||||
Trigger CommandGamepad::RightShoulder(frc::EventLoop* loop) const {
|
||||
return Button(frc::Gamepad::Button::kRightShoulder, loop);
|
||||
Trigger CommandGamepad::RightShoulder(wpi::EventLoop* loop) const {
|
||||
return Button(wpi::Gamepad::Button::kRightShoulder, loop);
|
||||
}
|
||||
|
||||
Trigger CommandGamepad::DpadUp(frc::EventLoop* loop) const {
|
||||
return Button(frc::Gamepad::Button::kDpadUp, loop);
|
||||
Trigger CommandGamepad::DpadUp(wpi::EventLoop* loop) const {
|
||||
return Button(wpi::Gamepad::Button::kDpadUp, loop);
|
||||
}
|
||||
|
||||
Trigger CommandGamepad::DpadDown(frc::EventLoop* loop) const {
|
||||
return Button(frc::Gamepad::Button::kDpadDown, loop);
|
||||
Trigger CommandGamepad::DpadDown(wpi::EventLoop* loop) const {
|
||||
return Button(wpi::Gamepad::Button::kDpadDown, loop);
|
||||
}
|
||||
|
||||
Trigger CommandGamepad::DpadLeft(frc::EventLoop* loop) const {
|
||||
return Button(frc::Gamepad::Button::kDpadLeft, loop);
|
||||
Trigger CommandGamepad::DpadLeft(wpi::EventLoop* loop) const {
|
||||
return Button(wpi::Gamepad::Button::kDpadLeft, loop);
|
||||
}
|
||||
|
||||
Trigger CommandGamepad::DpadRight(frc::EventLoop* loop) const {
|
||||
return Button(frc::Gamepad::Button::kDpadRight, loop);
|
||||
Trigger CommandGamepad::DpadRight(wpi::EventLoop* loop) const {
|
||||
return Button(wpi::Gamepad::Button::kDpadRight, loop);
|
||||
}
|
||||
|
||||
Trigger CommandGamepad::Misc1(frc::EventLoop* loop) const {
|
||||
return Button(frc::Gamepad::Button::kMisc1, loop);
|
||||
Trigger CommandGamepad::Misc1(wpi::EventLoop* loop) const {
|
||||
return Button(wpi::Gamepad::Button::kMisc1, loop);
|
||||
}
|
||||
|
||||
Trigger CommandGamepad::RightPaddle1(frc::EventLoop* loop) const {
|
||||
return Button(frc::Gamepad::Button::kRightPaddle1, loop);
|
||||
Trigger CommandGamepad::RightPaddle1(wpi::EventLoop* loop) const {
|
||||
return Button(wpi::Gamepad::Button::kRightPaddle1, loop);
|
||||
}
|
||||
|
||||
Trigger CommandGamepad::LeftPaddle1(frc::EventLoop* loop) const {
|
||||
return Button(frc::Gamepad::Button::kLeftPaddle1, loop);
|
||||
Trigger CommandGamepad::LeftPaddle1(wpi::EventLoop* loop) const {
|
||||
return Button(wpi::Gamepad::Button::kLeftPaddle1, loop);
|
||||
}
|
||||
|
||||
Trigger CommandGamepad::RightPaddle2(frc::EventLoop* loop) const {
|
||||
return Button(frc::Gamepad::Button::kRightPaddle2, loop);
|
||||
Trigger CommandGamepad::RightPaddle2(wpi::EventLoop* loop) const {
|
||||
return Button(wpi::Gamepad::Button::kRightPaddle2, loop);
|
||||
}
|
||||
|
||||
Trigger CommandGamepad::LeftPaddle2(frc::EventLoop* loop) const {
|
||||
return Button(frc::Gamepad::Button::kLeftPaddle2, loop);
|
||||
Trigger CommandGamepad::LeftPaddle2(wpi::EventLoop* loop) const {
|
||||
return Button(wpi::Gamepad::Button::kLeftPaddle2, loop);
|
||||
}
|
||||
|
||||
Trigger CommandGamepad::Touchpad(frc::EventLoop* loop) const {
|
||||
return Button(frc::Gamepad::Button::kTouchpad, loop);
|
||||
Trigger CommandGamepad::Touchpad(wpi::EventLoop* loop) const {
|
||||
return Button(wpi::Gamepad::Button::kTouchpad, loop);
|
||||
}
|
||||
|
||||
Trigger CommandGamepad::Misc2(frc::EventLoop* loop) const {
|
||||
return Button(frc::Gamepad::Button::kMisc2, loop);
|
||||
Trigger CommandGamepad::Misc2(wpi::EventLoop* loop) const {
|
||||
return Button(wpi::Gamepad::Button::kMisc2, loop);
|
||||
}
|
||||
|
||||
Trigger CommandGamepad::Misc3(frc::EventLoop* loop) const {
|
||||
return Button(frc::Gamepad::Button::kMisc3, loop);
|
||||
Trigger CommandGamepad::Misc3(wpi::EventLoop* loop) const {
|
||||
return Button(wpi::Gamepad::Button::kMisc3, loop);
|
||||
}
|
||||
|
||||
Trigger CommandGamepad::Misc4(frc::EventLoop* loop) const {
|
||||
return Button(frc::Gamepad::Button::kMisc4, loop);
|
||||
Trigger CommandGamepad::Misc4(wpi::EventLoop* loop) const {
|
||||
return Button(wpi::Gamepad::Button::kMisc4, loop);
|
||||
}
|
||||
|
||||
Trigger CommandGamepad::Misc5(frc::EventLoop* loop) const {
|
||||
return Button(frc::Gamepad::Button::kMisc5, loop);
|
||||
Trigger CommandGamepad::Misc5(wpi::EventLoop* loop) const {
|
||||
return Button(wpi::Gamepad::Button::kMisc5, loop);
|
||||
}
|
||||
|
||||
Trigger CommandGamepad::Misc6(frc::EventLoop* loop) const {
|
||||
return Button(frc::Gamepad::Button::kMisc6, loop);
|
||||
Trigger CommandGamepad::Misc6(wpi::EventLoop* loop) const {
|
||||
return Button(wpi::Gamepad::Button::kMisc6, loop);
|
||||
}
|
||||
|
||||
Trigger CommandGamepad::LeftTrigger(double threshold,
|
||||
frc::EventLoop* loop) const {
|
||||
wpi::EventLoop* loop) const {
|
||||
return Trigger(loop, [this, threshold] {
|
||||
return m_hid.GetLeftTriggerAxis() > threshold;
|
||||
});
|
||||
}
|
||||
|
||||
Trigger CommandGamepad::RightTrigger(double threshold,
|
||||
frc::EventLoop* loop) const {
|
||||
wpi::EventLoop* loop) const {
|
||||
return Trigger(loop, [this, threshold] {
|
||||
return m_hid.GetRightTriggerAxis() > threshold;
|
||||
});
|
||||
|
||||
@@ -4,87 +4,87 @@
|
||||
|
||||
#include "wpi/commands2/button/CommandGenericHID.hpp"
|
||||
|
||||
using namespace frc2;
|
||||
using namespace wpi::cmd;
|
||||
|
||||
CommandGenericHID::CommandGenericHID(int port) : m_hid{port} {}
|
||||
|
||||
frc::GenericHID& CommandGenericHID::GetHID() {
|
||||
wpi::GenericHID& CommandGenericHID::GetHID() {
|
||||
return m_hid;
|
||||
}
|
||||
|
||||
Trigger CommandGenericHID::Button(int button, frc::EventLoop* loop) const {
|
||||
Trigger CommandGenericHID::Button(int button, wpi::EventLoop* loop) const {
|
||||
return Trigger(loop, [this, button] { return m_hid.GetRawButton(button); });
|
||||
}
|
||||
|
||||
Trigger CommandGenericHID::POV(frc::DriverStation::POVDirection angle,
|
||||
frc::EventLoop* loop) const {
|
||||
Trigger CommandGenericHID::POV(wpi::DriverStation::POVDirection angle,
|
||||
wpi::EventLoop* loop) const {
|
||||
return POV(0, angle, loop);
|
||||
}
|
||||
|
||||
Trigger CommandGenericHID::POV(int pov, frc::DriverStation::POVDirection angle,
|
||||
frc::EventLoop* loop) const {
|
||||
Trigger CommandGenericHID::POV(int pov, wpi::DriverStation::POVDirection angle,
|
||||
wpi::EventLoop* loop) const {
|
||||
return Trigger(loop,
|
||||
[this, pov, angle] { return m_hid.GetPOV(pov) == angle; });
|
||||
}
|
||||
|
||||
Trigger CommandGenericHID::POVUp(frc::EventLoop* loop) const {
|
||||
return POV(frc::DriverStation::POVDirection::kUp, loop);
|
||||
Trigger CommandGenericHID::POVUp(wpi::EventLoop* loop) const {
|
||||
return POV(wpi::DriverStation::POVDirection::kUp, loop);
|
||||
}
|
||||
|
||||
Trigger CommandGenericHID::POVUpRight(frc::EventLoop* loop) const {
|
||||
return POV(frc::DriverStation::POVDirection::kUpRight, loop);
|
||||
Trigger CommandGenericHID::POVUpRight(wpi::EventLoop* loop) const {
|
||||
return POV(wpi::DriverStation::POVDirection::kUpRight, loop);
|
||||
}
|
||||
|
||||
Trigger CommandGenericHID::POVRight(frc::EventLoop* loop) const {
|
||||
return POV(frc::DriverStation::POVDirection::kRight, loop);
|
||||
Trigger CommandGenericHID::POVRight(wpi::EventLoop* loop) const {
|
||||
return POV(wpi::DriverStation::POVDirection::kRight, loop);
|
||||
}
|
||||
|
||||
Trigger CommandGenericHID::POVDownRight(frc::EventLoop* loop) const {
|
||||
return POV(frc::DriverStation::POVDirection::kDownRight, loop);
|
||||
Trigger CommandGenericHID::POVDownRight(wpi::EventLoop* loop) const {
|
||||
return POV(wpi::DriverStation::POVDirection::kDownRight, loop);
|
||||
}
|
||||
|
||||
Trigger CommandGenericHID::POVDown(frc::EventLoop* loop) const {
|
||||
return POV(frc::DriverStation::POVDirection::kDown, loop);
|
||||
Trigger CommandGenericHID::POVDown(wpi::EventLoop* loop) const {
|
||||
return POV(wpi::DriverStation::POVDirection::kDown, loop);
|
||||
}
|
||||
|
||||
Trigger CommandGenericHID::POVDownLeft(frc::EventLoop* loop) const {
|
||||
return POV(frc::DriverStation::POVDirection::kDownLeft, loop);
|
||||
Trigger CommandGenericHID::POVDownLeft(wpi::EventLoop* loop) const {
|
||||
return POV(wpi::DriverStation::POVDirection::kDownLeft, loop);
|
||||
}
|
||||
|
||||
Trigger CommandGenericHID::POVLeft(frc::EventLoop* loop) const {
|
||||
return POV(frc::DriverStation::POVDirection::kLeft, loop);
|
||||
Trigger CommandGenericHID::POVLeft(wpi::EventLoop* loop) const {
|
||||
return POV(wpi::DriverStation::POVDirection::kLeft, loop);
|
||||
}
|
||||
|
||||
Trigger CommandGenericHID::POVUpLeft(frc::EventLoop* loop) const {
|
||||
return POV(frc::DriverStation::POVDirection::kUpLeft, loop);
|
||||
Trigger CommandGenericHID::POVUpLeft(wpi::EventLoop* loop) const {
|
||||
return POV(wpi::DriverStation::POVDirection::kUpLeft, loop);
|
||||
}
|
||||
|
||||
Trigger CommandGenericHID::POVCenter(frc::EventLoop* loop) const {
|
||||
return POV(frc::DriverStation::POVDirection::kCenter, loop);
|
||||
Trigger CommandGenericHID::POVCenter(wpi::EventLoop* loop) const {
|
||||
return POV(wpi::DriverStation::POVDirection::kCenter, loop);
|
||||
}
|
||||
|
||||
Trigger CommandGenericHID::AxisLessThan(int axis, double threshold,
|
||||
frc::EventLoop* loop) const {
|
||||
wpi::EventLoop* loop) const {
|
||||
return Trigger(loop, [this, axis, threshold]() {
|
||||
return m_hid.GetRawAxis(axis) < threshold;
|
||||
});
|
||||
}
|
||||
|
||||
Trigger CommandGenericHID::AxisGreaterThan(int axis, double threshold,
|
||||
frc::EventLoop* loop) const {
|
||||
wpi::EventLoop* loop) const {
|
||||
return Trigger(loop, [this, axis, threshold]() {
|
||||
return m_hid.GetRawAxis(axis) > threshold;
|
||||
});
|
||||
}
|
||||
|
||||
Trigger CommandGenericHID::AxisMagnitudeGreaterThan(
|
||||
int axis, double threshold, frc::EventLoop* loop) const {
|
||||
int axis, double threshold, wpi::EventLoop* loop) const {
|
||||
return Trigger(loop, [this, axis, threshold]() {
|
||||
return std::abs(m_hid.GetRawAxis(axis)) > threshold;
|
||||
});
|
||||
}
|
||||
|
||||
void CommandGenericHID::SetRumble(frc::GenericHID::RumbleType type,
|
||||
void CommandGenericHID::SetRumble(wpi::GenericHID::RumbleType type,
|
||||
double value) {
|
||||
m_hid.SetRumble(type, value);
|
||||
}
|
||||
|
||||
@@ -4,28 +4,28 @@
|
||||
|
||||
#include "wpi/commands2/button/CommandJoystick.hpp"
|
||||
|
||||
using namespace frc2;
|
||||
using namespace wpi::cmd;
|
||||
|
||||
CommandJoystick::CommandJoystick(int port)
|
||||
: CommandGenericHID(port), m_hid{frc::Joystick(port)} {}
|
||||
: CommandGenericHID(port), m_hid{wpi::Joystick(port)} {}
|
||||
|
||||
frc::Joystick& CommandJoystick::GetHID() {
|
||||
wpi::Joystick& CommandJoystick::GetHID() {
|
||||
return m_hid;
|
||||
}
|
||||
|
||||
Trigger CommandJoystick::Trigger(frc::EventLoop* loop) const {
|
||||
return Button(frc::Joystick::ButtonType::kTriggerButton, loop);
|
||||
Trigger CommandJoystick::Trigger(wpi::EventLoop* loop) const {
|
||||
return Button(wpi::Joystick::ButtonType::kTriggerButton, loop);
|
||||
}
|
||||
|
||||
Trigger CommandJoystick::Top(frc::EventLoop* loop) const {
|
||||
return Button(frc::Joystick::ButtonType::kTopButton, loop);
|
||||
Trigger CommandJoystick::Top(wpi::EventLoop* loop) const {
|
||||
return Button(wpi::Joystick::ButtonType::kTopButton, loop);
|
||||
}
|
||||
|
||||
double CommandJoystick::GetMagnitude() const {
|
||||
return m_hid.GetMagnitude();
|
||||
}
|
||||
|
||||
units::radian_t CommandJoystick::GetDirection() const {
|
||||
wpi::units::radian_t CommandJoystick::GetDirection() const {
|
||||
// https://docs.wpilib.org/en/stable/docs/software/basic-programming/coordinate-system.html#joystick-and-controller-coordinate-system
|
||||
// A positive rotation around the X axis moves the joystick right, and a
|
||||
// positive rotation around the Y axis moves the joystick backward. When
|
||||
|
||||
@@ -7,23 +7,23 @@
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
using namespace frc2;
|
||||
using namespace wpi::cmd;
|
||||
|
||||
NetworkButton::NetworkButton(nt::BooleanTopic topic)
|
||||
NetworkButton::NetworkButton(wpi::nt::BooleanTopic topic)
|
||||
: NetworkButton(topic.Subscribe(false)) {}
|
||||
|
||||
NetworkButton::NetworkButton(nt::BooleanSubscriber sub)
|
||||
: Trigger([sub = std::make_shared<nt::BooleanSubscriber>(std::move(sub))] {
|
||||
NetworkButton::NetworkButton(wpi::nt::BooleanSubscriber sub)
|
||||
: Trigger([sub = std::make_shared<wpi::nt::BooleanSubscriber>(std::move(sub))] {
|
||||
return sub->GetTopic().GetInstance().IsConnected() && sub->Get();
|
||||
}) {}
|
||||
|
||||
NetworkButton::NetworkButton(std::shared_ptr<nt::NetworkTable> table,
|
||||
NetworkButton::NetworkButton(std::shared_ptr<wpi::nt::NetworkTable> table,
|
||||
std::string_view field)
|
||||
: NetworkButton(table->GetBooleanTopic(field)) {}
|
||||
|
||||
NetworkButton::NetworkButton(std::string_view table, std::string_view field)
|
||||
: NetworkButton(nt::NetworkTableInstance::GetDefault(), table, field) {}
|
||||
: NetworkButton(wpi::nt::NetworkTableInstance::GetDefault(), table, field) {}
|
||||
|
||||
NetworkButton::NetworkButton(nt::NetworkTableInstance inst,
|
||||
NetworkButton::NetworkButton(wpi::nt::NetworkTableInstance inst,
|
||||
std::string_view table, std::string_view field)
|
||||
: NetworkButton(inst.GetTable(table), field) {}
|
||||
|
||||
@@ -6,20 +6,20 @@
|
||||
|
||||
#include "wpi/driverstation/DriverStation.hpp"
|
||||
|
||||
using namespace frc2;
|
||||
using namespace wpi::cmd;
|
||||
|
||||
Trigger RobotModeTriggers::Autonomous() {
|
||||
return Trigger{&frc::DriverStation::IsAutonomousEnabled};
|
||||
return Trigger{&wpi::DriverStation::IsAutonomousEnabled};
|
||||
}
|
||||
|
||||
Trigger RobotModeTriggers::Teleop() {
|
||||
return Trigger{&frc::DriverStation::IsTeleopEnabled};
|
||||
return Trigger{&wpi::DriverStation::IsTeleopEnabled};
|
||||
}
|
||||
|
||||
Trigger RobotModeTriggers::Disabled() {
|
||||
return Trigger{&frc::DriverStation::IsDisabled};
|
||||
return Trigger{&wpi::DriverStation::IsDisabled};
|
||||
}
|
||||
|
||||
Trigger RobotModeTriggers::Test() {
|
||||
return Trigger{&frc::DriverStation::IsTestEnabled};
|
||||
return Trigger{&wpi::DriverStation::IsTestEnabled};
|
||||
}
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
#include "wpi/math/filter/Debouncer.hpp"
|
||||
|
||||
using namespace frc;
|
||||
using namespace frc2;
|
||||
using namespace wpi::cmd;
|
||||
|
||||
Trigger::Trigger(const Trigger& other) = default;
|
||||
|
||||
void Trigger::AddBinding(wpi::unique_function<void(bool, bool)>&& body) {
|
||||
void Trigger::AddBinding(wpi::util::unique_function<void(bool, bool)>&& body) {
|
||||
m_loop->Bind([condition = m_condition, previous = m_condition(),
|
||||
body = std::move(body)]() mutable {
|
||||
bool current = condition();
|
||||
@@ -28,7 +28,7 @@ void Trigger::AddBinding(wpi::unique_function<void(bool, bool)>&& body) {
|
||||
Trigger Trigger::OnChange(Command* command) {
|
||||
AddBinding([command](bool previous, bool current) {
|
||||
if (previous != current) {
|
||||
frc2::CommandScheduler::GetInstance().Schedule(command);
|
||||
wpi::cmd::CommandScheduler::GetInstance().Schedule(command);
|
||||
}
|
||||
});
|
||||
return *this;
|
||||
@@ -37,7 +37,7 @@ Trigger Trigger::OnChange(Command* command) {
|
||||
Trigger Trigger::OnChange(CommandPtr&& command) {
|
||||
AddBinding([command = std::move(command)](bool previous, bool current) {
|
||||
if (previous != current) {
|
||||
frc2::CommandScheduler::GetInstance().Schedule(command);
|
||||
wpi::cmd::CommandScheduler::GetInstance().Schedule(command);
|
||||
}
|
||||
});
|
||||
return *this;
|
||||
@@ -46,7 +46,7 @@ Trigger Trigger::OnChange(CommandPtr&& command) {
|
||||
Trigger Trigger::OnTrue(Command* command) {
|
||||
AddBinding([command](bool previous, bool current) {
|
||||
if (!previous && current) {
|
||||
frc2::CommandScheduler::GetInstance().Schedule(command);
|
||||
wpi::cmd::CommandScheduler::GetInstance().Schedule(command);
|
||||
}
|
||||
});
|
||||
return *this;
|
||||
@@ -55,7 +55,7 @@ Trigger Trigger::OnTrue(Command* command) {
|
||||
Trigger Trigger::OnTrue(CommandPtr&& command) {
|
||||
AddBinding([command = std::move(command)](bool previous, bool current) {
|
||||
if (!previous && current) {
|
||||
frc2::CommandScheduler::GetInstance().Schedule(command);
|
||||
wpi::cmd::CommandScheduler::GetInstance().Schedule(command);
|
||||
}
|
||||
});
|
||||
return *this;
|
||||
@@ -64,7 +64,7 @@ Trigger Trigger::OnTrue(CommandPtr&& command) {
|
||||
Trigger Trigger::OnFalse(Command* command) {
|
||||
AddBinding([command](bool previous, bool current) {
|
||||
if (previous && !current) {
|
||||
frc2::CommandScheduler::GetInstance().Schedule(command);
|
||||
wpi::cmd::CommandScheduler::GetInstance().Schedule(command);
|
||||
}
|
||||
});
|
||||
return *this;
|
||||
@@ -73,7 +73,7 @@ Trigger Trigger::OnFalse(Command* command) {
|
||||
Trigger Trigger::OnFalse(CommandPtr&& command) {
|
||||
AddBinding([command = std::move(command)](bool previous, bool current) {
|
||||
if (previous && !current) {
|
||||
frc2::CommandScheduler::GetInstance().Schedule(command);
|
||||
wpi::cmd::CommandScheduler::GetInstance().Schedule(command);
|
||||
}
|
||||
});
|
||||
return *this;
|
||||
@@ -82,7 +82,7 @@ Trigger Trigger::OnFalse(CommandPtr&& command) {
|
||||
Trigger Trigger::WhileTrue(Command* command) {
|
||||
AddBinding([command](bool previous, bool current) {
|
||||
if (!previous && current) {
|
||||
frc2::CommandScheduler::GetInstance().Schedule(command);
|
||||
wpi::cmd::CommandScheduler::GetInstance().Schedule(command);
|
||||
} else if (previous && !current) {
|
||||
command->Cancel();
|
||||
}
|
||||
@@ -93,7 +93,7 @@ Trigger Trigger::WhileTrue(Command* command) {
|
||||
Trigger Trigger::WhileTrue(CommandPtr&& command) {
|
||||
AddBinding([command = std::move(command)](bool previous, bool current) {
|
||||
if (!previous && current) {
|
||||
frc2::CommandScheduler::GetInstance().Schedule(command);
|
||||
wpi::cmd::CommandScheduler::GetInstance().Schedule(command);
|
||||
} else if (previous && !current) {
|
||||
command.Cancel();
|
||||
}
|
||||
@@ -104,7 +104,7 @@ Trigger Trigger::WhileTrue(CommandPtr&& command) {
|
||||
Trigger Trigger::WhileFalse(Command* command) {
|
||||
AddBinding([command](bool previous, bool current) {
|
||||
if (previous && !current) {
|
||||
frc2::CommandScheduler::GetInstance().Schedule(command);
|
||||
wpi::cmd::CommandScheduler::GetInstance().Schedule(command);
|
||||
} else if (!previous && current) {
|
||||
command->Cancel();
|
||||
}
|
||||
@@ -115,7 +115,7 @@ Trigger Trigger::WhileFalse(Command* command) {
|
||||
Trigger Trigger::WhileFalse(CommandPtr&& command) {
|
||||
AddBinding([command = std::move(command)](bool previous, bool current) {
|
||||
if (!previous && current) {
|
||||
frc2::CommandScheduler::GetInstance().Schedule(command);
|
||||
wpi::cmd::CommandScheduler::GetInstance().Schedule(command);
|
||||
} else if (previous && !current) {
|
||||
command.Cancel();
|
||||
}
|
||||
@@ -129,7 +129,7 @@ Trigger Trigger::ToggleOnTrue(Command* command) {
|
||||
if (command->IsScheduled()) {
|
||||
command->Cancel();
|
||||
} else {
|
||||
frc2::CommandScheduler::GetInstance().Schedule(command);
|
||||
wpi::cmd::CommandScheduler::GetInstance().Schedule(command);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -142,7 +142,7 @@ Trigger Trigger::ToggleOnTrue(CommandPtr&& command) {
|
||||
if (command.IsScheduled()) {
|
||||
command.Cancel();
|
||||
} else {
|
||||
frc2::CommandScheduler::GetInstance().Schedule(command);
|
||||
wpi::cmd::CommandScheduler::GetInstance().Schedule(command);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -155,7 +155,7 @@ Trigger Trigger::ToggleOnFalse(Command* command) {
|
||||
if (command->IsScheduled()) {
|
||||
command->Cancel();
|
||||
} else {
|
||||
frc2::CommandScheduler::GetInstance().Schedule(command);
|
||||
wpi::cmd::CommandScheduler::GetInstance().Schedule(command);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -168,16 +168,16 @@ Trigger Trigger::ToggleOnFalse(CommandPtr&& command) {
|
||||
if (command.IsScheduled()) {
|
||||
command.Cancel();
|
||||
} else {
|
||||
frc2::CommandScheduler::GetInstance().Schedule(command);
|
||||
wpi::cmd::CommandScheduler::GetInstance().Schedule(command);
|
||||
}
|
||||
}
|
||||
});
|
||||
return *this;
|
||||
}
|
||||
|
||||
Trigger Trigger::Debounce(units::second_t debounceTime,
|
||||
frc::Debouncer::DebounceType type) {
|
||||
return Trigger(m_loop, [debouncer = frc::Debouncer(debounceTime, type),
|
||||
Trigger Trigger::Debounce(wpi::units::second_t debounceTime,
|
||||
wpi::math::Debouncer::DebounceType type) {
|
||||
return Trigger(m_loop, [debouncer = wpi::math::Debouncer(debounceTime, type),
|
||||
condition = m_condition]() mutable {
|
||||
return debouncer.Calculate(condition());
|
||||
});
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
|
||||
#include "wpi/sysid/SysIdRoutineLog.hpp"
|
||||
|
||||
using namespace frc2::sysid;
|
||||
using namespace wpi::cmd::sysid;
|
||||
|
||||
frc2::CommandPtr SysIdRoutine::Quasistatic(Direction direction) {
|
||||
frc::sysid::State state;
|
||||
wpi::cmd::CommandPtr SysIdRoutine::Quasistatic(Direction direction) {
|
||||
wpi::sysid::State state;
|
||||
if (direction == Direction::kForward) {
|
||||
state = frc::sysid::State::kQuasistaticForward;
|
||||
state = wpi::sysid::State::kQuasistaticForward;
|
||||
} else { // if (direction == Direction::kReverse) {
|
||||
state = frc::sysid::State::kQuasistaticReverse;
|
||||
state = wpi::sysid::State::kQuasistaticReverse;
|
||||
}
|
||||
|
||||
double outputSign = direction == Direction::kForward ? 1.0 : -1.0;
|
||||
@@ -29,21 +29,21 @@ frc2::CommandPtr SysIdRoutine::Quasistatic(Direction direction) {
|
||||
})
|
||||
.FinallyDo([this] {
|
||||
m_mechanism.m_drive(0_V);
|
||||
m_recordState(frc::sysid::State::kNone);
|
||||
m_recordState(wpi::sysid::State::kNone);
|
||||
timer.Stop();
|
||||
})
|
||||
.WithName("sysid-" +
|
||||
frc::sysid::SysIdRoutineLog::StateEnumToString(state) +
|
||||
wpi::sysid::SysIdRoutineLog::StateEnumToString(state) +
|
||||
"-" + m_mechanism.m_name)
|
||||
.WithTimeout(m_config.m_timeout));
|
||||
}
|
||||
|
||||
frc2::CommandPtr SysIdRoutine::Dynamic(Direction direction) {
|
||||
frc::sysid::State state;
|
||||
wpi::cmd::CommandPtr SysIdRoutine::Dynamic(Direction direction) {
|
||||
wpi::sysid::State state;
|
||||
if (direction == Direction::kForward) {
|
||||
state = frc::sysid::State::kDynamicForward;
|
||||
state = wpi::sysid::State::kDynamicForward;
|
||||
} else { // if (direction == Direction::kReverse) {
|
||||
state = frc::sysid::State::kDynamicReverse;
|
||||
state = wpi::sysid::State::kDynamicReverse;
|
||||
}
|
||||
|
||||
double outputSign = direction == Direction::kForward ? 1.0 : -1.0;
|
||||
@@ -57,10 +57,10 @@ frc2::CommandPtr SysIdRoutine::Dynamic(Direction direction) {
|
||||
}))
|
||||
.FinallyDo([this] {
|
||||
m_mechanism.m_drive(0_V);
|
||||
m_recordState(frc::sysid::State::kNone);
|
||||
m_recordState(wpi::sysid::State::kNone);
|
||||
})
|
||||
.WithName("sysid-" +
|
||||
frc::sysid::SysIdRoutineLog::StateEnumToString(state) + "-" +
|
||||
wpi::sysid::SysIdRoutineLog::StateEnumToString(state) + "-" +
|
||||
m_mechanism.m_name)
|
||||
.WithTimeout(m_config.m_timeout);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user