mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
[commands] Remove deprecated TrapzoidProfileCommand api (#6547)
This commit is contained in:
@@ -22,7 +22,6 @@ public class TrapezoidProfileCommand extends Command {
|
||||
private final Consumer<State> m_output;
|
||||
private final Supplier<State> m_goal;
|
||||
private final Supplier<State> m_currentState;
|
||||
private final boolean m_newAPI; // TODO: Remove
|
||||
private final Timer m_timer = new Timer();
|
||||
|
||||
/**
|
||||
@@ -46,29 +45,6 @@ public class TrapezoidProfileCommand extends Command {
|
||||
m_output = requireNonNullParam(output, "output", "TrapezoidProfileCommand");
|
||||
m_goal = goal;
|
||||
m_currentState = currentState;
|
||||
m_newAPI = true;
|
||||
addRequirements(requirements);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new TrapezoidProfileCommand that will execute the given {@link TrapezoidProfile}.
|
||||
* Output will be piped to the provided consumer function.
|
||||
*
|
||||
* @param profile The motion profile to execute.
|
||||
* @param output The consumer for the profile output.
|
||||
* @param requirements The subsystems required by this command.
|
||||
* @deprecated The new constructor allows you to pass in a supplier for desired and current state.
|
||||
* This allows you to change goals at runtime.
|
||||
*/
|
||||
@Deprecated(since = "2024", forRemoval = true)
|
||||
@SuppressWarnings("this-escape")
|
||||
public TrapezoidProfileCommand(
|
||||
TrapezoidProfile profile, Consumer<State> output, Subsystem... requirements) {
|
||||
m_profile = requireNonNullParam(profile, "profile", "TrapezoidProfileCommand");
|
||||
m_output = requireNonNullParam(output, "output", "TrapezoidProfileCommand");
|
||||
m_newAPI = false;
|
||||
m_goal = null;
|
||||
m_currentState = null;
|
||||
addRequirements(requirements);
|
||||
}
|
||||
|
||||
@@ -80,11 +56,7 @@ public class TrapezoidProfileCommand extends Command {
|
||||
@Override
|
||||
@SuppressWarnings("removal")
|
||||
public void execute() {
|
||||
if (m_newAPI) {
|
||||
m_output.accept(m_profile.calculate(m_timer.get(), m_currentState.get(), m_goal.get()));
|
||||
} else {
|
||||
m_output.accept(m_profile.calculate(m_timer.get()));
|
||||
}
|
||||
m_output.accept(m_profile.calculate(m_timer.get(), m_currentState.get(), m_goal.get()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user