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
- class ModuleType(value: int)¶
Bases:
pybind11_object
Members:
kCTRE
kRev
- kCTRE = <ModuleType.kCTRE: 1>¶
- kRev = <ModuleType.kRev: 2>¶
- property name¶
- property value¶
- class StickyFaults¶
Bases:
pybind11_object
- class Version¶
Bases:
pybind11_object
- property FirmwareFix¶
- property FirmwareMajor¶
- property FirmwareMinor¶
- property HardwareMajor¶
- property HardwareMinor¶
- property UniqueId¶
- 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 ¶
- getModule() int ¶
Gets module number (CAN ID).
- getStickyFaults() wpilib._wpilib.PowerDistribution.StickyFaults ¶
- 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/PDH.
- 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/PDH channels.
- Returns:
The total energy drawn in Joules
- getTotalPower() float ¶
Query the total power drawn from all monitored PDP/PDH channels.
- 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/PDH.
@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