[commands] Remove deprecated classes and functions (#5409)

Removes:
- PerpetualCommand
- Command.perpetually()
- CommandGroupBase
- Command.IsGrouped() (C++ only)
- Command.SetGrouped() (C++ only)
- Command.withInterrupt()
- ProxyScheduleCommand
- Button
- InternalButton, JoystickButton, NetworkButton and POVButton now subclass Trigger
- Old style Trigger functions:
    - Trigger.whenActive
    - Trigger.whileActiveOnce
    - Trigger.whileActiveContinuous
    - Trigger.whenInactive
    - Trigger.toggleWhenActive
    - Trigger.cancelWhenActive
- CommandScheduler.clearButtons()
- CommandScheduler.addButtons() (Java only)
- Command supplier constructor of SelectCommand
This commit is contained in:
Ryan Blue
2023-07-10 12:56:18 -04:00
committed by GitHub
parent b250a03944
commit 7a099cb02a
49 changed files with 82 additions and 2031 deletions

View File

@@ -9,7 +9,6 @@
#include "frc2/command/FunctionalCommand.h"
#include "frc2/command/InstantCommand.h"
#include "frc2/command/ParallelRaceGroup.h"
#include "frc2/command/PerpetualCommand.h"
#include "frc2/command/RunCommand.h"
#include "frc2/command/SequentialCommandGroup.h"
@@ -122,21 +121,6 @@ TEST_F(CommandDecoratorTest, AndThen) {
EXPECT_TRUE(finished);
}
TEST_F(CommandDecoratorTest, Perpetually) {
CommandScheduler scheduler = GetScheduler();
WPI_IGNORE_DEPRECATED
auto command = InstantCommand([] {}, {}).Perpetually();
WPI_UNIGNORE_DEPRECATED
scheduler.Schedule(&command);
scheduler.Run();
scheduler.Run();
EXPECT_TRUE(scheduler.IsScheduled(&command));
}
TEST_F(CommandDecoratorTest, Unless) {
CommandScheduler scheduler = GetScheduler();

View File

@@ -12,7 +12,6 @@
#include "frc2/command/ParallelCommandGroup.h"
#include "frc2/command/ParallelDeadlineGroup.h"
#include "frc2/command/ParallelRaceGroup.h"
#include "frc2/command/SelectCommand.h"
#include "frc2/command/SequentialCommandGroup.h"
using namespace frc2;

View File

@@ -6,7 +6,6 @@
#include "frc2/command/Commands.h"
#include "frc2/command/ConditionalCommand.h"
#include "frc2/command/InstantCommand.h"
#include "frc2/command/SelectCommand.h"
using namespace frc2;
class ConditionalCommandTest : public CommandTestBase {};

View File

@@ -1,25 +0,0 @@
// 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 "CommandTestBase.h"
#include "frc2/command/InstantCommand.h"
#include "frc2/command/PerpetualCommand.h"
using namespace frc2;
class PerpetualCommandTest : public CommandTestBase {};
TEST_F(PerpetualCommandTest, PerpetualCommandSchedule) {
CommandScheduler scheduler = GetScheduler();
bool check = false;
WPI_IGNORE_DEPRECATED
PerpetualCommand command{InstantCommand([&check] { check = true; }, {})};
WPI_UNIGNORE_DEPRECATED
scheduler.Schedule(&command);
scheduler.Run();
EXPECT_TRUE(scheduler.IsScheduled(&command));
EXPECT_TRUE(check);
}

View File

@@ -3,7 +3,6 @@
// the WPILib BSD license file in the root directory of this project.
#include <frc/simulation/SimHooks.h>
#include <wpi/deprecated.h>
#include "../CommandTestBase.h"
#include "frc2/command/CommandPtr.h"
@@ -207,24 +206,6 @@ TEST_F(TriggerTest, Negate) {
EXPECT_TRUE(scheduler.IsScheduled(&command));
}
// this type of binding is deprecated and identical to OnTrue
WPI_IGNORE_DEPRECATED
TEST_F(TriggerTest, RValueTrigger) {
auto& scheduler = CommandScheduler::GetInstance();
int counter = 0;
bool pressed = false;
RunCommand command([&counter] { counter++; }, {});
Trigger([&pressed] { return pressed; }).WhenActive(std::move(command));
scheduler.Run();
EXPECT_EQ(counter, 0);
pressed = true;
scheduler.Run();
EXPECT_EQ(counter, 1);
}
WPI_UNIGNORE_DEPRECATED
TEST_F(TriggerTest, Debounce) {
auto& scheduler = CommandScheduler::GetInstance();
bool pressed = false;