PowerDistribution
- class wpilib.PowerDistribution(*args, **kwargs)
Bases:
Sendable
Class for getting voltage, current, temperature, power and energy from the CTRE Power Distribution Panel (PDP) or REV Power Distribution Hub (PDH).
Overloaded function.
__init__(self: wpilib._wpilib.PowerDistribution) -> None
Constructs a PowerDistribution object.
Detects the connected PDP/PDH using the default CAN ID (0 for CTRE and 1 for REV).
__init__(self: wpilib._wpilib.PowerDistribution, module: int, moduleType: wpilib._wpilib.PowerDistribution.ModuleType) -> None
Constructs a PowerDistribution object.
- Parameters:
module – The CAN ID of the PDP/PDH
moduleType – The type of module
- class Faults
Bases:
pybind11_object
- property Brownout
- property CanWarning
- property Channel0BreakerFault
- property Channel10BreakerFault
- property Channel11BreakerFault
- property Channel12BreakerFault
- property Channel13BreakerFault
- property Channel14BreakerFault
- property Channel15BreakerFault
- property Channel16BreakerFault
- property Channel17BreakerFault
- property Channel18BreakerFault
- property Channel19BreakerFault
- property Channel1BreakerFault
- property Channel20BreakerFault
- property Channel21BreakerFault
- property Channel22BreakerFault
- property Channel23BreakerFault
- property Channel2BreakerFault
- property Channel3BreakerFault
- property Channel4BreakerFault
- property Channel5BreakerFault
- property Channel6BreakerFault
- property Channel7BreakerFault
- property Channel8BreakerFault
- property Channel9BreakerFault
- property HardwareFault
- getBreakerFault(channel: int) bool
Gets whether there is a breaker fault at a specified channel.
- Parameters:
channel – Channel to check for faults.
- Returns:
If there is a breaker fault. @throws A ChannelIndexOutOfRange error if the given int is outside of the range supported by the hardware.
- class ModuleType(value: int)
Bases:
pybind11_object
Power distribution module type.
Members:
kCTRE : CTRE (Cross The Road Electronics) CTRE Power Distribution Panel (PDP).
kRev : REV Power Distribution Hub (PDH).
- kCTRE = <ModuleType.kCTRE: 1>
- kRev = <ModuleType.kRev: 2>
- property name
- property value
- class StickyFaults
Bases:
pybind11_object
- property Brownout
- property CanBusOff
- property CanWarning
- property Channel0BreakerFault
- property Channel10BreakerFault
- property Channel11BreakerFault
- property Channel12BreakerFault
- property Channel13BreakerFault
- property Channel14BreakerFault
- property Channel15BreakerFault
- property Channel16BreakerFault
- property Channel17BreakerFault
- property Channel18BreakerFault
- property Channel19BreakerFault
- property Channel1BreakerFault
- property Channel20BreakerFault
- property Channel21BreakerFault
- property Channel22BreakerFault
- property Channel23BreakerFault
- property Channel2BreakerFault
- property Channel3BreakerFault
- property Channel4BreakerFault
- property Channel5BreakerFault
- property Channel6BreakerFault
- property Channel7BreakerFault
- property Channel8BreakerFault
- property Channel9BreakerFault
- property HasReset
- getBreakerFault(channel: int) bool
Gets whether there is a sticky breaker fault at the specified channel.
- Parameters:
channel – Index to check for sticky faults.
- Returns:
True if there is a sticky breaker fault at the channel, otherwise false. @throws A ChannelIndexOutOfRange error if the provided channel is outside of the range supported by the hardware.
- class Version
Bases:
pybind11_object
- property FirmwareFix int
- property FirmwareMajor int
- property FirmwareMinor int
- property HardwareMajor int
- property HardwareMinor int
- property UniqueId int
- clearStickyFaults() None
Remove all of the fault flags on the PDP/PDH.
- getCurrent(channel: int) float
Query the current of a single channel of the PDP/PDH.
- Parameters:
channel – the channel to query (0-15 for PDP, 0-23 for PDH)
- Returns:
The current of the channel in Amperes
- getFaults() wpilib._wpilib.PowerDistribution.Faults
Returns the power distribution faults.
- Returns:
The power distribution faults.
- getModule() int
Gets module number (CAN ID).
- getStickyFaults() wpilib._wpilib.PowerDistribution.StickyFaults
Returns the power distribution sticky faults.
- Returns:
The power distribution sticky faults.
- getSwitchableChannel() bool
Gets whether the PDH switchable channel is turned on or off. Returns false with the CTRE PDP.
- Returns:
The output state of the PDH switchable channel
- getTemperature() float
Query the temperature of the PDP.
Not supported on the Rev PDH and returns 0.
- Returns:
The temperature in degrees Celsius
- getTotalCurrent() float
Query the total current of all monitored PDP/PDH channels.
- Returns:
The total current drawn from all channels in Amperes
- getTotalEnergy() float
Query the total energy drawn from the monitored PDP channels.
Not supported on the Rev PDH and returns 0.
- Returns:
The total energy drawn in Joules
- getTotalPower() float
Query the total power drawn from all monitored PDP channels.
Not supported on the Rev PDH and returns 0.
- Returns:
The total power drawn in Watts
- getType() wpilib._wpilib.PowerDistribution.ModuleType
Gets module type.
- getVersion() wpilib._wpilib.PowerDistribution.Version
- getVoltage() float
Query the input voltage of the PDP/PDH.
- Returns:
The input voltage in volts
- initSendable(builder: wpiutil._wpiutil.SendableBuilder) None
- kDefaultModule = -1
- resetTotalEnergy() None
Reset the total energy drawn from the PDP.
Not supported on the Rev PDH and does nothing.
@see PowerDistribution#GetTotalEnergy
- setSwitchableChannel(enabled: bool) None
Sets the PDH switchable channel on or off. Does nothing with the CTRE PDP.
- Parameters:
enabled – Whether to turn the PDH switchable channel on or off