Class PowerDistributionJNI
java.lang.Object
org.wpilib.hardware.hal.JNIWrapper
org.wpilib.hardware.hal.PowerDistributionJNI
-
Nested Class Summary
Nested classes/interfaces inherited from class JNIWrapper
JNIWrapper.Helper -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intAutomatically determines the module type.static final intCTRE (Cross The Road Electronics) Power Distribution Panel (PDP).static final intUse the default module number for the selected module type.static final intREV Power Distribution Hub (PDH). -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancheckChannel(int handle, int channel) Checks if a PowerDistribution channel is valid.static booleancheckModule(int module, int type) Checks if a PowerDistribution module is valid.static voidclearStickyFaults(int handle) Clears any PowerDistribution sticky faults.static voidfree(int handle) Cleans a PowerDistribution module.static double[]getAllCurrents(int handle) Gets the current of all channels on the PowerDistribution.static double[]getAllCurrentsNoError(int handle) Gets the current of all channels on the PowerDistribution.static doublegetChannelCurrent(int handle, int channel) Gets the current of a specific PowerDistribution channel.static doublegetChannelCurrentNoError(int handle, int channel) Gets the current of a specific PowerDistribution channel without throwing any errors.static PowerDistributionFaultsgetFaults(int handle) Get the current faults of the PowerDistribution.static intgetFaultsNative(int handle) Get the current faults of the PowerDistribution.static intgetModuleNumber(int handle) Gets the module number for a specific handle.static intgetNumChannels(int handle) Gets the number of channels for this handle.getStickyFaults(int handle) Gets the sticky faults of the PowerDistribution.static intgetStickyFaultsNative(int handle) Gets the sticky faults of the PowerDistribution.static booleangetSwitchableChannel(int handle) Returns true if switchable channel is powered on.static booleangetSwitchableChannelNoError(int handle) Returns true if switchable channel is powered on without throwing any errors.static doublegetTemperature(int handle) Gets the temperature of the PowerDistribution.static doublegetTotalCurrent(int handle) Gets the total current of the PowerDistribution.static doublegetTotalCurrentNoError(int handle) Gets the total current of the PowerDistribution without throwing any errors.static doublegetTotalEnergy(int handle) Gets the total energy of the Power Distribution Panel.static doublegetTotalPower(int handle) Gets the total power of the Power Distribution Panel.static intgetType(int handle) Gets the type of PowerDistribution module.static PowerDistributionVersiongetVersion(int handle) Get the version of the PowerDistribution.static doublegetVoltage(int handle) Gets the PowerDistribution input voltage.static doublegetVoltageNoError(int handle) Gets the PowerDistribution input voltage without throwing any errors.static intinitialize(int busId, int module, int type) Initializes a Power Distribution Panel.static voidresetTotalEnergy(int handle) Resets the Power Distribution Panel accumulated energy.static voidsetSwitchableChannel(int handle, boolean enabled) Power on/off switchable channel.static voidsetSwitchableChannelNoError(int handle, boolean enabled) Power on/off switchable channel without throwing any errors.Methods inherited from class JNIWrapper
forceLoad, suppressUnused
-
Field Details
-
AUTOMATIC_TYPE
public static final int AUTOMATIC_TYPEAutomatically determines the module type.- See Also:
-
CTRE_TYPE
public static final int CTRE_TYPECTRE (Cross The Road Electronics) Power Distribution Panel (PDP).- See Also:
-
REV_TYPE
public static final int REV_TYPEREV Power Distribution Hub (PDH).- See Also:
-
DEFAULT_MODULE
public static final int DEFAULT_MODULEUse the default module number for the selected module type.- See Also:
-
-
Method Details
-
initialize
public static int initialize(int busId, int module, int type) Initializes a Power Distribution Panel.- Parameters:
busId- the bus idmodule- the module number to initializetype- the type of module to initialize- Returns:
- the created PowerDistribution handle
- See Also:
-
free
public static void free(int handle) Cleans a PowerDistribution module.- Parameters:
handle- the module handle- See Also:
-
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:
-
checkModule
public static boolean checkModule(int module, int type) Checks if a PowerDistribution module is valid.- Parameters:
module- the module to checktype- the type of module- Returns:
- true if the module is valid, otherwise false
- See Also:
-
checkChannel
public static boolean checkChannel(int handle, int channel) Checks if a PowerDistribution channel is valid.- Parameters:
handle- the module handlechannel- the channel to check- Returns:
- true if the channel is valid, otherwise false
- See Also:
-
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:
-
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:
-
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:
-
getVoltage
public static double getVoltage(int handle) Gets the PowerDistribution input voltage.- Parameters:
handle- the module handle- Returns:
- the input voltage (volts)
- See Also:
-
getChannelCurrent
public static double getChannelCurrent(int handle, int channel) Gets the current of a specific PowerDistribution channel.- Parameters:
handle- the module handlechannel- the channel- Returns:
- the channel current (amps)
- See Also:
-
getAllCurrents
public static double[] getAllCurrents(int handle) Gets the current of all channels on the PowerDistribution.The array must be large enough to hold all channels.
- Parameters:
handle- the module handle- Returns:
- the currents
- See Also:
-
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:
-
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:
-
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:
-
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:
-
clearStickyFaults
public static void clearStickyFaults(int handle) Clears any PowerDistribution sticky faults.- Parameters:
handle- the module handle- See Also:
-
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:
-
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 handleenabled- true to turn on switchable channel- See Also:
-
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:
-
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 handlechannel- the channel- Returns:
- the channel current (amps)
- See Also:
-
getAllCurrentsNoError
public static double[] getAllCurrentsNoError(int handle) Gets the current of all channels on the PowerDistribution.- Parameters:
handle- the module handle- Returns:
- the currents
- See Also:
-
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:
-
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:
-
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 handleenabled- true to turn on switchable channel- See Also:
-
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:
-
getFaults
Get the current faults of the PowerDistribution.- Parameters:
handle- the module handle- Returns:
- the current faults
- See Also:
-
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:
-
getStickyFaults
Gets the sticky faults of the PowerDistribution.- Parameters:
handle- the module handle- Returns:
- the sticky faults
- See Also:
-
getVersion
Get the version of the PowerDistribution.- Parameters:
handle- the module handle- Returns:
- version
- See Also:
-