[commands, documentation] Remove controller replaceme commands (#7053)

This commit is contained in:
Jade
2024-10-11 13:12:02 +08:00
committed by GitHub
parent 4adfa8bf64
commit 679892e8e1
24 changed files with 19 additions and 511 deletions

View File

@@ -17,6 +17,9 @@
class ReplaceMeCommand2
: public frc2::CommandHelper<frc2::Command, ReplaceMeCommand2> {
public:
/* You should consider using the more terse Command factories API instead
* https://docs.wpilib.org/en/stable/docs/software/commandbased/organizing-command-based.html#defining-commands
*/
ReplaceMeCommand2();
void Initialize() override;

View File

@@ -95,70 +95,6 @@
"replacename": "ReplaceMeParallelRaceGroup",
"commandversion": 2
},
{
"name": "PIDCommand",
"description": "A command that runs a PIDController.",
"tags": [
"pidcommand"
],
"foldername": "pidcommand",
"headers": [
"ReplaceMePIDCommand.h"
],
"source": [
"ReplaceMePIDCommand.cpp"
],
"replacename": "ReplaceMePIDCommand",
"commandversion": 2
},
{
"name": "PIDSubsystem",
"description": "A subsystem that runs a PIDController.",
"tags": [
"pidsubsystem"
],
"foldername": "pidsubsystem2",
"headers": [
"ReplaceMePIDSubsystem2.h"
],
"source": [
"ReplaceMePIDSubsystem2.cpp"
],
"replacename": "ReplaceMePIDSubsystem2",
"commandversion": 2
},
{
"name": "ProfiledPIDCommand",
"description": "A command that runs a ProfiledPIDController.",
"tags": [
"profiledpidcommand"
],
"foldername": "profiledpidcommand",
"headers": [
"ReplaceMeProfiledPIDCommand.h"
],
"source": [
"ReplaceMeProfiledPIDCommand.cpp"
],
"replacename": "ReplaceMeProfiledPIDCommand",
"commandversion": 2
},
{
"name": "ProfiledPIDSubsystem",
"description": "A subsystem that runs a ProfiledPIDController.",
"tags": [
"profiledpidsubsystem"
],
"foldername": "profiledpidsubsystem",
"headers": [
"ReplaceMeProfiledPIDSubsystem.h"
],
"source": [
"ReplaceMeProfiledPIDSubsystem.cpp"
],
"replacename": "ReplaceMeProfiledPIDSubsystem",
"commandversion": 2
},
{
"name": "SequentialCommandGroup",
"description": "A command group that runs commands in sequence.",
@@ -190,21 +126,5 @@
],
"replacename": "ReplaceMeSubsystem2",
"commandversion": 2
},
{
"name": "TrapezoidProfileSubsystem",
"description": "A subsystem that executes a trapezoidal motion profile.",
"tags": [
"trapezoidprofilesubsystem"
],
"foldername": "trapezoidprofilesubsystem",
"headers": [
"ReplaceMeTrapezoidProfileSubsystem.h"
],
"source": [
"ReplaceMeTrapezoidProfileSubsystem.cpp"
],
"replacename": "ReplaceMeTrapezoidProfileSubsystem",
"commandversion": 2
}
]

View File

@@ -7,6 +7,9 @@
#include <frc2/command/CommandHelper.h>
#include <frc2/command/InstantCommand.h>
// NOTE: Consider using this command inline, rather than writing a subclass.
// For more information, see:
// https://docs.wpilib.org/en/stable/docs/software/commandbased/convenience-features.html
class ReplaceMeInstantCommand2
: public frc2::CommandHelper<frc2::InstantCommand,
ReplaceMeInstantCommand2> {

View File

@@ -7,6 +7,9 @@
#include <frc2/command/CommandHelper.h>
#include <frc2/command/ParallelCommandGroup.h>
// NOTE: Consider using this command inline, rather than writing a subclass.
// For more information, see:
// https://docs.wpilib.org/en/stable/docs/software/commandbased/convenience-features.html
class ReplaceMeParallelCommandGroup
: public frc2::CommandHelper<frc2::ParallelCommandGroup,
ReplaceMeParallelCommandGroup> {

View File

@@ -7,6 +7,9 @@
#include <frc2/command/CommandHelper.h>
#include <frc2/command/ParallelDeadlineGroup.h>
// NOTE: Consider using this command inline, rather than writing a subclass.
// For more information, see:
// https://docs.wpilib.org/en/stable/docs/software/commandbased/convenience-features.html
class ReplaceMeParallelDeadlineGroup
: public frc2::CommandHelper<frc2::ParallelDeadlineGroup,
ReplaceMeParallelDeadlineGroup> {

View File

@@ -7,6 +7,9 @@
#include <frc2/command/CommandHelper.h>
#include <frc2/command/ParallelRaceGroup.h>
// NOTE: Consider using this command inline, rather than writing a subclass.
// For more information, see:
// https://docs.wpilib.org/en/stable/docs/software/commandbased/convenience-features.html
class ReplaceMeParallelRaceGroup
: public frc2::CommandHelper<frc2::ParallelRaceGroup,
ReplaceMeParallelRaceGroup> {

View File

@@ -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 "ReplaceMePIDCommand.h"
// NOTE: Consider using this command inline, rather than writing a subclass.
// For more information, see:
// https://docs.wpilib.org/en/stable/docs/software/commandbased/convenience-features.html
ReplaceMePIDCommand::ReplaceMePIDCommand()
: CommandHelper{frc::PIDController{0, 0, 0},
// This should return the measurement
[] { return 0; },
// This should return the setpoint (can also be a constant)
[] { return 0; },
// This uses the output
[](double output) {
// Use the output here
}} {}
// Returns true when the command should end.
bool ReplaceMePIDCommand::IsFinished() {
return false;
}

View File

@@ -1,16 +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 <frc2/command/CommandHelper.h>
#include <frc2/command/PIDCommand.h>
class ReplaceMePIDCommand
: public frc2::CommandHelper<frc2::PIDCommand, ReplaceMePIDCommand> {
public:
ReplaceMePIDCommand();
bool IsFinished() override;
};

View File

@@ -1,18 +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 "ReplaceMePIDSubsystem2.h"
ReplaceMePIDSubsystem2::ReplaceMePIDSubsystem2()
// The PIDController used by the subsystem
: PIDSubsystem{frc::PIDController{0, 0, 0}} {}
void ReplaceMePIDSubsystem2::UseOutput(double output, double setpoint) {
// Use the output here
}
double ReplaceMePIDSubsystem2::GetMeasurement() {
// Return the process variable measurement here
return 0;
}

View File

@@ -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 <frc2/command/PIDSubsystem.h>
class ReplaceMePIDSubsystem2 : public frc2::PIDSubsystem {
public:
ReplaceMePIDSubsystem2();
protected:
void UseOutput(double output, double setpoint) override;
double GetMeasurement() override;
};

View File

@@ -1,38 +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 "ReplaceMeProfiledPIDCommand.h"
#include <units/acceleration.h>
#include <units/velocity.h>
// NOTE: Consider using this command inline, rather than writing a subclass.
// For more information, see:
// https://docs.wpilib.org/en/stable/docs/software/commandbased/convenience-features.html
ReplaceMeProfiledPIDCommand::ReplaceMeProfiledPIDCommand()
: CommandHelper{
// The ProfiledPIDController that the command will use
frc::ProfiledPIDController<units::meters>{
// The PID gains
0,
0,
0,
// The motion profile constraints
{0_mps, 0_mps_sq}},
// This should return the measurement
[] { return 0_m; },
// This should return the goal state (can also be a constant)
[] {
return frc::TrapezoidProfile<units::meters>::State{0_m, 0_mps};
},
// This uses the output and current trajectory setpoint
[](double output,
frc::TrapezoidProfile<units::meters>::State setpoint) {
// Use the output and setpoint here
}} {}
// Returns true when the command should end.
bool ReplaceMeProfiledPIDCommand::IsFinished() {
return false;
}

View File

@@ -1,18 +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 <frc2/command/CommandHelper.h>
#include <frc2/command/ProfiledPIDCommand.h>
#include <units/length.h>
class ReplaceMeProfiledPIDCommand
: public frc2::CommandHelper<frc2::ProfiledPIDCommand<units::meters>,
ReplaceMeProfiledPIDCommand> {
public:
ReplaceMeProfiledPIDCommand();
bool IsFinished() override;
};

View File

@@ -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 "ReplaceMeProfiledPIDSubsystem.h"
#include <units/acceleration.h>
#include <units/velocity.h>
ReplaceMeProfiledPIDSubsystem::ReplaceMeProfiledPIDSubsystem()
// The ProfiledPIDController used by the subsystem
: ProfiledPIDSubsystem{frc::ProfiledPIDController<units::meters>{
// The PID gains
0,
0,
0,
// The constraints for the motion profiles
{0_mps, 0_mps_sq}}} {}
void ReplaceMeProfiledPIDSubsystem::UseOutput(
double output, frc::TrapezoidProfile<units::meters>::State setpoint) {
// Use the output and current trajectory setpoint here
}
units::meter_t ReplaceMeProfiledPIDSubsystem::GetMeasurement() {
// Return the process variable measurement here
return 0_m;
}

View File

@@ -1,20 +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 <frc2/command/ProfiledPIDSubsystem.h>
#include <units/length.h>
class ReplaceMeProfiledPIDSubsystem
: public frc2::ProfiledPIDSubsystem<units::meters> {
public:
ReplaceMeProfiledPIDSubsystem();
protected:
void UseOutput(double output,
frc::TrapezoidProfile<units::meters>::State setpoint) override;
units::meter_t GetMeasurement() override;
};

View File

@@ -7,6 +7,9 @@
#include <frc2/command/CommandHelper.h>
#include <frc2/command/SequentialCommandGroup.h>
// NOTE: Consider using this command inline, rather than writing a subclass.
// For more information, see:
// https://docs.wpilib.org/en/stable/docs/software/commandbased/convenience-features.html
class ReplaceMeSequentialCommandGroup
: public frc2::CommandHelper<frc2::SequentialCommandGroup,
ReplaceMeSequentialCommandGroup> {

View File

@@ -1,20 +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 "ReplaceMeTrapezoidProfileSubsystem.h"
#include <units/acceleration.h>
#include <units/velocity.h>
ReplaceMeTrapezoidProfileSubsystem::ReplaceMeTrapezoidProfileSubsystem()
: TrapezoidProfileSubsystem(
// The motion profile constraints
{5_mps, 5_mps_sq},
// The initial position of the mechanism
0_m) {}
void ReplaceMeTrapezoidProfileSubsystem::UseState(
frc::TrapezoidProfile<units::meters>::State state) {
// Use the current profile state here
}

View File

@@ -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 <frc2/command/TrapezoidProfileSubsystem.h>
#include <units/length.h>
class ReplaceMeTrapezoidProfileSubsystem
: frc2::TrapezoidProfileSubsystem<units::meters> {
public:
ReplaceMeTrapezoidProfileSubsystem();
protected:
void UseState(frc::TrapezoidProfile<units::meters>::State state) override;
};

View File

@@ -6,6 +6,7 @@ package edu.wpi.first.wpilibj.commands.command2;
import edu.wpi.first.wpilibj2.command.Command;
/* You should consider using the more terse Command factories API instead https://docs.wpilib.org/en/stable/docs/software/commandbased/organizing-command-based.html#defining-commands */
public class ReplaceMeCommand extends Command {
/** Creates a new ReplaceMeCommand. */
public ReplaceMeCommand() {

View File

@@ -59,46 +59,6 @@
"replacename": "ReplaceMeParallelRaceGroup",
"commandversion": 2
},
{
"name": "PIDCommand",
"description": "A command that runs a PIDController.",
"tags": [
"pidcommand"
],
"foldername": "pidcommand",
"replacename": "ReplaceMePIDCommand",
"commandversion": 2
},
{
"name": "PIDSubsystem",
"description": "A subsystem that runs a PIDController.",
"tags": [
"pidsubsystem"
],
"foldername": "pidsubsystem2",
"replacename": "ReplaceMePIDSubsystem",
"commandversion": 2
},
{
"name": "ProfiledPIDCommand",
"description": "A command that runs a ProfiledPIDController.",
"tags": [
"profiledpidcommand"
],
"foldername": "profiledpidcommand",
"replacename": "ReplaceMeProfiledPIDCommand",
"commandversion": 2
},
{
"name": "ProfiledPIDSubsystem",
"description": "A subsystem that runs a ProfiledPIDController.",
"tags": [
"profiledpidsubsystem"
],
"foldername": "profiledpidsubsystem",
"replacename": "ReplaceMeProfiledPIDSubsystem",
"commandversion": 2
},
{
"name": "SequentialCommandGroup",
"description": "A command group that runs commands in sequence.",
@@ -118,15 +78,5 @@
"foldername": "subsystem2",
"replacename": "ReplaceMeSubsystem",
"commandversion": 2
},
{
"name": "TrapezoidProfileSubsystem",
"description": "A subsystem that executes a trapezoidal motion profile.",
"tags": [
"trapezoidprofilesubsystem"
],
"foldername": "trapezoidprofilesubsystem",
"replacename": "ReplaceMeTrapezoidProfileSubsystem",
"commandversion": 2
}
]

View File

@@ -1,36 +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.
package edu.wpi.first.wpilibj.commands.pidcommand;
import edu.wpi.first.math.controller.PIDController;
import edu.wpi.first.wpilibj2.command.PIDCommand;
// NOTE: Consider using this command inline, rather than writing a subclass. For more
// information, see:
// https://docs.wpilib.org/en/stable/docs/software/commandbased/convenience-features.html
public class ReplaceMePIDCommand extends PIDCommand {
/** Creates a new ReplaceMePIDCommand. */
public ReplaceMePIDCommand() {
super(
// The controller that the command will use
new PIDController(0, 0, 0),
// This should return the measurement
() -> 0,
// This should return the setpoint (can also be a constant)
() -> 0,
// This uses the output
output -> {
// Use the output here
});
// Use addRequirements() here to declare subsystem dependencies.
// Configure additional PID options by calling `getController` here.
}
// Returns true when the command should end.
@Override
public boolean isFinished() {
return false;
}
}

View File

@@ -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.
package edu.wpi.first.wpilibj.commands.pidsubsystem2;
import edu.wpi.first.math.controller.PIDController;
import edu.wpi.first.wpilibj2.command.PIDSubsystem;
public class ReplaceMePIDSubsystem extends PIDSubsystem {
/** Creates a new ReplaceMePIDSubsystem. */
public ReplaceMePIDSubsystem() {
super(
// The PIDController used by the subsystem
new PIDController(0, 0, 0));
}
@Override
public void useOutput(double output, double setpoint) {
// Use the output here
}
@Override
public double getMeasurement() {
// Return the process variable measurement here
return 0;
}
}

View File

@@ -1,43 +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.
package edu.wpi.first.wpilibj.commands.profiledpidcommand;
import edu.wpi.first.math.controller.ProfiledPIDController;
import edu.wpi.first.math.trajectory.TrapezoidProfile;
import edu.wpi.first.wpilibj2.command.ProfiledPIDCommand;
// NOTE: Consider using this command inline, rather than writing a subclass. For more
// information, see:
// https://docs.wpilib.org/en/stable/docs/software/commandbased/convenience-features.html
public class ReplaceMeProfiledPIDCommand extends ProfiledPIDCommand {
/** Creates a new ReplaceMeProfiledPIDCommand. */
public ReplaceMeProfiledPIDCommand() {
super(
// The ProfiledPIDController used by the command
new ProfiledPIDController(
// The PID gains
0,
0,
0,
// The motion profile constraints
new TrapezoidProfile.Constraints(0, 0)),
// This should return the measurement
() -> 0,
// This should return the goal (can also be a constant)
() -> new TrapezoidProfile.State(),
// This uses the output
(output, setpoint) -> {
// Use the output (and setpoint, if desired) here
});
// Use addRequirements() here to declare subsystem dependencies.
// Configure additional PID options by calling `getController` here.
}
// Returns true when the command should end.
@Override
public boolean isFinished() {
return false;
}
}

View File

@@ -1,34 +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.
package edu.wpi.first.wpilibj.commands.profiledpidsubsystem;
import edu.wpi.first.math.controller.ProfiledPIDController;
import edu.wpi.first.math.trajectory.TrapezoidProfile;
import edu.wpi.first.wpilibj2.command.ProfiledPIDSubsystem;
public class ReplaceMeProfiledPIDSubsystem extends ProfiledPIDSubsystem {
/** Creates a new ReplaceMeProfiledPIDSubsystem. */
public ReplaceMeProfiledPIDSubsystem() {
super(
// The ProfiledPIDController used by the subsystem
new ProfiledPIDController(
0,
0,
0,
// The motion profile constraints
new TrapezoidProfile.Constraints(0, 0)));
}
@Override
public void useOutput(double output, TrapezoidProfile.State setpoint) {
// Use the output (and optionally the setpoint) here
}
@Override
public double getMeasurement() {
// Return the process variable measurement here
return 0;
}
}

View File

@@ -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.
package edu.wpi.first.wpilibj.commands.trapezoidprofilesubsystem;
import edu.wpi.first.math.trajectory.TrapezoidProfile;
import edu.wpi.first.wpilibj2.command.TrapezoidProfileSubsystem;
public class ReplaceMeTrapezoidProfileSubsystem extends TrapezoidProfileSubsystem {
/** Creates a new ReplaceMeTrapezoidProfileSubsystem. */
public ReplaceMeTrapezoidProfileSubsystem() {
super(
// The constraints for the generated profiles
new TrapezoidProfile.Constraints(0, 0),
// The initial position of the mechanism
0);
}
@Override
protected void useState(TrapezoidProfile.State state) {
// Use the computed profile state here.
}
}