Class PowerDistributionJNI

java.lang.Object
edu.wpi.first.hal.JNIWrapper
edu.wpi.first.hal.PowerDistributionJNI

public class PowerDistributionJNI
extends JNIWrapper
Power Distribution JNI Functions.
See Also:
"hal/PowerDistribution.h"
  • Nested Class Summary

    Nested classes/interfaces inherited from class edu.wpi.first.hal.JNIWrapper

    JNIWrapper.Helper
  • Field Summary

    Fields 
    Modifier and Type Field Description
    static int AUTOMATIC_TYPE  
    static int CTRE_TYPE  
    static int DEFAULT_MODULE  
    static int REV_TYPE  
  • Method Summary

    Modifier and Type Method Description
    static boolean checkChannel​(int handle, int channel)
    Checks if a PowerDistribution channel is valid.
    static boolean checkModule​(int module, int type)
    Checks if a PowerDistribution module is valid.
    static void clearStickyFaults​(int handle)
    Clears any PowerDistribution sticky faults.
    static void free​(int handle)
    Cleans a PowerDistribution module.
    static void getAllCurrents​(int handle, double[] currents)
    Gets the current of all channels on the PowerDistribution.
    static double getChannelCurrent​(int handle, int channel)
    Gets the current of a specific PowerDistribution channel.
    static double getChannelCurrentNoError​(int handle, int channel)
    Gets the current of a specific PowerDistribution channel without throwing any errors.
    static PowerDistributionFaults getFaults​(int handle)
    Get the current faults of the PowerDistribution.
    static int getFaultsNative​(int handle)
    Get the current faults of the PowerDistribution.
    static int getModuleNumber​(int handle)
    Gets the module number for a specific handle.
    static int getNumChannels​(int handle)
    Gets the number of channels for this handle.
    static PowerDistributionStickyFaults getStickyFaults​(int handle)
    Gets the sticky faults of the PowerDistribution.
    static int getStickyFaultsNative​(int handle)
    Gets the sticky faults of the PowerDistribution.
    static boolean getSwitchableChannel​(int handle)
    Returns true if switchable channel is powered on.
    static boolean getSwitchableChannelNoError​(int handle)
    Returns true if switchable channel is powered on without throwing any errors.
    static double getTemperature​(int handle)
    Gets the temperature of the PowerDistribution.
    static double getTotalCurrent​(int handle)
    Gets the total current of the PowerDistribution.
    static double getTotalCurrentNoError​(int handle)
    Gets the total current of the PowerDistribution without throwing any errors.
    static double getTotalEnergy​(int handle)
    Gets the total energy of the Power Distribution Panel.
    static double getTotalPower​(int handle)
    Gets the total power of the Power Distribution Panel.
    static int getType​(int handle)
    Gets the type of PowerDistribution module.
    static PowerDistributionVersion getVersion​(int handle)
    Get the version of the PowerDistribution.
    static double getVoltage​(int handle)
    Gets the PowerDistribution input voltage.
    static double getVoltageNoError​(int handle)
    Gets the PowerDistribution input voltage without throwing any errors.
    static int initialize​(int module, int type)
    Initializes a Power Distribution Panel.
    static void resetTotalEnergy​(int handle)
    Resets the Power Distribution Panel accumulated energy.
    static void setSwitchableChannel​(int handle, boolean enabled)
    Power on/off switchable channel.
    static void setSwitchableChannelNoError​(int handle, boolean enabled)
    Power on/off switchable channel without throwing any errors.

    Methods inherited from class edu.wpi.first.hal.JNIWrapper

    forceLoad, suppressUnused

    Methods inherited from class java.lang.Object

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

  • Method Details

    • initialize

      public static int initialize​(int module, int type)
      Initializes a Power Distribution Panel.
      Parameters:
      module - the module number to initialize
      type - the type of module to initialize
      Returns:
      the created PowerDistribution handle
      See Also:
      "HAL_InitializePowerDistribution"
    • free

      public static void free​(int handle)
      Cleans a PowerDistribution module.
      Parameters:
      handle - the module handle
      See Also:
      "HAL_CleanPowerDistribution"
    • getModuleNumber

      public static int getModuleNumber​(int handle)
      Gets the module number for a specific handle.
      Parameters:
      handle - the module handle
      Returns:
      the module number
      See Also:
      "HAL_GetPowerDistributionModuleNumber"
    • checkModule

      public static boolean checkModule​(int module, int type)
      Checks if a PowerDistribution module is valid.
      Parameters:
      module - the module to check
      type - the type of module
      Returns:
      true if the module is valid, otherwise false
      See Also:
      "HAL_CheckPowerDistributionModule"
    • checkChannel

      public static boolean checkChannel​(int handle, int channel)
      Checks if a PowerDistribution channel is valid.
      Parameters:
      handle - the module handle
      channel - the channel to check
      Returns:
      true if the channel is valid, otherwise false
      See Also:
      "HAL_CheckPowerDistributionChannel"
    • getType

      public static int getType​(int handle)
      Gets the type of PowerDistribution module.
      Parameters:
      handle - the module handle
      Returns:
      the type of module
      See Also:
      "HAL_GetPowerDistributionType"
    • getNumChannels

      public static int getNumChannels​(int handle)
      Gets the number of channels for this handle.
      Parameters:
      handle - the handle
      Returns:
      number of channels
      See Also:
      "HAL_GetPowerDistributionNumChannels"
    • getTemperature

      public static double getTemperature​(int handle)
      Gets the temperature of the PowerDistribution.

      Not supported on the Rev PDH and returns 0.

      Parameters:
      handle - the module handle
      Returns:
      the module temperature (celsius)
      See Also:
      "HAL_GetPowerDistributionTemperature"
    • getVoltage

      public static double getVoltage​(int handle)
      Gets the PowerDistribution input voltage.
      Parameters:
      handle - the module handle
      Returns:
      the input voltage (volts)
      See Also:
      "HAL_GetPowerDistributionVoltage"
    • getChannelCurrent

      public static double getChannelCurrent​(int handle, int channel)
      Gets the current of a specific PowerDistribution channel.
      Parameters:
      handle - the module handle
      channel - the channel
      Returns:
      the channel current (amps)
      See Also:
      "HAL_GetPowerDistributionChannelCurrent"
    • getAllCurrents

      public static void getAllCurrents​(int handle, double[] currents)
      Gets the current of all channels on the PowerDistribution.

      The array must be large enough to hold all channels.

      Parameters:
      handle - the module handle
      currents - the currents
      See Also:
      "HAL_GetPowerDistributionAllChannelCurrents"
    • getTotalCurrent

      public static double getTotalCurrent​(int handle)
      Gets the total current of the PowerDistribution.
      Parameters:
      handle - the module handle
      Returns:
      the total current (amps)
      See Also:
      "HAL_GetPowerDistributionTotalCurrent"
    • getTotalPower

      public static double getTotalPower​(int handle)
      Gets the total power of the Power Distribution Panel.

      Not supported on the Rev PDH and returns 0.

      Parameters:
      handle - the module handle
      Returns:
      the total power (watts)
      See Also:
      "HAL_GetPowerDistributionTotalPower"
    • getTotalEnergy

      public static double getTotalEnergy​(int handle)
      Gets the total energy of the Power Distribution Panel.

      Not supported on the Rev PDH and does nothing.

      Parameters:
      handle - the module handle
      Returns:
      the total energy (joules)
      See Also:
      "HAL_GetPowerDistributionTotalEnergy"
    • resetTotalEnergy

      public static void resetTotalEnergy​(int handle)
      Resets the Power Distribution Panel accumulated energy.

      Not supported on the Rev PDH and returns 0.

      Parameters:
      handle - the module handle
      See Also:
      "HAL_ClearPowerDistributionStickyFaults"
    • clearStickyFaults

      public static void clearStickyFaults​(int handle)
      Clears any PowerDistribution sticky faults.
      Parameters:
      handle - the module handle
      See Also:
      "HAL_ClearPowerDistributionStickyFaults"
    • getSwitchableChannel

      public static boolean getSwitchableChannel​(int handle)
      Returns true if switchable channel is powered on.

      This is a REV PDH-specific function. This function will no-op on CTRE PDP.

      Parameters:
      handle - the module handle
      Returns:
      the state of the switchable channel
      See Also:
      "HAL_GetPowerDistributionSwitchableChannel"
    • setSwitchableChannel

      public static void setSwitchableChannel​(int handle, boolean enabled)
      Power on/off switchable channel.

      This is a REV PDH-specific function. This function will no-op on CTRE PDP.

      Parameters:
      handle - the module handle
      enabled - true to turn on switchable channel
      See Also:
      "HAL_SetPowerDistributionSwitchableChannel"
    • getVoltageNoError

      public static double getVoltageNoError​(int handle)
      Gets the PowerDistribution input voltage without throwing any errors.
      Parameters:
      handle - the module handle
      Returns:
      the input voltage (volts)
      See Also:
      "HAL_GetPowerDistributionVoltage"
    • getChannelCurrentNoError

      public static double getChannelCurrentNoError​(int handle, int channel)
      Gets the current of a specific PowerDistribution channel without throwing any errors.
      Parameters:
      handle - the module handle
      channel - the channel
      Returns:
      the channel current (amps)
      See Also:
      "HAL_GetPowerDistributionChannelCurrent"
    • getTotalCurrentNoError

      public static double getTotalCurrentNoError​(int handle)
      Gets the total current of the PowerDistribution without throwing any errors.
      Parameters:
      handle - the module handle
      Returns:
      the total current (amps)
      See Also:
      "HAL_GetPowerDistributionTotalCurrent"
    • getSwitchableChannelNoError

      public static boolean getSwitchableChannelNoError​(int handle)
      Returns true if switchable channel is powered on without throwing any errors.

      This is a REV PDH-specific function. This function will no-op on CTRE PDP.

      Parameters:
      handle - the module handle
      Returns:
      the state of the switchable channel
      See Also:
      "HAL_GetPowerDistributionSwitchableChannel"
    • setSwitchableChannelNoError

      public static void setSwitchableChannelNoError​(int handle, boolean enabled)
      Power on/off switchable channel without throwing any errors.

      This is a REV PDH-specific function. This function will no-op on CTRE PDP.

      Parameters:
      handle - the module handle
      enabled - true to turn on switchable channel
      See Also:
      "HAL_SetPowerDistributionSwitchableChannel"
    • getFaultsNative

      public static int getFaultsNative​(int handle)
      Get the current faults of the PowerDistribution.
      Parameters:
      handle - the module handle
      Returns:
      the current faults
      See Also:
      "HAL_GetPowerDistributionFaults"
    • getFaults

      public static PowerDistributionFaults getFaults​(int handle)
      Get the current faults of the PowerDistribution.
      Parameters:
      handle - the module handle
      Returns:
      the current faults
      See Also:
      "HAL_GetPowerDistributionFaults"
    • getStickyFaultsNative

      public static int getStickyFaultsNative​(int handle)
      Gets the sticky faults of the PowerDistribution.
      Parameters:
      handle - the module handle
      Returns:
      the sticky faults
      See Also:
      "HAL_GetPowerDistributionStickyFaults"
    • getStickyFaults

      public static PowerDistributionStickyFaults getStickyFaults​(int handle)
      Gets the sticky faults of the PowerDistribution.
      Parameters:
      handle - the module handle
      Returns:
      the sticky faults
      See Also:
      "HAL_GetPowerDistributionStickyFaults"
    • getVersion

      public static PowerDistributionVersion getVersion​(int handle)
      Get the version of the PowerDistribution.
      Parameters:
      handle - the module handle
      Returns:
      version
      See Also:
      "HAL_GetPowerDistributionVersion"