Package lib.custom.motioncontrollers
Class ezMotion
java.lang.Object
edu.wpi.first.wpilibj2.command.Command
lib.custom.motioncontrollers.ezMotion
- All Implemented Interfaces:
edu.wpi.first.util.sendable.Sendable
public class ezMotion
extends edu.wpi.first.wpilibj2.command.Command
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic interfaceNested classes/interfaces inherited from class edu.wpi.first.wpilibj2.command.Command
edu.wpi.first.wpilibj2.command.Command.InterruptionBehavior -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionezMotion(ezControl control, DoubleSupplier getCurrent, DoubleConsumer processValue, double goal, double continuousRange, edu.wpi.first.math.trajectory.TrapezoidProfile.Constraints constraints, edu.wpi.first.wpilibj2.command.Subsystem... requirements) Seeherefor other parameters.ezMotion(ezControl control, DoubleSupplier getCurrent, DoubleConsumer processValue, double goal, edu.wpi.first.math.trajectory.TrapezoidProfile.Constraints constraints, edu.wpi.first.wpilibj2.command.Subsystem... requirements) Seeherefor other parameters.ezMotion(ezControl control, DoubleSupplier getCurrent, DoubleConsumer processValue, Supplier<? extends ezMotion.SetpointSupplier> setpointDealerDealer, edu.wpi.first.wpilibj2.command.Subsystem... requirements) Seeherefor other parameters.ezMotion(ezControl control, DoubleSupplier getCurrent, DoubleConsumer processValue, ezMotion.SetpointSupplier setpointDealer, edu.wpi.first.wpilibj2.command.Subsystem... requirements) -
Method Summary
Methods inherited from class edu.wpi.first.wpilibj2.command.Command
addRequirements, addRequirements, alongWith, andThen, andThen, asProxy, beforeStarting, beforeStarting, cancel, deadlineFor, deadlineWith, end, finallyDo, finallyDo, getInterruptionBehavior, getName, getRequirements, getSubsystem, handleInterrupt, hasRequirement, ignoringDisable, initSendable, isFinished, isScheduled, onlyIf, onlyWhile, raceWith, repeatedly, runsWhenDisabled, schedule, setName, setSubsystem, unless, until, withDeadline, withInterruptBehavior, withName, withTimeout, withTimeout
-
Field Details
-
control
-
-
Constructor Details
-
ezMotion
public ezMotion(ezControl control, DoubleSupplier getCurrent, DoubleConsumer processValue, Supplier<? extends ezMotion.SetpointSupplier> setpointDealerDealer, edu.wpi.first.wpilibj2.command.Subsystem... requirements) Seeherefor other parameters.- Parameters:
setpointDealerDealer- Supplier of setpoint suppliers. A new setpoint supplier will be gotten each time this command runs.
-
ezMotion
public ezMotion(ezControl control, DoubleSupplier getCurrent, DoubleConsumer processValue, ezMotion.SetpointSupplier setpointDealer, edu.wpi.first.wpilibj2.command.Subsystem... requirements) - Parameters:
control- PID and feedforward config. Should not be shared by multiple ezMotion commands if they can run at the same time.getCurrent- Supplier that get the current position/angle of the mechanism.processValue- Consumer that applies calculated values (usually voltages) to the mechanism.setpointDealer- Supplier of setpoints that the feedforward will target.requirements- Requirements for this command.
-
ezMotion
public ezMotion(ezControl control, DoubleSupplier getCurrent, DoubleConsumer processValue, double goal, edu.wpi.first.math.trajectory.TrapezoidProfile.Constraints constraints, edu.wpi.first.wpilibj2.command.Subsystem... requirements) Seeherefor other parameters.- Parameters:
goal- The goal position. Each time the command starts,aTrapezoidProfilewill be calculated from the current position to this goal.constraints- Theconstraintsfor the above profile.
-
ezMotion
public ezMotion(ezControl control, DoubleSupplier getCurrent, DoubleConsumer processValue, double goal, double continuousRange, edu.wpi.first.math.trajectory.TrapezoidProfile.Constraints constraints, edu.wpi.first.wpilibj2.command.Subsystem... requirements) Seeherefor other parameters.- Parameters:
continuousRange- The range of motion for a rotational mechanism before it wraps around to the same position. For example, if1, then positions0 == 1,0.5 == 1.5, etc. This is used to calculate the trapezoid profile, not for continuous PID. Make sure to also usePIDController.enableContinuousInput(double, double)when constructing theezControl.
-
-
Method Details
-
getElapsedTime
public double getElapsedTime() -
initialize
public void initialize()- Overrides:
initializein classedu.wpi.first.wpilibj2.command.Command
-
execute
public void execute()- Overrides:
executein classedu.wpi.first.wpilibj2.command.Command
-