Class MotionProfile

java.lang.Object
com.stuypulse.stuylib.streams.numbers.filters.MotionProfile
All Implemented Interfaces:
IFilter

public class MotionProfile extends Object implements IFilter
A filter, that when applied to the input of a motor, will profile it. Similar to the way in which motion profiling can limit the amount of acceleration and jerk in an S-Curve, this can do that to real time input. Because this will add a delay, it is recommended that the accelLimit is as high as possible. Aside from the accelLimit, this is identical to a SlewRateLimiter or TimedRateLimit.
  • Constructor Details

    • MotionProfile

      public MotionProfile(Number velLimit, Number accelLimit, int steps)
      Parameters:
      velLimit - maximum change in displacement per second (u/s)
      accelLimit - maximum change in velocity per second (u/s/s)
      steps - number of times to apply filter (improves accuracy)
    • MotionProfile

      public MotionProfile(Number velLimit, Number accelLimit)
      Parameters:
      velLimit - maximum change in velocity per second (u/s)
      accelLimit - maximum change in acceleration per second (u/s/s)
  • Method Details

    • get

      public double get(double target)
      Description copied from interface: IFilter
      Get next value in Filter based on the next value given
      Specified by:
      get in interface IFilter
      Parameters:
      target - next input value in the stream
      Returns:
      the output value of the filter