REVPHSim

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

Bases: pybind11_builtins.pybind11_object

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

Overloaded function.

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

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

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

Constructs from a PCM module number (CAN ID).

Parameters

module – module number

  1. __init__(self: wpilib.simulation._simulation.REVPHSim, pneumatics: wpilib._wpilib.PneumaticsBase) -> None

getAllSolenoidOutputs() int

Get the current value of all solenoid outputs.

Returns

the solenoid outputs (1 bit per output)

getCompressorConfigType() int

Check whether the closed loop compressor control is active.

Returns

compressor config type

getCompressorCurrent() float

Read the compressor current.

Returns

the current of the compressor connected to this module

getCompressorOn() bool

Check if the compressor is on.

Returns

true if the compressor is active

getInitialized() bool

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

Returns

true if initialized

getPressureSwitch() bool

Check the value of the pressure switch.

Returns

the pressure switch value

getSolenoidOutput(channel: int) bool

Check the solenoid output on a specific channel.

Parameters

channel – the channel to check

Returns

the solenoid output

registerCompressorConfigTypeCallback(callback: Callable[[str, HAL_Value], None], initialNotify: bool) wpilib.simulation._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._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

registerCompressorOnCallback(callback: Callable[[str, HAL_Value], None], initialNotify: bool) wpilib.simulation._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

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

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

Parameters
  • callback – the callback

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

Returns

the CallbackStore object associated with this callback

registerPressureSwitchCallback(callback: Callable[[str, HAL_Value], None], initialNotify: bool) wpilib.simulation._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

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

setCompressorConfigType(compressorConfigType: int) None

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

Parameters

compressorConfigType – compressor config type

setCompressorCurrent(compressorCurrent: float) None

Set the compressor current.

Parameters

compressorCurrent – the new compressor current

setCompressorOn(compressorOn: bool) None

Set whether the compressor is active.

Parameters

compressorOn – the new value

setInitialized(solenoidInitialized: bool) None

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

Parameters

solenoidInitialized – is there a solenoid initialized on that channel

setPressureSwitch(pressureSwitch: bool) None

Set the value of the pressure switch.

Parameters

pressureSwitch – the new value

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