Class FireAnimation

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

public final class FireAnimation extends Object implements ControlRequest, Cloneable
Animation that looks similar to a flame flickering.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    double
    The brightness of the animation, as a scalar from 0.0 to 1.0.
    double
    The rate at which the fire cools along the travel, as a scalar from 0.0 to 1.0.
    The direction of the animation.
    double
    The frame rate of the animation, from [2, 1000] Hz.
    int
    The index of the last LED this animation controls (inclusive).
    int
    The index of the first LED this animation controls (inclusive).
    int
    The slot of this animation, within [0, 7].
    double
    The proportion of time in which sparks reignite the fire, as a scalar from 0.0 to 1.0.
    double
    The frequency at which this control will update.
  • Constructor Summary

    Constructors
    Constructor
    Description
    FireAnimation(int LEDStartIndex, int LEDEndIndex)
    Animation that looks similar to a flame flickering.
  • Method Summary

    Modifier and Type
    Method
    Description
     
    Gets information about this control request.
    Helper method to get this Control Request's FrameRate parameter converted to a unit type.
    Gets the name of this control request.
    sendRequest(CANBus network, int deviceHash)
    Sends the control request to the device.
     
    withBrightness(double newBrightness)
    Modifies this Control Request's Brightness parameter and returns itself for method-chaining and easier to use request API.
    withCooling(double newCooling)
    Modifies this Control Request's Cooling parameter and returns itself for method-chaining and easier to use request API.
    Modifies this Control Request's Direction parameter and returns itself for method-chaining and easier to use request API.
    withFrameRate(double newFrameRate)
    Modifies this Control Request's FrameRate parameter and returns itself for method-chaining and easier to use request API.
    withFrameRate(Frequency newFrameRate)
    Modifies this Control Request's FrameRate parameter and returns itself for method-chaining and easier to use request API.
    withLEDEndIndex(int newLEDEndIndex)
    Modifies this Control Request's LEDEndIndex parameter and returns itself for method-chaining and easier to use request API.
    withLEDStartIndex(int newLEDStartIndex)
    Modifies this Control Request's LEDStartIndex parameter and returns itself for method-chaining and easier to use request API.
    withSlot(int newSlot)
    Modifies this Control Request's Slot parameter and returns itself for method-chaining and easier to use request API.
    withSparking(double newSparking)
    Modifies this Control Request's Sparking parameter and returns itself for method-chaining and easier to use request API.
    withUpdateFreqHz(double newUpdateFreqHz)
    Sets the frequency at which this control will update.
    withUpdateFreqHz(Frequency newUpdateFreqHz)
    Sets the frequency at which this control will update.

    Methods inherited from class Object

    equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • 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.
    • Brightness

      public double Brightness
      The brightness of the animation, as a scalar from 0.0 to 1.0.
    • Direction

      public AnimationDirectionValue Direction
      The direction of the animation.
    • Sparking

      public double Sparking
      The proportion of time in which sparks reignite the fire, as a scalar from 0.0 to 1.0.
    • Cooling

      public double Cooling
      The rate at which the fire cools along the travel, as a scalar from 0.0 to 1.0.
    • 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, advancing the animation of the fire.

      • 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

    • FireAnimation

      public FireAnimation(int LEDStartIndex, int LEDEndIndex)
      Animation that looks similar to a flame flickering.
      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(CANBus network, int deviceHash)
      Description copied from interface: ControlRequest
      Sends the control request to the device. Users should call setControl() on the device instead.
      Specified by:
      sendRequest in interface ControlRequest
      Parameters:
      network - Device network
      deviceHash - Device hash
      Returns:
      Status code of sending the request
    • getControlInfo

      public Map<String,String> 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 FireAnimation 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 FireAnimation 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 FireAnimation 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
    • withBrightness

      public FireAnimation withBrightness(double newBrightness)
      Modifies this Control Request's Brightness parameter and returns itself for method-chaining and easier to use request API.

      The brightness of the animation, as a scalar from 0.0 to 1.0.

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

      public FireAnimation withDirection(AnimationDirectionValue newDirection)
      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
    • withSparking

      public FireAnimation withSparking(double newSparking)
      Modifies this Control Request's Sparking parameter and returns itself for method-chaining and easier to use request API.

      The proportion of time in which sparks reignite the fire, as a scalar from 0.0 to 1.0.

      Parameters:
      newSparking - Parameter to modify
      Returns:
      Itself
    • withCooling

      public FireAnimation withCooling(double newCooling)
      Modifies this Control Request's Cooling parameter and returns itself for method-chaining and easier to use request API.

      The rate at which the fire cools along the travel, as a scalar from 0.0 to 1.0.

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

      public FireAnimation 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, advancing the animation of the fire.

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

      public FireAnimation withFrameRate(Frequency 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, advancing the animation of the fire.

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

      public Frequency 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, advancing the animation of the fire.

      • Units: Hz
      Returns:
      FrameRate
    • withUpdateFreqHz

      public FireAnimation 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 FireAnimation 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

      public FireAnimation clone()
      Overrides:
      clone in class Object