bpod_core.bpod.Module

class bpod_core.bpod.Module

Bases: object

Represents a Bpod module with its configuration and event names.

__init__(_bpod, index, name, is_connected=False, firmware_version=None, n_events=15, _custom_event_names=<factory>) None
Parameters:
Return type:

None

load_serial_message(message_id, message_bytes) bool

Load a serial message targeting the module.

Serial messages are byte sequences targeting a specific module that can be triggered as output actions during a state machine run. Each message is identified by a message_id.

Parameters:
  • message_id (int) – Identifier for the message, in the range [0, 254].

  • message_bytes (bytes) – The message payload (1 to 3 bytes).

Returns:

True if the Bpod acknowledged the message, False otherwise.

Return type:

bool

Raises:
  • pydantic.ValidationError – If the provided parameters cannot be validated or coerced to the expected type.

  • ValueError – If message_id, or message_bytes length is out of range.

set_relay(enable) None

Enable or disable the serial relay for the module.

Parameters:

enable (bool) – True to enable the relay, False to disable it.

Return type:

None

firmware_version: int | None = None

The firmware version of the module.

index: int

The index of the module.

is_connected: bool = False

Whether the module is connected.

n_events: int = 15

The number of events assigned to the module.

name: str

The name of the module.

property relay: bool

The current state of the serial relay.