[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

@@ -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.
}
}