PowerDistributionSim
- class wpilib.simulation.PowerDistributionSim(*args, **kwargs)
Bases:
pybind11_objectClass to control a simulated Power Distribution Panel (PowerDistribution).
Overloaded function.
__init__(self: wpilib.simulation._simulation.PowerDistributionSim, module: typing.SupportsInt | typing.SupportsIndex = 0) -> None
Constructs from a PowerDistribution module number (CAN ID).
- Parameters:
module – module number
__init__(self: wpilib.simulation._simulation.PowerDistributionSim, pdp: wpilib._wpilib.PowerDistribution) -> None
Constructs from a PowerDistribution object.
- Parameters:
pdp – PowerDistribution to simulate
- get_all_currents(length: SupportsInt | SupportsIndex) float
Read the current of all of the PowerDistribution channels.
- Parameters:
currents – output array; set to the current in each channel. The array must be big enough to hold all the PowerDistribution channels
length – length of output array
- get_current(channel: SupportsInt | SupportsIndex) float
Read the current in one of the PowerDistribution channels.
- Parameters:
channel – the channel to check
- Returns:
the current in the given channel
- get_initialized() bool
Check whether the PowerDistribution has been initialized.
- Returns:
true if initialized
- get_temperature() float
Check the temperature of the PowerDistribution.
- Returns:
the PowerDistribution temperature
- get_voltage() float
Check the PowerDistribution voltage.
- Returns:
the PowerDistribution voltage.
- register_current_callback(channel: SupportsInt | SupportsIndex, callback: collections.abc.Callable[[str, hal._wpi_hal.Value], None], initial_notify: bool) wpilib.simulation._simulation.CallbackStore
Register a callback to be run whenever the current of a specific channel changes.
- Parameters:
channel – the channel
callback – the callback
initial_notify – whether to call the callback with the initial state
- Returns:
the CallbackStore object associated with this callback
- register_initialized_callback(callback: collections.abc.Callable[[str, hal._wpi_hal.Value], None], initial_notify: bool) wpilib.simulation._simulation.CallbackStore
Register a callback to be run when the PowerDistribution is initialized.
- Parameters:
callback – the callback
initial_notify – whether to run the callback with the initial state
- Returns:
the CallbackStore object associated with this callback
- register_temperature_callback(callback: collections.abc.Callable[[str, hal._wpi_hal.Value], None], initial_notify: bool) wpilib.simulation._simulation.CallbackStore
Register a callback to be run whenever the PowerDistribution temperature changes.
- Parameters:
callback – the callback
initial_notify – whether to call the callback with the initial state
- Returns:
the CallbackStore object associated with this callback
- register_voltage_callback(callback: collections.abc.Callable[[str, hal._wpi_hal.Value], None], initial_notify: bool) wpilib.simulation._simulation.CallbackStore
Register a callback to be run whenever the PowerDistribution voltage changes.
- Parameters:
callback – the callback
initial_notify – whether to call the callback with the initial state
- Returns:
the CallbackStore object associated with this callback
- reset_data() None
Reset all PowerDistribution simulation data.
- set_all_currents(currents: SupportsFloat | SupportsIndex, length: SupportsInt | SupportsIndex) None
Change the current in all of the PowerDistribution channels.
- Parameters:
currents – array containing the current values for each channel. The array must be big enough to hold all the PowerDistribution channels
length – length of array
- set_current(channel: SupportsInt | SupportsIndex, current: SupportsFloat | SupportsIndex) None
Change the current in the given channel.
- Parameters:
channel – the channel to edit
current – the new current for the channel
- set_initialized(initialized: bool) None
Define whether the PowerDistribution has been initialized.
- Parameters:
initialized – whether this object is initialized
- set_temperature(temperature: SupportsFloat | SupportsIndex) None
Define the PowerDistribution temperature.
- Parameters:
temperature – the new PowerDistribution temperature
- set_voltage(voltage: SupportsFloat | SupportsIndex) None
Set the PowerDistribution voltage.
- Parameters:
voltage – the new PowerDistribution voltage