mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[command] Remove old command-based framework (#4211)
This commit is contained in:
@@ -1,28 +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 "ReplaceMeCommand.h"
|
||||
|
||||
ReplaceMeCommand::ReplaceMeCommand() {
|
||||
// Use Requires() here to declare subsystem dependencies
|
||||
// eg. Requires(Robot::chassis.get());
|
||||
}
|
||||
|
||||
// Called just before this Command runs the first time
|
||||
void ReplaceMeCommand::Initialize() {}
|
||||
|
||||
// Called repeatedly when this Command is scheduled to run
|
||||
void ReplaceMeCommand::Execute() {}
|
||||
|
||||
// Make this return true when this Command no longer needs to run execute()
|
||||
bool ReplaceMeCommand::IsFinished() {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Called once after isFinished returns true
|
||||
void ReplaceMeCommand::End() {}
|
||||
|
||||
// Called when another command which requires one or more of the same
|
||||
// subsystems is scheduled to run
|
||||
void ReplaceMeCommand::Interrupted() {}
|
||||
@@ -1,17 +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.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <frc/commands/Command.h>
|
||||
|
||||
class ReplaceMeCommand : public frc::Command {
|
||||
public:
|
||||
ReplaceMeCommand();
|
||||
void Initialize() override;
|
||||
void Execute() override;
|
||||
bool IsFinished() override;
|
||||
void End() override;
|
||||
void Interrupted() override;
|
||||
};
|
||||
@@ -1,24 +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 "ReplaceMeCommandGroup.h"
|
||||
|
||||
ReplaceMeCommandGroup::ReplaceMeCommandGroup() {
|
||||
// Add Commands here:
|
||||
// e.g. AddSequential(new Command1());
|
||||
// AddSequential(new Command2());
|
||||
// these will run in order.
|
||||
|
||||
// To run multiple commands at the same time,
|
||||
// use AddParallel()
|
||||
// e.g. AddParallel(new Command1());
|
||||
// AddSequential(new Command2());
|
||||
// Command1 and Command2 will run in parallel.
|
||||
|
||||
// A command group will require all of the subsystems that each member
|
||||
// would require.
|
||||
// e.g. if Command1 requires chassis, and Command2 requires arm,
|
||||
// a CommandGroup containing them would require both the chassis and the
|
||||
// arm.
|
||||
}
|
||||
@@ -1,12 +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.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <frc/commands/CommandGroup.h>
|
||||
|
||||
class ReplaceMeCommandGroup : public frc::CommandGroup {
|
||||
public:
|
||||
ReplaceMeCommandGroup();
|
||||
};
|
||||
@@ -16,120 +16,7 @@
|
||||
"commandversion": 0
|
||||
},
|
||||
{
|
||||
"name": "Command (Old)",
|
||||
"description": "Create a base command",
|
||||
"tags": [
|
||||
"command"
|
||||
],
|
||||
"foldername": "command",
|
||||
"headers": [
|
||||
"ReplaceMeCommand.h"
|
||||
],
|
||||
"source": [
|
||||
"ReplaceMeCommand.cpp"
|
||||
],
|
||||
"replacename": "ReplaceMeCommand",
|
||||
"commandversion": 1
|
||||
},
|
||||
{
|
||||
"name": "Command Group (Old)",
|
||||
"description": "Create a command group",
|
||||
"tags": [
|
||||
"commandgroup"
|
||||
],
|
||||
"foldername": "commandgroup",
|
||||
"headers": [
|
||||
"ReplaceMeCommandGroup.h"
|
||||
],
|
||||
"source": [
|
||||
"ReplaceMeCommandGroup.cpp"
|
||||
],
|
||||
"replacename": "ReplaceMeCommandGroup",
|
||||
"commandversion": 1
|
||||
},
|
||||
{
|
||||
"name": "Instant Command (Old)",
|
||||
"description": "A command that runs immediately",
|
||||
"tags": [
|
||||
"instantcommand"
|
||||
],
|
||||
"foldername": "instant",
|
||||
"headers": [
|
||||
"ReplaceMeInstantCommand.h"
|
||||
],
|
||||
"source": [
|
||||
"ReplaceMeInstantCommand.cpp"
|
||||
],
|
||||
"replacename": "ReplaceMeInstantCommand",
|
||||
"commandversion": 1
|
||||
},
|
||||
{
|
||||
"name": "Subsystem (Old)",
|
||||
"description": "A subsystem",
|
||||
"tags": [
|
||||
"subsystem"
|
||||
],
|
||||
"foldername": "subsystem",
|
||||
"headers": [
|
||||
"ReplaceMeSubsystem.h"
|
||||
],
|
||||
"source": [
|
||||
"ReplaceMeSubsystem.cpp"
|
||||
],
|
||||
"replacename": "ReplaceMeSubsystem",
|
||||
"commandversion": 1
|
||||
},
|
||||
{
|
||||
"name": "PID Subsystem (Old)",
|
||||
"description": "A subsystem that runs a PID loop",
|
||||
"tags": [
|
||||
"pidsubsystem",
|
||||
"pid"
|
||||
],
|
||||
"foldername": "pidsubsystem",
|
||||
"headers": [
|
||||
"ReplaceMePIDSubsystem.h"
|
||||
],
|
||||
"source": [
|
||||
"ReplaceMePIDSubsystem.cpp"
|
||||
],
|
||||
"replacename": "ReplaceMePIDSubsystem",
|
||||
"commandversion": 1
|
||||
},
|
||||
{
|
||||
"name": "Timed Command (Old)",
|
||||
"description": "A command that runs for a specified time",
|
||||
"tags": [
|
||||
"timedcommand"
|
||||
],
|
||||
"foldername": "timed",
|
||||
"headers": [
|
||||
"ReplaceMeTimedCommand.h"
|
||||
],
|
||||
"source": [
|
||||
"ReplaceMeTimedCommand.cpp"
|
||||
],
|
||||
"replacename": "ReplaceMeTimedCommand",
|
||||
"commandversion": 1
|
||||
},
|
||||
{
|
||||
"name": "Trigger (Old)",
|
||||
"description": "A command that runs off of a trigger",
|
||||
"tags": [
|
||||
"trigger"
|
||||
],
|
||||
"foldername": "trigger",
|
||||
"headers": [
|
||||
"ReplaceMeTrigger.h"
|
||||
],
|
||||
"source": [
|
||||
"ReplaceMeTrigger.cpp"
|
||||
],
|
||||
"replacename": "ReplaceMeTrigger",
|
||||
"commandversion": 1
|
||||
},
|
||||
{
|
||||
"name": "Command (New)",
|
||||
"name": "Command",
|
||||
"description": "A command.",
|
||||
"tags": [
|
||||
"command"
|
||||
@@ -145,7 +32,7 @@
|
||||
"commandversion": 2
|
||||
},
|
||||
{
|
||||
"name": "InstantCommand (New)",
|
||||
"name": "InstantCommand",
|
||||
"description": "A command that finishes instantly.",
|
||||
"tags": [
|
||||
"instantcommand"
|
||||
@@ -161,7 +48,7 @@
|
||||
"commandversion": 2
|
||||
},
|
||||
{
|
||||
"name": "ParallelCommandGroup (New)",
|
||||
"name": "ParallelCommandGroup",
|
||||
"description": "A command group that runs commands in parallel, ending when all commands have finished.",
|
||||
"tags": [
|
||||
"parallelcommandgroup"
|
||||
@@ -177,7 +64,7 @@
|
||||
"commandversion": 2
|
||||
},
|
||||
{
|
||||
"name": "ParallelDeadlineGroup (New)",
|
||||
"name": "ParallelDeadlineGroup",
|
||||
"description": "A command group that runs commands in parallel, ending when a specific command has finished.",
|
||||
"tags": [
|
||||
"paralleldeadlinegroup"
|
||||
@@ -193,7 +80,7 @@
|
||||
"commandversion": 2
|
||||
},
|
||||
{
|
||||
"name": "ParallelRaceGroup (New)",
|
||||
"name": "ParallelRaceGroup",
|
||||
"description": "A command that runs commands in parallel, ending as soon as any command has finished.",
|
||||
"tags": [
|
||||
"parallelracegroup"
|
||||
@@ -209,7 +96,7 @@
|
||||
"commandversion": 2
|
||||
},
|
||||
{
|
||||
"name": "PIDCommand (New)",
|
||||
"name": "PIDCommand",
|
||||
"description": "A command that runs a PIDController.",
|
||||
"tags": [
|
||||
"pidcommand"
|
||||
@@ -225,7 +112,7 @@
|
||||
"commandversion": 2
|
||||
},
|
||||
{
|
||||
"name": "PIDSubsystem (New)",
|
||||
"name": "PIDSubsystem",
|
||||
"description": "A subsystem that runs a PIDController.",
|
||||
"tags": [
|
||||
"pidsubsystem"
|
||||
@@ -241,7 +128,7 @@
|
||||
"commandversion": 2
|
||||
},
|
||||
{
|
||||
"name": "ProfiledPIDCommand (New)",
|
||||
"name": "ProfiledPIDCommand",
|
||||
"description": "A command that runs a ProfiledPIDController.",
|
||||
"tags": [
|
||||
"profiledpidcommand"
|
||||
@@ -257,7 +144,7 @@
|
||||
"commandversion": 2
|
||||
},
|
||||
{
|
||||
"name": "ProfiledPIDSubsystem (New)",
|
||||
"name": "ProfiledPIDSubsystem",
|
||||
"description": "A subsystem that runs a ProfiledPIDController.",
|
||||
"tags": [
|
||||
"profiledpidsubsystem"
|
||||
@@ -273,7 +160,7 @@
|
||||
"commandversion": 2
|
||||
},
|
||||
{
|
||||
"name": "SequentialCommandGroup (New)",
|
||||
"name": "SequentialCommandGroup",
|
||||
"description": "A command group that runs commands in sequence.",
|
||||
"tags": [
|
||||
"sequentialcommandgroup"
|
||||
@@ -289,7 +176,7 @@
|
||||
"commandversion": 2
|
||||
},
|
||||
{
|
||||
"name": "Subsystem (New)",
|
||||
"name": "Subsystem",
|
||||
"description": "A robot subsystem.",
|
||||
"tags": [
|
||||
"subsystem"
|
||||
@@ -305,7 +192,7 @@
|
||||
"commandversion": 2
|
||||
},
|
||||
{
|
||||
"name": "TrapezoidProfileCommand (New)",
|
||||
"name": "TrapezoidProfileCommand",
|
||||
"description": "A command that executes a trapezoidal motion profile.",
|
||||
"tags": [
|
||||
"trapezoidprofilecommand"
|
||||
@@ -321,7 +208,7 @@
|
||||
"commandversion": 2
|
||||
},
|
||||
{
|
||||
"name": "TrapezoidProfileSubsystem (New)",
|
||||
"name": "TrapezoidProfileSubsystem",
|
||||
"description": "A subsystem that executes a trapezoidal motion profile.",
|
||||
"tags": [
|
||||
"trapezoidprofilesubsystem"
|
||||
|
||||
@@ -1,13 +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 "ReplaceMeInstantCommand.h"
|
||||
|
||||
ReplaceMeInstantCommand::ReplaceMeInstantCommand() {
|
||||
// Use Requires() here to declare subsystem dependencies
|
||||
// eg. Requires(Robot::chassis.get());
|
||||
}
|
||||
|
||||
// Called once when the command executes
|
||||
void ReplaceMeInstantCommand::Initialize() {}
|
||||
@@ -1,13 +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.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <frc/commands/InstantCommand.h>
|
||||
|
||||
class ReplaceMeInstantCommand : public frc::InstantCommand {
|
||||
public:
|
||||
ReplaceMeInstantCommand();
|
||||
void Initialize() override;
|
||||
};
|
||||
@@ -1,33 +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 "ReplaceMePIDSubsystem.h"
|
||||
|
||||
#include <frc/livewindow/LiveWindow.h>
|
||||
#include <frc/smartdashboard/SmartDashboard.h>
|
||||
|
||||
ReplaceMePIDSubsystem::ReplaceMePIDSubsystem()
|
||||
: PIDSubsystem("ReplaceMePIDSubsystem", 1.0, 0.0, 0.0) {
|
||||
// Use these to get going:
|
||||
// SetSetpoint() - Sets where the PID controller should move the system
|
||||
// to
|
||||
// Enable() - Enables the PID controller.
|
||||
}
|
||||
|
||||
double ReplaceMePIDSubsystem::ReturnPIDInput() {
|
||||
// Return your input value for the PID loop
|
||||
// e.g. a sensor, like a potentiometer:
|
||||
// yourPot->SetAverageVoltage() / kYourMaxVoltage;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ReplaceMePIDSubsystem::UsePIDOutput(double output) {
|
||||
// Use output to drive your system, like a motor
|
||||
// e.g. yourMotor->Set(output);
|
||||
}
|
||||
|
||||
void ReplaceMePIDSubsystem::InitDefaultCommand() {
|
||||
// Set the default command for a subsystem here.
|
||||
// SetDefaultCommand(new MySpecialCommand());
|
||||
}
|
||||
@@ -1,15 +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.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <frc/commands/PIDSubsystem.h>
|
||||
|
||||
class ReplaceMePIDSubsystem : public frc::PIDSubsystem {
|
||||
public:
|
||||
ReplaceMePIDSubsystem();
|
||||
double ReturnPIDInput() override;
|
||||
void UsePIDOutput(double output) override;
|
||||
void InitDefaultCommand() override;
|
||||
};
|
||||
@@ -1,15 +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 "ReplaceMeSubsystem.h"
|
||||
|
||||
ReplaceMeSubsystem::ReplaceMeSubsystem() : Subsystem("ExampleSubsystem") {}
|
||||
|
||||
void ReplaceMeSubsystem::InitDefaultCommand() {
|
||||
// Set the default command for a subsystem here.
|
||||
// SetDefaultCommand(new MySpecialCommand());
|
||||
}
|
||||
|
||||
// Put methods for controlling this subsystem
|
||||
// here. Call these from Commands.
|
||||
@@ -1,17 +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.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <frc/commands/Subsystem.h>
|
||||
|
||||
class ReplaceMeSubsystem : public frc::Subsystem {
|
||||
private:
|
||||
// It's desirable that everything possible under private except
|
||||
// for methods that implement subsystem capabilities
|
||||
|
||||
public:
|
||||
ReplaceMeSubsystem();
|
||||
void InitDefaultCommand() override;
|
||||
};
|
||||
@@ -1,24 +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 "ReplaceMeTimedCommand.h"
|
||||
|
||||
ReplaceMeTimedCommand::ReplaceMeTimedCommand(units::second_t timeout)
|
||||
: TimedCommand(timeout) {
|
||||
// Use Requires() here to declare subsystem dependencies
|
||||
// eg. Requires(Robot::chassis.get());
|
||||
}
|
||||
|
||||
// Called just before this Command runs the first time
|
||||
void ReplaceMeTimedCommand::Initialize() {}
|
||||
|
||||
// Called repeatedly when this Command is scheduled to run
|
||||
void ReplaceMeTimedCommand::Execute() {}
|
||||
|
||||
// Called once after command times out
|
||||
void ReplaceMeTimedCommand::End() {}
|
||||
|
||||
// Called when another command which requires one or more of the same
|
||||
// subsystems is scheduled to run
|
||||
void ReplaceMeTimedCommand::Interrupted() {}
|
||||
@@ -1,17 +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.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <frc/commands/TimedCommand.h>
|
||||
#include <units/time.h>
|
||||
|
||||
class ReplaceMeTimedCommand : public frc::TimedCommand {
|
||||
public:
|
||||
explicit ReplaceMeTimedCommand(units::second_t timeout);
|
||||
void Initialize() override;
|
||||
void Execute() override;
|
||||
void End() override;
|
||||
void Interrupted() override;
|
||||
};
|
||||
@@ -1,11 +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 "ReplaceMeTrigger.h"
|
||||
|
||||
ReplaceMeTrigger::ReplaceMeTrigger() = default;
|
||||
|
||||
bool ReplaceMeTrigger::Get() {
|
||||
return false;
|
||||
}
|
||||
@@ -1,13 +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.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <frc/buttons/Trigger.h>
|
||||
|
||||
class ReplaceMeTrigger : public frc::Trigger {
|
||||
public:
|
||||
ReplaceMeTrigger();
|
||||
bool Get() override;
|
||||
};
|
||||
Reference in New Issue
Block a user