PDPSim

class wpilib.simulation.PDPSim(*args, **kwargs)

Bases: pybind11_builtins.pybind11_object

Class to control a simulated Power Distribution Panel (PDP).

Overloaded function.

  1. __init__(self: wpilib.simulation._simulation.PDPSim, module: int = 0) -> None

Constructs from a PDP module number (CAN ID).

Parameters

module – module number

  1. __init__(self: wpilib.simulation._simulation.PDPSim, pdp: wpilib._wpilib.PowerDistributionPanel) -> None

Constructs from a PowerDistributionPanel object.

Parameters

pdp – PowerDistributionPanel to simulate

getAllCurrents()float

Read the current of all of the PDP channels.

Parameters

currents – output array; set to the current in each channel. The array must be big enough to hold all the PDP channels

getCurrent(channel: int)float

Read the current in one of the PDP channels.

Parameters

channel – the channel to check

Returns

the current in the given channel

getInitialized()bool

Check whether the PDP has been initialized.

Returns

true if initialized

getTemperature()float

Check the temperature of the PDP.

Returns

the PDP temperature

getVoltage()float

Check the PDP voltage.

Returns

the PDP voltage.

registerCurrentCallback(channel: int, callback: Callable[[str, HAL_Value], None], initialNotify: bool)wpilib.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.CallbackStore

Register a callback to be run when the PDP 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.CallbackStore

Register a callback to be run whenever the PDP 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.CallbackStore

Register a callback to be run whenever the PDP 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 PDP simulation data.

setAllCurrents(currents: float)None

Change the current in all of the PDP channels.

Parameters

currents – array containing the current values for each channel. The array must be big enough to hold all the PDP channels

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 PDP has been initialized.

Parameters

initialized – whether this object is initialized

setTemperature(temperature: float)None

Define the PDP temperature.

Parameters

temperature – the new PDP temperature

setVoltage(voltage: float)None

Set the PDP voltage.

Parameters

voltage – the new PDP voltage