Package edu.wpi.first.hal
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
-
Field Summary
Fields Modifier and Type Field Description static int
AUTOMATIC_TYPE
static int
CTRE_TYPE
static int
DEFAULT_MODULE
static int
REV_TYPE
-
Constructor Summary
Constructors Constructor Description PowerDistributionJNI()
-
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 PowerDistribution.static double
getTotalPower(int handle)
Gets the total power of the PowerDistribution.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 PowerDistribution 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.
-
Field Details
-
AUTOMATIC_TYPE
- See Also:
- Constant Field Values
-
CTRE_TYPE
- See Also:
- Constant Field Values
-
REV_TYPE
- See Also:
- Constant Field Values
-
DEFAULT_MODULE
- See Also:
- Constant Field Values
-
-
Constructor Details
-
PowerDistributionJNI
public PowerDistributionJNI()
-
-
Method Details
-
initialize
Initializes a Power Distribution Panel.- Parameters:
module
- the module number to initializetype
- the type of module to initialize- Returns:
- the created PowerDistribution handle
- See Also:
- "HAL_InitializePowerDistribution"
-
free
Cleans a PowerDistribution module.- Parameters:
handle
- the module handle- See Also:
- "HAL_CleanPowerDistribution"
-
getModuleNumber
Gets the module number for a specific handle.- Parameters:
handle
- the module handle- Returns:
- the module number
- See Also:
- "HAL_GetPowerDistributionModuleNumber"
-
checkModule
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:
- "HAL_CheckPowerDistributionModule"
-
checkChannel
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:
- "HAL_CheckPowerDistributionChannel"
-
getType
Gets the type of PowerDistribution module.- Parameters:
handle
- the module handle- Returns:
- the type of module
- See Also:
- "HAL_GetPowerDistributionType"
-
getNumChannels
Gets the number of channels for this handle.- Parameters:
handle
- the handle- Returns:
- number of channels
- See Also:
- "HAL_GetPowerDistributionNumChannels"
-
getTemperature
Gets the temperature of the PowerDistribution.- Parameters:
handle
- the module handle- Returns:
- the module temperature (celsius)
- See Also:
- "HAL_GetPowerDistributionTemperature"
-
getVoltage
Gets the PowerDistribution input voltage.- Parameters:
handle
- the module handle- Returns:
- the input voltage (volts)
- See Also:
- "HAL_GetPowerDistributionVoltage"
-
getChannelCurrent
Gets the current of a specific PowerDistribution channel.- Parameters:
handle
- the module handlechannel
- the channel- Returns:
- the channel current (amps)
- See Also:
- "HAL_GetPowerDistributionChannelCurrent"
-
getAllCurrents
Gets the current of all channels on the PowerDistribution.The array must be large enough to hold all channels.
- Parameters:
handle
- the module handlecurrents
- the currents- See Also:
- "HAL_GetPowerDistributionAllChannelCurrents"
-
getTotalCurrent
Gets the total current of the PowerDistribution.- Parameters:
handle
- the module handle- Returns:
- the total current (amps)
- See Also:
- "HAL_GetPowerDistributionTotalCurrent"
-
getTotalPower
Gets the total power of the PowerDistribution.- Parameters:
handle
- the module handle- Returns:
- the total power (watts)
- See Also:
- "HAL_GetPowerDistributionTotalPower"
-
getTotalEnergy
Gets the total energy of the PowerDistribution.- Parameters:
handle
- the module handle- Returns:
- the total energy (joules)
- See Also:
- "HAL_GetPowerDistributionTotalEnergy"
-
resetTotalEnergy
Resets the PowerDistribution accumulated energy.- Parameters:
handle
- the module handle- See Also:
- "HAL_ClearPowerDistributionStickyFaults"
-
clearStickyFaults
Clears any PowerDistribution sticky faults.- Parameters:
handle
- the module handle- See Also:
- "HAL_ClearPowerDistributionStickyFaults"
-
getSwitchableChannel
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
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:
- "HAL_SetPowerDistributionSwitchableChannel"
-
getVoltageNoError
Gets the PowerDistribution input voltage without throwing any errors.- Parameters:
handle
- the module handle- Returns:
- the input voltage (volts)
- See Also:
- "HAL_GetPowerDistributionVoltage"
-
getChannelCurrentNoError
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:
- "HAL_GetPowerDistributionChannelCurrent"
-
getTotalCurrentNoError
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
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
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:
- "HAL_SetPowerDistributionSwitchableChannel"
-
getFaultsNative
Get the current faults of the PowerDistribution.- Parameters:
handle
- the module handle- Returns:
- the current faults
- See Also:
- "HAL_GetPowerDistributionFaults"
-
getFaults
Get the current faults of the PowerDistribution.- Parameters:
handle
- the module handle- Returns:
- the current faults
- See Also:
- "HAL_GetPowerDistributionFaults"
-
getStickyFaultsNative
Gets the sticky faults of the PowerDistribution.- Parameters:
handle
- the module handle- Returns:
- the sticky faults
- See Also:
- "HAL_GetPowerDistributionStickyFaults"
-
getStickyFaults
Gets the sticky faults of the PowerDistribution.- Parameters:
handle
- the module handle- Returns:
- the sticky faults
- See Also:
- "HAL_GetPowerDistributionStickyFaults"
-
getVersion
Get the version of the PowerDistribution.- Parameters:
handle
- the module handle- Returns:
- version
- See Also:
- "HAL_GetPowerDistributionVersion"
-