PCMSim

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

Bases: pybind11_builtins.pybind11_object

Class to control a simulated Pneumatic Control Module (PCM).

Overloaded function.

  1. __init__(self: wpilib.simulation._simulation.PCMSim) -> None

Constructs with the default PCM module number (CAN ID).

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

Constructs from a PCM module number (CAN ID).

Parameters

module – module number

  1. __init__(self: wpilib.simulation._simulation.PCMSim, compressor: wpilib._wpilib.Compressor) -> None

Constructs from a Compressor object.

Parameters

compressor – Compressor connected to PCM to simulate

getAllSolenoidOutputs()int

Get the current value of all solenoid outputs.

Returns

the solenoid outputs (1 bit per output)

getClosedLoopEnabled()bool

Check whether the closed loop compressor control is active.

Returns

true if active

getCompressorCurrent()float

Read the compressor current.

Returns

the current of the compressor connected to this module

getCompressorInitialized()bool

Check whether the compressor has been initialized.

Returns

true if initialized

getCompressorOn()bool

Check if the compressor is on.

Returns

true if the compressor is active

getPressureSwitch()bool

Check the value of the pressure switch.

Returns

the pressure switch value

getSolenoidInitialized(channel: int)bool

Check if a solenoid has been initialized on a specific channel.

Parameters

channel – the channel to check

Returns

true if initialized

getSolenoidOutput(channel: int)bool

Check the solenoid output on a specific channel.

Parameters

channel – the channel to check

Returns

the solenoid output

registerClosedLoopEnabledCallback(callback: Callable[[str, HAL_Value], None], initialNotify: bool)wpilib.simulation.CallbackStore

Register a callback to be run whenever the closed loop state changes.

Parameters
  • callback – the callback

  • initialNotify – whether the callback should be called with the initial value

Returns

the CallbackStore object associated with this callback

registerCompressorCurrentCallback(callback: Callable[[str, HAL_Value], None], initialNotify: bool)wpilib.simulation.CallbackStore

Register a callback to be run whenever the compressor current changes.

Parameters
  • callback – the callback

  • initialNotify – whether to call the callback with the initial state

Returns

the CallbackStore object associated with this callback

registerCompressorInitializedCallback(callback: Callable[[str, HAL_Value], None], initialNotify: bool)wpilib.simulation.CallbackStore

Register a callback to be run when the compressor is initialized.

Parameters
  • callback – the callback

  • initialNotify – whether to run the callback with the initial state

Returns

the CallbackStore object associated with this callback

registerCompressorOnCallback(callback: Callable[[str, HAL_Value], None], initialNotify: bool)wpilib.simulation.CallbackStore

Register a callback to be run when the compressor activates.

Parameters
  • callback – the callback

  • initialNotify – whether to run the callback with the initial state

Returns

the CallbackStore object associated with this callback

registerPressureSwitchCallback(callback: Callable[[str, HAL_Value], None], initialNotify: bool)wpilib.simulation.CallbackStore

Register a callback to be run whenever the pressure switch value changes.

Parameters
  • callback – the callback

  • initialNotify – whether the callback should be called with the initial value

Returns

the CallbackStore object associated with this callback

registerSolenoidInitializedCallback(channel: int, callback: Callable[[str, HAL_Value], None], initialNotify: bool)wpilib.simulation.CallbackStore

Register a callback to be run when a solenoid is initialized on a channel.

Parameters
  • channel – the channel to monitor

  • callback – the callback

  • initialNotify – should the callback be run with the initial state

Returns

the CallbackStore object associated with this callback

registerSolenoidOutputCallback(channel: int, callback: Callable[[str, HAL_Value], None], initialNotify: bool)wpilib.simulation.CallbackStore

Register a callback to be run when the solenoid output on a channel changes.

Parameters
  • channel – the channel to monitor

  • callback – the callback

  • initialNotify – should the callback be run with the initial value

Returns

the CallbackStore object associated with this callback

resetData()None

Reset all simulation data for this object.

setAllSolenoidOutputs(outputs: int)None

Change all of the solenoid outputs.

Parameters

outputs – the new solenoid outputs (1 bit per output)

setClosedLoopEnabled(closedLoopEnabled: bool)None

Turn on/off the closed loop control of the compressor.

Parameters

closedLoopEnabled – whether the control loop is active

setCompressorCurrent(compressorCurrent: float)None

Set the compressor current.

Parameters

compressorCurrent – the new compressor current

setCompressorInitialized(compressorInitialized: bool)None

Define whether the compressor has been initialized.

Parameters

compressorInitialized – whether the compressor is initialized

setCompressorOn(compressorOn: bool)None

Set whether the compressor is active.

Parameters

compressorOn – the new value

setPressureSwitch(pressureSwitch: bool)None

Set the value of the pressure switch.

Parameters

pressureSwitch – the new value

setSolenoidInitialized(channel: int, solenoidInitialized: bool)None

Define whether a solenoid has been initialized on a specific channel.

Parameters
  • channel – the channel

  • solenoidInitialized – is there a solenoid initialized on that channel

setSolenoidOutput(channel: int, solenoidOutput: bool)None

Change the solenoid output on a specific channel.

Parameters
  • channel – the channel to check

  • solenoidOutput – the new solenoid output