Class ColorFlowAnimation

java.lang.Object
com.ctre.phoenix6.controls.ColorFlowAnimation
All Implemented Interfaces:
ControlRequest, Cloneable

public final class ColorFlowAnimation extends Object implements ControlRequest, Cloneable
Animation that gradually lights the entire LED strip one LED at a time.

  • Field Details

    • LEDStartIndex

      public int LEDStartIndex
      The index of the first LED this animation controls (inclusive). Indices 0-7 control the onboard LEDs, and 8-399 control an attached LED strip

      If the start index is greater than the end index, the direction will be reversed. The direction can also be changed using the Direction parameter.

    • LEDEndIndex

      public int LEDEndIndex
      The index of the last LED this animation controls (inclusive). Indices 0-7 control the onboard LEDs, and 8-399 control an attached LED strip.

      If the end index is less than the start index, the direction will be reversed. The direction can also be changed using the Direction parameter.

    • Slot

      public int Slot
      The slot of this animation, within [0, 7]. Each slot on the CANdle can store and run one animation.
    • Color

      public RGBWColor Color
      The color to use in the animation.
    • Direction

      The direction of the animation.
    • FrameRate

      public double FrameRate
      The frame rate of the animation, from [2, 1000] Hz. This determines the speed of the animation.

      A frame is defined as a transition in the state of the LEDs, turning one on or off.

      • Units: Hz
    • UpdateFreqHz

      public double UpdateFreqHz
      The frequency at which this control will update. This is designated in Hertz, with a minimum of 20 Hz (every 50 ms) and a maximum of 1000 Hz (every 1 ms). Some update frequencies are not supported and will be promoted up to the next highest supported frequency.

      If this field is set to 0 Hz, the control request will be sent immediately as a one-shot frame. This may be useful for advanced applications that require outputs to be synchronized with data acquisition. In this case, we recommend not exceeding 50 ms between control calls.

  • Constructor Details

    • ColorFlowAnimation

      public ColorFlowAnimation(int LEDStartIndex, int LEDEndIndex)
      Animation that gradually lights the entire LED strip one LED at a time.

      Parameters:
      LEDStartIndex - The index of the first LED this animation controls (inclusive). Indices 0-7 control the onboard LEDs, and 8-399 control an attached LED strip

      If the start index is greater than the end index, the direction will be reversed. The direction can also be changed using the Direction parameter.

      LEDEndIndex - The index of the last LED this animation controls (inclusive). Indices 0-7 control the onboard LEDs, and 8-399 control an attached LED strip.

      If the end index is less than the start index, the direction will be reversed. The direction can also be changed using the Direction parameter.

  • Method Details

    • getName

      public String getName()
      Description copied from interface: ControlRequest
      Gets the name of this control request.
      Specified by:
      getName in interface ControlRequest
      Returns:
      Name of the control request
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • sendRequest

      public StatusCode sendRequest(String network, int deviceHash)
      Specified by:
      sendRequest in interface ControlRequest
    • getControlInfo

      Gets information about this control request.
      Specified by:
      getControlInfo in interface ControlRequest
      Returns:
      Map of control parameter names and corresponding applied values
    • withLEDStartIndex

      public ColorFlowAnimation withLEDStartIndex(int newLEDStartIndex)
      Modifies this Control Request's LEDStartIndex parameter and returns itself for method-chaining and easier to use request API.

      The index of the first LED this animation controls (inclusive). Indices 0-7 control the onboard LEDs, and 8-399 control an attached LED strip

      If the start index is greater than the end index, the direction will be reversed. The direction can also be changed using the Direction parameter.

      Parameters:
      newLEDStartIndex - Parameter to modify
      Returns:
      Itself
    • withLEDEndIndex

      public ColorFlowAnimation withLEDEndIndex(int newLEDEndIndex)
      Modifies this Control Request's LEDEndIndex parameter and returns itself for method-chaining and easier to use request API.

      The index of the last LED this animation controls (inclusive). Indices 0-7 control the onboard LEDs, and 8-399 control an attached LED strip.

      If the end index is less than the start index, the direction will be reversed. The direction can also be changed using the Direction parameter.

      Parameters:
      newLEDEndIndex - Parameter to modify
      Returns:
      Itself
    • withSlot

      public ColorFlowAnimation withSlot(int newSlot)
      Modifies this Control Request's Slot parameter and returns itself for method-chaining and easier to use request API.

      The slot of this animation, within [0, 7]. Each slot on the CANdle can store and run one animation.

      Parameters:
      newSlot - Parameter to modify
      Returns:
      Itself
    • withColor

      Modifies this Control Request's Color parameter and returns itself for method-chaining and easier to use request API.

      The color to use in the animation.

      Parameters:
      newColor - Parameter to modify
      Returns:
      Itself
    • withDirection

      Modifies this Control Request's Direction parameter and returns itself for method-chaining and easier to use request API.

      The direction of the animation.

      Parameters:
      newDirection - Parameter to modify
      Returns:
      Itself
    • withFrameRate

      public ColorFlowAnimation withFrameRate(double newFrameRate)
      Modifies this Control Request's FrameRate parameter and returns itself for method-chaining and easier to use request API.

      The frame rate of the animation, from [2, 1000] Hz. This determines the speed of the animation.

      A frame is defined as a transition in the state of the LEDs, turning one on or off.

      • Units: Hz
      Parameters:
      newFrameRate - Parameter to modify
      Returns:
      Itself
    • withFrameRate

      Modifies this Control Request's FrameRate parameter and returns itself for method-chaining and easier to use request API.

      The frame rate of the animation, from [2, 1000] Hz. This determines the speed of the animation.

      A frame is defined as a transition in the state of the LEDs, turning one on or off.

      • Units: Hz
      Parameters:
      newFrameRate - Parameter to modify
      Returns:
      Itself
    • getFrameRateMeasure

      Helper method to get this Control Request's FrameRate parameter converted to a unit type. If not using the Java units library, FrameRate can be accessed directly instead.

      The frame rate of the animation, from [2, 1000] Hz. This determines the speed of the animation.

      A frame is defined as a transition in the state of the LEDs, turning one on or off.

      • Units: Hz
      Returns:
      FrameRate
    • withUpdateFreqHz

      public ColorFlowAnimation withUpdateFreqHz(double newUpdateFreqHz)
      Sets the frequency at which this control will update. This is designated in Hertz, with a minimum of 20 Hz (every 50 ms) and a maximum of 1000 Hz (every 1 ms). Some update frequencies are not supported and will be promoted up to the next highest supported frequency.

      If this field is set to 0 Hz, the control request will be sent immediately as a one-shot frame. This may be useful for advanced applications that require outputs to be synchronized with data acquisition. In this case, we recommend not exceeding 50 ms between control calls.

      Specified by:
      withUpdateFreqHz in interface ControlRequest
      Parameters:
      newUpdateFreqHz - Parameter to modify
      Returns:
      Itself
    • withUpdateFreqHz

      public ColorFlowAnimation withUpdateFreqHz(Frequency newUpdateFreqHz)
      Sets the frequency at which this control will update. This is designated in Hertz, with a minimum of 20 Hz (every 50 ms) and a maximum of 1000 Hz (every 1 ms). Some update frequencies are not supported and will be promoted up to the next highest supported frequency.

      If this field is set to 0 Hz, the control request will be sent immediately as a one-shot frame. This may be useful for advanced applications that require outputs to be synchronized with data acquisition. In this case, we recommend not exceeding 50 ms between control calls.

      Specified by:
      withUpdateFreqHz in interface ControlRequest
      Parameters:
      newUpdateFreqHz - Parameter to modify
      Returns:
      Itself
    • clone

      Overrides:
      clone in class Object