PowerDistributionSim¶
- class wpilib.simulation.PowerDistributionSim(*args, **kwargs)¶
Bases:
pybind11_object
Class to control a simulated Power Distribution Panel (PowerDistribution).
Overloaded function.
__init__(self: wpilib.simulation._simulation.PowerDistributionSim, module: int = 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
- getAllCurrents(length: int) 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
- getCurrent(channel: int) float ¶
Read the current in one of the PowerDistribution channels.
- Parameters:
channel – the channel to check
- Returns:
the current in the given channel
- getInitialized() bool ¶
Check whether the PowerDistribution has been initialized.
- Returns:
true if initialized
- getTemperature() float ¶
Check the temperature of the PowerDistribution.
- Returns:
the PowerDistribution temperature
- getVoltage() float ¶
Check the PowerDistribution voltage.
- Returns:
the PowerDistribution voltage.
- registerCurrentCallback(channel: int, callback: Callable[[str, HAL_Value], None], initialNotify: 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
initialNotify – whether to call the callback with the initial state
- Returns:
the CallbackStore object associated with this callback
- registerInitializedCallback(callback: Callable[[str, HAL_Value], None], initialNotify: bool) wpilib.simulation._simulation.CallbackStore ¶
Register a callback to be run when the PowerDistribution is initialized.
- Parameters:
callback – the callback
initialNotify – whether to run the callback with the initial state
- Returns:
the CallbackStore object associated with this callback
- registerTemperatureCallback(callback: Callable[[str, HAL_Value], None], initialNotify: bool) wpilib.simulation._simulation.CallbackStore ¶
Register a callback to be run whenever the PowerDistribution temperature changes.
- Parameters:
callback – the callback
initialNotify – whether to call the callback with the initial state
- Returns:
the CallbackStore object associated with this callback
- registerVoltageCallback(callback: Callable[[str, HAL_Value], None], initialNotify: bool) wpilib.simulation._simulation.CallbackStore ¶
Register a callback to be run whenever the PowerDistribution voltage changes.
- Parameters:
callback – the callback
initialNotify – whether to call the callback with the initial state
- Returns:
the CallbackStore object associated with this callback
- resetData() None ¶
Reset all PowerDistribution simulation data.
- setAllCurrents(currents: float, length: int) 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
- setCurrent(channel: int, current: float) None ¶
Change the current in the given channel.
- Parameters:
channel – the channel to edit
current – the new current for the channel
- setInitialized(initialized: bool) None ¶
Define whether the PowerDistribution has been initialized.
- Parameters:
initialized – whether this object is initialized
- setTemperature(temperature: float) None ¶
Define the PowerDistribution temperature.
- Parameters:
temperature – the new PowerDistribution temperature
- setVoltage(voltage: float) None ¶
Set the PowerDistribution voltage.
- Parameters:
voltage – the new PowerDistribution voltage