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 Classes
    Modifier and Type
    Class
    Description
    static interface 
     
    static interface 
     

    Nested classes/interfaces inherited from class edu.wpi.first.wpilibj2.command.Command

    edu.wpi.first.wpilibj2.command.Command.InterruptionBehavior
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final ezControl
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    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)
    See here for 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)
    See here for other parameters.
    ezMotion(ezControl control, DoubleSupplier getCurrent, DoubleConsumer processValue, Supplier<? extends ezMotion.SetpointSupplier> setpointDealerDealer, edu.wpi.first.wpilibj2.command.Subsystem... requirements)
    See here for other parameters.
    ezMotion(ezControl control, DoubleSupplier getCurrent, DoubleConsumer processValue, ezMotion.SetpointSupplier setpointDealer, edu.wpi.first.wpilibj2.command.Subsystem... requirements)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    double
     
    void
     

    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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • ezMotion

      public ezMotion(ezControl control, DoubleSupplier getCurrent, DoubleConsumer processValue, Supplier<? extends ezMotion.SetpointSupplier> setpointDealerDealer, edu.wpi.first.wpilibj2.command.Subsystem... requirements)
      See here for 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)
      See here for other parameters.
      Parameters:
      goal - The goal position. Each time the command starts,a TrapezoidProfile will be calculated from the current position to this goal.
      constraints - The constraints for 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)
      See here for other parameters.
      Parameters:
      continuousRange - The range of motion for a rotational mechanism before it wraps around to the same position. For example, if 1, then positions 0 == 1, 0.5 == 1.5, etc. This is used to calculate the trapezoid profile, not for continuous PID. Make sure to also use PIDController.enableContinuousInput(double, double) when constructing the ezControl.
  • Method Details

    • getElapsedTime

      public double getElapsedTime()
    • initialize

      public void initialize()
      Overrides:
      initialize in class edu.wpi.first.wpilibj2.command.Command
    • execute

      public void execute()
      Overrides:
      execute in class edu.wpi.first.wpilibj2.command.Command