CTREPCMSim

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

Bases: PneumaticsBaseSim

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

Overloaded function.

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

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

  1. __init__(self: wpilib.simulation._simulation.CTREPCMSim, module: typing.SupportsInt | typing.SupportsIndex) -> None

Constructs from a PCM module number (CAN ID).

Parameters:

module – module number

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

get_all_solenoid_outputs() int
get_closed_loop_enabled() bool

Check whether the closed loop compressor control is active.

Returns:

true if active

get_compressor_current() float

Read the compressor current.

Returns:

the current of the compressor connected to this module

get_compressor_on() bool
get_initialized() bool
get_pressure_switch() bool

Check the value of the pressure switch.

Returns:

the pressure switch value

get_solenoid_output(channel: SupportsInt | SupportsIndex) bool
register_closed_loop_enabled_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 closed loop state changes.

Parameters:
  • callback – the callback

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

Returns:

the CallbackStore object associated with this callback

register_compressor_current_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 compressor current 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_compressor_on_callback(callback: collections.abc.Callable[[str, hal._wpi_hal.Value], None], initial_notify: bool) wpilib.simulation._simulation.CallbackStore
register_initialized_callback(callback: collections.abc.Callable[[str, hal._wpi_hal.Value], None], initial_notify: bool) wpilib.simulation._simulation.CallbackStore
register_pressure_switch_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 pressure switch value changes.

Parameters:
  • callback – the callback

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

Returns:

the CallbackStore object associated with this callback

register_solenoid_output_callback(channel: SupportsInt | SupportsIndex, callback: collections.abc.Callable[[str, hal._wpi_hal.Value], None], initial_notify: bool) wpilib.simulation._simulation.CallbackStore
reset_data() None
set_all_solenoid_outputs(outputs: SupportsInt | SupportsIndex) None
set_closed_loop_enabled(closed_loop_enabled: bool) None

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

Parameters:

closed_loop_enabled – whether the control loop is active

set_compressor_current(compressor_current: SupportsFloat | SupportsIndex) None

Set the compressor current.

Parameters:

compressor_current – the new compressor current

set_compressor_on(compressor_on: bool) None
set_initialized(initialized: bool) None
set_pressure_switch(pressure_switch: bool) None

Set the value of the pressure switch.

Parameters:

pressure_switch – the new value

set_solenoid_output(channel: SupportsInt | SupportsIndex, solenoid_output: bool) None