Pulsar Python SDK · 3.1.0
Python API reference
Public types exported by Pulsar Python SDK 3.1.0:
Start with Core concepts and workflow for object ownership and lifecycle. For the Rust SDK (1.1.0), see Rust API reference.
Browse the API
| Area | Contents |
|---|---|
| Domains | USB, CAN (including adapter status), and virtual execution domains |
| Actuators | Common, physical (>= 2.2.5 safety/watchdog), and virtual actuator APIs |
| Groups and platforms | Multi-actuator composition, callbacks, and safety |
| Records | Configuration, status, diagnostics, CAN adapter status, and results |
| Enumerations | Lifecycle, modes, diagnostics, parameters, telemetry, and capabilities |
| Exceptions | SDK exception hierarchy |
Diagrams
Type aliases and callbacks
Telemetry = dict[TelemetryItems, int | float]
TelemetryBatch = dict[str, Telemetry]
ControlValues = dict[ControlParams, float]
ControlBatch = Mapping[str, Mapping[ControlParams, float]]
ControlCallback = Callable[
[ControllerMetadata, TelemetryBatch],
ControlBatch | None,
]
DiagnosticCallback = Callable[
[ActuatorGroup, Actuator, ActuatorDiagnostic],
None,
]
Standalone actuator callbacks:
- Telemetry callback:
Callable[[int | None, Telemetry], None] - Diagnostic callback:
Callable[[Actuator, ActuatorDiagnostic], None]
Domains
ExecutionDomain
Base class for one transport or simulation clock. Owns the callback worker, telemetry watchdog, and connected actuator leases. Supports with.
- Properties:
capabilities: Capability,connection_state: ConnectionState,is_connected: bool - Methods:
supports(capability: Capability) -> boolconnect() -> Nonedisconnect() -> None— raisesResourceBusyErrorwhile connected actuators still use the domain.sync() -> FeatureResult/reset_telemetry_timestamp() -> FeatureResult
PcpOverCan
PCP domain for one USB-to-CAN adapter. Valid CAN addresses lie in 16..16382 and must be unique within the domain.
list_ports() -> tuple[str, ...]— list detected Pulsar serial ports.scan(start_address=16, end_address=255, *, timeout_s=0.12) -> tuple[int, ...]— broadcast one ping and return responding addresses in bounds.scan_devices(*, timeout_s=0.12) -> tuple[tuple[int, DeviceInfo], ...]— broadcast one ping and return(address, DeviceInfo)for every responding CAN actuator.read_adapter_info(*, timeout_s=0.1) -> DeviceInfo— query source/target zero for the adapter's own identity (cached per connection session).read_can_status(page: int, *, timeout_s=0.1) -> CanStatusPage— read exact version-1 adapter status page0,1, or2(adapter firmware>= 2.1.3).read_can_status_snapshot(*, timeout_s=0.1, generation_retries=2) -> CanAdapterStatus— read pages0–2with bounded generation-mismatch retries and100 mssnapshot-cadence caching.set_can_brs_enabled(enabled: bool) -> None— persist BRS policy or update connected actuators while output is inactive.- Helper function
uint32_counter_delta(current: int, previous: int) -> int— modulo-2^32counter difference within one connection session.
PcpOverUsb
Direct-USB domain for one actuator at address 0. Provides list_ports() -> tuple[str, ...].
VirtualWorld
VirtualWorld(
*,
time_step_hz: float = 20_000.0,
assets_path: str | Path | None = None,
logger: logging.Logger | None = None,
)
Deterministic 20,000 Hz (50 µs) digital-twin simulation domain.
- Attributes:
time_step_hz: float,time_step_s: float,assets_path: Path | None,simulation_time_s: float,simulation_step_count: int - Methods:
scan() -> tuple[str, ...]— list installed supported models (P90,P100,PULSE98-30G,PULSE98-55G,PULSE115-60G,PULSE115-110G).sync() -> FeatureResult— reset telemetry timestamps/counters without resetting plant physics.step(*, loads_by_address: Mapping[int, float] | None = None, loads_by_name: Mapping[str, float] | None = None) -> None— advance connected models to the next periodic telemetry event (or one50 µstick if periodic telemetry is disabled) and run due callbacks.
Actuators
Actuator
Actuator(
domain: ExecutionDomain,
*,
address: int | None,
capabilities: Capability = Capability.NONE,
diagnostic_actions: Mapping[DiagnosticFlag, ControllerErrorAction] | None = None,
diagnostic_damping: float | None = None,
logger: logging.Logger | None = None,
)
Backend-neutral actuator contract. Supports with (connects on enter; normal exit disconnects cleanly; exception exit applies state-aware safety).
- Properties:
domain,address,capabilities,connection_state,is_connected,status: ActuatorStatus,mode: Mode | None,info: DeviceInfo,dropped_telemetry_packets: int - Lifecycle & control:
connect(),disconnect(),configure(configuration),set_mode(mode),switch_to(state),request_state(state),sync() -> FeatureResult,enable(),disable(),set_command(command: float | Mapping[ControlParams, float]) - Telemetry & callbacks:
read_telemetry(items) -> Telemetry,set_telemetry_callback(callback | None),set_diagnostic_callback(callback | None) - Parameters & optional features:
read_parameters(parameters) -> dict[Parameters, int | float]set_parameters(parameters)— allowed while output is inactive, or duringDRIVE_ACTIVEwhen every key is one of the 9 limit parameters (TORQUE_LIMIT,POSITION_LIMIT_MIN/MAX,VELOCITY_LIMIT_MIN/MAX,POSITION_PROFILE_VELOCITY_MIN/MAX,VELOCITY_PROFILE_ACCELERATION_MIN/MAX). Physical calls accept at most 12 entries.set_torque_gain_preset(preset) -> FeatureResult,set_velocity_gain_preset(preset) -> FeatureResultzero_position() -> FeatureResult,identify() -> FeatureResult,set_address(address) -> FeatureResult,save_parameters() -> FeatureResult,enter_bootloader() -> FeatureResult,supports(capability) -> bool- Safety & recovery:
set_error_action(action: ControllerErrorAction)— configure uniform error-level safety action beforeconnect()or while output is inactive.set_diagnostic_action(flag: DiagnosticFlag, action: ControllerErrorAction)— configure per-flag diagnostic safety action while output is inactive.set_diagnostic_damping(damping: float | None)— configure damped-release damping while output is inactive.clear_faults() -> bool— transmitCLEAR_ERRORS, verify fresh diagnostics, clear retained faults without stopping an active firmware safety response.resume()/recover()— verify configured mode and authorize fresh commands afterclear_faults().override_diagnostic_safety(flags)— bypass SDK safety for currently active diagnostics (dangerous).
PulsarActuatorReal
PulsarActuatorReal(
domain: ExecutionDomain,
address: int,
*,
diagnostic_actions: Mapping[DiagnosticFlag, ControllerErrorAction] | None = None,
diagnostic_damping: float | None = None,
commands_timeout_ms: int | None = None,
commands_timeout_action: ControllerErrorAction | None = None,
auto_clear_faults: bool = False,
logger: logging.Logger | None = None,
)
Physical actuator over PcpOverUsb (address 0) or PcpOverCan (address 16..16382). Rejects VirtualWorld.
- On firmware
>= 2.2.5, connecting automatically appliesDAMPED_RELEASEand a500 mscommand freshness timeout unless overridden viacommands_timeout_ms/commands_timeout_actionorControlConfiguration.control_rate_hz. auto_clear_faults=False(default) preserves an active latched firmware safety response on connect.
PulsarActuatorVirtual
PulsarActuatorVirtual(
domain: VirtualWorld,
*,
model: str,
address: int | None = None,
diagnostic_actions: Mapping[DiagnosticFlag, ControllerErrorAction] | None = None,
diagnostic_damping: float | None = None,
logger: logging.Logger | None = None,
)
AUGUR Digital Twin actuator inside VirtualWorld. Omitted address is allocated monotonically.
Groups
ActuatorGroup
ActuatorGroup(
name: str,
actuators: Mapping[str, Actuator],
*,
telemetry_timeout_s: float = 0.1,
controller_timeout_s: float | None = 1.0,
controller_error_policy: ControllerErrorPolicy | None = None,
logger: logging.Logger | None = None,
)
Named cohort of actuators sharing one domain and one control mode. Supports with.
- Properties:
name,actuators,domain,connection_state,is_connected,controller_state,status: GroupStatus - Lifecycle:
connect(),disconnect(),close(disconnect_actuators=True),configure(configuration),set_mode(mode),switch_to(state),request_state(state),sync(),reset_telemetry_timestamp(),enable(),disable(),zero_position() - Commands & parameters:
set_commands(commands),read_parameters(parameters),set_parameters(parameters, *, unify=False),set_torque_gain_presets(presets, *, unify=False),set_velocity_gain_presets(presets, *, unify=False),save_parameters() - Callbacks, safety & recovery:
set_control_callback(cb | None),set_diagnostic_callback(cb | None),set_error_action(action),set_diagnostic_action(flag, action),clear_faults() -> bool,resume(),recover(),raise_for_host_error()
Platforms
Platform
Coordinates multiple named groups across one or more domains. Supports with.
- Properties:
groups,domains,connection_state,is_connected,status: dict[str, GroupStatus] - Lifecycle:
connect(),disconnect(),close(),configure(configurations),set_modes(modes),switch_to(state),request_state(state),sync() -> dict[ExecutionDomain, FeatureResult],reset_telemetry_timestamp(),enable(),disable(),zero_position() - Commands & parameters:
set_commands(commands),read_parameters(parameters),set_parameters(parameters, *, unify=False),set_torque_gain_presets(presets, *, unify=False),set_velocity_gain_presets(presets, *, unify=False),save_parameters() - Callbacks, safety & recovery:
set_control_callback(cb | None),set_diagnostic_callback(cb | None),set_error_action(action),set_diagnostic_action(flag, action),clear_faults() -> bool,resume(),recover(),raise_for_host_error()
Records
FeatureResult
FeatureResult(status: FeatureStatus, message: str = "", acknowledged: bool = False) — properties: supported: bool, ok: bool, unsupported: bool.
DeviceInfo
DeviceInfo(model, serial_number=None, firmware_version=None, model_version=None, control_model_crc=None, pcb_revision=None, mcu_uid=None)
ControlConfiguration
ControlConfiguration(mode: Mode, telemetry_items: tuple[TelemetryItems, ...] = (), telemetry_rate_hz: float = 0.0, control_rate_hz: float | None = None)
actual_telemetry_rate_hz: float— 20 kHz divider-derived rate.control_rate_hz:None(derive from telemetry rate /500 msdefault),0.0(disable command-freshness watchdog), or0.001..10_000.0Hz (sizes timeout tomax(50, ceil(4000 / hz))ms).
ControllerErrorPolicy
ControllerErrorPolicy(action=ControllerErrorAction.DEFAULT_SAFETY, damping=None, fallback=ControllerErrorAction.INIT_CONFIG)
When damping is None, damped release defaults to 10.0.
ControllerMetadata
ControllerMetadata(callback_count: int, elapsed_time_ms: int, mode: Mode, group_name: str)
ActuatorDiagnostic
ActuatorDiagnostic(address, flags, severity=None, device_timestamp_ms=None, raw_bits=0, unknown_bits=())
- Properties:
bit_numbers: tuple[int, ...],error_bit_numbers: tuple[int, ...](positions16–31are error-level).
SafetyMemberAttempt and SafetyAttempt
SafetyMemberAttempt(
name: str,
address: int | None,
action: ControllerErrorAction,
transmitted: bool,
acknowledged: bool,
guaranteed: bool,
message: str = "",
)
SafetyAttempt(
action: ControllerErrorAction,
transmitted: bool,
acknowledged: bool,
guaranteed: bool,
message: str = "",
member_attempts: tuple[SafetyMemberAttempt, ...] = (),
)
HostError and CanResetEvent
HostError(code: HostErrorCode, message: str, actuator_addresses: tuple[int | None, ...], safety_attempt: SafetyAttempt | None = None)CanResetEvent(host_monotonic_s: float, device_timestamp_ms: int | None = None)
ActuatorStatus and GroupStatus
ActuatorStatus(operating_state, last_operating_state, connection_state, health, recovery, diagnostic=None, host_error=None, safety_attempt=None, inhibited_by=None, can_reset_events=())— properties:can_configure,commands_effective,output_enabled.GroupStatus(connection_state, controller_state, operating_state, actuator_statuses=..., stale_names=(), stale_addresses=(), wait_reason=None, last_host_error=None, dropped_batches=0, timestamp_skew_ms=0)
CanAdapterStatus and CanStatusPage0 / 1 / 2
CanAdapterStatus(load: CanStatusPage0, can_counters: CanStatusPage1, usb_counters: CanStatusPage2, generations_match: bool)CanStatusPagebase fields:version,page,sequence,snapshot_uptime_ms,host_received_monotonic_s.CanStatusPage0:age_ms,flags,load_100ms_permille,load_1s_permille,scope,high_depth,low_depth,high_peak,low_peak,hardware_pending,high_oldest_ms,low_oldest_ms,tx_errors,rx_errors,health,nominal_bitrate,data_bitrate; properties:monitoring_enabled,short_valid,long_valid,short_incomplete,long_incomplete,saturated,stale,load_100ms_percent: float | None,load_1s_percent: float | None,host_age_ms: float.CanStatusPage1:rx_frames,tx_frames,full_admission_attempts,low_evictions,software_rx_drops,rx_oversize_drops,fifo0_full,fifo0_lost,fifo1_full,fifo1_lost,recoveries.CanStatusPage2:usb_rx_dropped_chunks,usb_tx_full_attempts,usb_tx_flushed_messages,host_not_ready_drops,serial_oversize_drops.
Enumerations
ConnectionState
DISCONNECTED=0, CONNECTING=1, CONNECTED=2, PARTIAL=3, DISCONNECTING=4, FAULTED=5
ControllerState
STOPPED=0, ACTIVE=1, WAITING_FOR_TELEMETRY=2, FAULTED=3
State
UNKNOWN=0, INIT_CONFIG=1, CONFIG_AND_TELEM=2, DRIVE_ACTIVE=3
HealthState
HEALTHY=0, HOST_FAULT=1, ACTUATOR_FAULT=2
RecoveryAction
NONE=0, RESUME=1, RECOVER=2, RECONNECT=3
Mode
TORQUE=5 (N·m), VELOCITY=6 (rad/s), POSITION=7 (rad), IMPEDANCE=8 (rad)
TorqueGainPreset and VelocityGainPreset
AGGRESSIVE=1, BALANCED=2, SOFT=3
FeatureStatus
OK=0, UNSUPPORTED=1, FAILED=2, UNCONFIRMED=3
ControllerErrorAction
DRIVE_INACTIVE=0, HOLD_POSITION=1, DAMPED_RELEASE=2, DEFAULT_SAFETY=3, INIT_CONFIG=4, LIMIT_TORQUE=5, DO_NOTHING=6
DiagnosticFlag
| Constant | Bit | Class |
|---|---|---|
OVERTEMPERATURE |
0 |
warning |
POSITION_REFERENCE_MAXIMUM |
2 |
warning |
POSITION_REFERENCE_MINIMUM |
3 |
warning |
VELOCITY_TELEMETRY_MAXIMUM |
4 |
warning |
BUS_VOLTAGE_OUT_OF_RANGE |
5 |
warning |
TORQUE_REFERENCE_MAXIMUM |
6 |
warning |
TORQUE_TELEMETRY_MAXIMUM |
7 |
warning |
POSITION_TELEMETRY_MAXIMUM |
8 |
warning |
POSITION_TELEMETRY_MINIMUM |
9 |
warning |
CONTROL_OVERRUN |
12 |
warning |
COMMUNICATION_OVERRUN |
13 |
warning |
CAN_RESET |
14 |
warning |
COMMAND_TIMEOUT |
15 |
warning |
CURRENT_MAXIMUM |
16 |
error |
INVALID_LIMITS |
17 |
error |
CRITICAL_LATCHED |
18 |
error |
BUS_VOLTAGE_CRITICAL_RANGE |
29 |
error |
INTERNAL_ENCODER_ERROR |
30 |
error |
EXTERNAL_ENCODER_ERROR |
31 |
error |
DiagnosticSeverity
INFO=0, WARNING=1, ERROR=2
HostErrorCode
CONTROLLER_EXCEPTION=1, INVALID_CONTROLLER_OUTPUT=2, CONNECTION_LOST=3, SAFETY_ACTION_FAILED=4, STALE_TELEMETRY=5, COMMAND_TRANSMISSION_FAILED=6, CONTROLLER_TIMEOUT=7
Parameters
| Constant | ID | Writable in DRIVE_ACTIVE? |
Meaning |
|---|---|---|---|
IMPEDANCE_DAMPING |
1 |
No | Impedance damping gain |
IMPEDANCE_STIFFNESS |
2 |
No | Impedance stiffness gain |
TORQUE_LIMIT |
4 |
Yes | Torque limit in N·m (+inf = unbounded) |
POSITION_LIMIT_MAX |
5 |
Yes | Max position in rad |
POSITION_LIMIT_MIN |
6 |
Yes | Min position in rad |
VELOCITY_LIMIT_MAX |
7 |
Yes | Max velocity in rad/s |
VELOCITY_LIMIT_MIN |
8 |
Yes | Min velocity in rad/s |
POSITION_PROFILE_VELOCITY_MAX |
9 |
Yes | Positive position-profile velocity limit |
POSITION_PROFILE_VELOCITY_MIN |
10 |
Yes | Negative position-profile velocity limit |
VELOCITY_PROFILE_ACCELERATION_MAX |
11 |
Yes | Positive velocity-profile acceleration limit |
VELOCITY_PROFILE_ACCELERATION_MIN |
12 |
Yes | Negative velocity-profile acceleration limit |
VELOCITY_KP |
13 |
No | Velocity-loop proportional gain |
VELOCITY_KI |
14 |
No | Velocity-loop integral gain |
POSITION_KP |
15 |
No | Position-loop proportional gain |
MODE |
48 |
Use set_mode() |
Current control mode |
COMMAND |
49 |
Use set_command() |
Current primary command |
TORQUE_GAIN_PRESET |
64 |
Use preset method | Torque gain preset |
VELOCITY_GAIN_PRESET |
65 |
Use preset method | Velocity gain preset |
RATED_VELOCITY_RAD_S |
66 |
Read-only | Rated velocity |
MAXIMUM_TORQUE_NM |
67 |
Read-only | Maximum actuator torque |
DIRECTION_INVERTED |
68 |
No | Direction inversion flag |
FEEDFORWARD_GAIN |
69 |
No | Feedforward gain |
VELOCITY_FILTER_CUTOFF |
70 |
No | Velocity filter cutoff |
CURRENT_FILTER_CUTOFF |
71 |
No | Current filter cutoff |
FIRMWARE_VERSION |
128 |
Read-only | Encoded firmware version |
PCP_ADDRESS |
129 |
Use set_address() |
PCP address |
SERIAL_NUMBER |
130 |
Read-only | Serial number |
DEVICE_MODEL |
131 |
Read-only | Encoded device model |
CONTROL_MODEL_CRC |
132 |
Read-only | Control-model CRC |
CAN_BRS_ENABLED |
133 |
Prefer set_can_brs_enabled() |
CAN BRS flag |
TELEMETRY_RATE_HZ |
134 |
Use configure() |
Effective periodic telemetry rate |
COMMAND_TIMEOUT_S |
135 |
No | Firmware command freshness timeout (s) |
CRITICAL_ERROR_FALLBACK |
136 |
No | Firmware critical error fallback selection |
TelemetryItems
Canonical signals only (duplicate *_ACTUAL aliases removed in 3.1.0):
INTERNAL_ENCODER_POSITION=65, INTERNAL_ENCODER_RAW=66, EXTERNAL_ENCODER_POSITION=67, EXTERNAL_ENCODER_RAW=68, VELOCITY=69, PHASE_A_CURRENT=70, PHASE_B_CURRENT=71, PHASE_C_CURRENT=72, TORQUE_SENSOR_MEASUREMENT=73, TORQUE_SENSOR_RAW=74, POSITION_COMMANDED=75, POSITION=76, VELOCITY_COMMANDED=77, D_AXIS_CURRENT_COMMANDED=79, D_AXIS_CURRENT_ACTUAL=80, Q_AXIS_CURRENT_COMMANDED=81, Q_AXIS_CURRENT_ACTUAL=82, D_AXIS_VOLTAGE_COMMANDED=83, Q_AXIS_VOLTAGE_COMMANDED=84, TORQUE_COMMANDED=85, TORQUE_ESTIMATE=86, PHASE_A_VOLTAGE_COMMANDED=87, PHASE_B_VOLTAGE_COMMANDED=88, PHASE_C_VOLTAGE_COMMANDED=89, BUS_POWER=90, BUS_CURRENT=91, THREE_PHASE_ELECTRICAL_POWER=92, MECHANICAL_POWER=93, INVERTER_EFFICIENCY=94, MOTOR_EFFICIENCY=95, INTERNAL_ENCODER_ERROR_COUNT=96, EXTERNAL_ENCODER_ERROR_COUNT=97, CONTROL_OVERRUN_COUNT=98, DIAGNOSTIC_FLAGS=99, TIMESTAMP_MS=103, PERIODIC_MESSAGE_COUNT=104, BUS_VOLTAGE=112, PCB_TEMPERATURE=113, MOTOR_TEMPERATURE=114, INTERNAL_POSITION_ACTUAL=115.
ControlParams
COMMAND=4 (all modes), D_AXIS_CURRENT_KP=193 / D_AXIS_CURRENT_KI=195 / Q_AXIS_CURRENT_KP=194 / Q_AXIS_CURRENT_KI=196 (TORQUE), FEEDFORWARD_GAIN=197 (VELOCITY, POSITION, IMPEDANCE), VELOCITY_KI=198 / VELOCITY_KP=199 (VELOCITY, POSITION), TORQUE_FEEDFORWARD=200 (VELOCITY, POSITION, IMPEDANCE), POSITION_KP=201 (POSITION), IMPEDANCE_STIFFNESS=202 / IMPEDANCE_DAMPING=203 / IMPEDANCE_INERTIA=204 / IMPEDANCE_VELOCITY_COMMANDED=205 / IMPEDANCE_ACCELERATION_COMMANDED=206 (IMPEDANCE).
Capability
NONE=0, IDENTIFY=1<<0, PERSIST_PARAMETERS=1<<1, BOOTLOADER=1<<2, EXPLICIT_STEP=1<<3, EXTERNAL_LOAD=1<<4, DISCOVERY=1<<5, COMMAND_TIMEOUT=1<<6, CRITICAL_ERROR_FALLBACK=1<<7, CLEAR_ERRORS=1<<8, ADDRESS_CHANGE=1<<9, CAN_BRS=1<<10.
Exceptions
SdkError— base class for SDK runtime errors.ConnectionFailedError— connect, disconnect, rollback, or safe shutdown failure.InvalidLifecycleError— operation disallowed in the current lifecycle state.ResourceBusyError— shared domain or callback currently in use.ControllerFaultError— retained controller/host fault blocks the operation.CommandTransmissionError(message, successful_members=())— sequential batch write failed;successful_membersreports completed members.UnsupportedOperationError— backend or model does not support the operation.