Skip to content

Pulsar SDK

Core concepts and workflow

Both Pulsar Python SDK (3.1.0) and Pulsar Rust SDK (1.1.0) use the same four layers: an execution domain owns communication or simulation time, an actuator represents one physical or virtual device, a group coordinates actuators that run together, and a platform coordinates groups across a complete robot.

You only need the layers that match the application. A single actuator can be used directly; groups and platforms scale naturally as the system grows.

Object model

Pulsar SDK class model

Concept Responsibility Important boundary
ExecutionDomain Owns one transport or simulation clock, its callback worker, telemetry watchdog, and connected actuator leases. One direct USB link, one USB-to-CAN adapter, or one virtual simulation clock.
Actuator Represents one physical or virtual actuator and exposes lifecycle, commands, telemetry, parameters, and status. Belongs to exactly one domain and at most one active group.
ActuatorGroup Gives stable names to actuators controlled in one mode and one domain. Coordinates lifecycle, complete telemetry batches, callbacks, and group safety. Every member must share the same domain and control mode.
Platform Coordinates named groups as one application-level robot. Connects, configures, enables, disables, and recovers groups together. May span domains, but does not merge their telemetry or synchronize their clocks.

Execution domains are resource boundaries

Domain Owns
PcpOverUsb one direct-USB actuator at address 0
PcpOverCan one USB-to-CAN adapter and the actuator addresses on its bus
VirtualWorld one deterministic 20 kHz simulation clock and its virtual actuators

A connected actuator holds a lease on its domain. Disconnecting a domain while an actuator still uses it fails with ResourceBusyError; disconnect or close actuators/groups first.

Physical and virtual actuators

PulsarActuatorReal and PulsarActuatorVirtual expose the same lifecycle, modes, commands, grouping, callbacks, parameters, and status model. Switching a controller between simulation and physical hardware only changes domain and actuator construction.

Physical actuator Virtual actuator
Communicates through PcpOverUsb or PcpOverCan. Runs an AUGUR Digital Twin model inside VirtualWorld.
State changes complete after the requested state is observed on hardware. State and telemetry advance deterministically when VirtualWorld steps.
Uses address 0 on USB or a unique CAN address (16..16382). Uses a unique address (0..16382) within its VirtualWorld.
Firmware >= 2.2.5 enforces active safety actions and command freshness watchdogs on-device. Simulation time and external shaft loads are owned by the application.

Backend-specific operations are exposed through Capability and FeatureResult so applications can inspect support cleanly.

Groups and platforms

Use ActuatorGroup for actuators sharing one domain and mode, and Platform to coordinate multiple groups across CAN buses or across mixed real and virtual domains:

from pulsar_sdk import ActuatorGroup, PcpOverCan, Platform, PulsarActuatorReal

right_can = PcpOverCan("<right-adapter-port>")
left_can = PcpOverCan("<left-adapter-port>")

right_arm = ActuatorGroup(
    "right_arm",
    {
        "shoulder": PulsarActuatorReal(right_can, address=23),
        "elbow": PulsarActuatorReal(right_can, address=24),
    },
)
left_arm = ActuatorGroup(
    "left_arm",
    {
        "shoulder": PulsarActuatorReal(left_can, address=23),
        "elbow": PulsarActuatorReal(left_can, address=24),
    },
)

robot = Platform({"right_arm": right_arm, "left_arm": left_arm})
use pulsar_rs_sdk::{ActuatorGroup, PcpOverCan, Platform, PulsarActuatorReal};

let right_can = PcpOverCan::with_port("<right-adapter-port>")?;
let left_can = PcpOverCan::with_port("<left-adapter-port>")?;

let right_arm = ActuatorGroup::new(
    "right_arm",
    [
        ("shoulder".into(), PulsarActuatorReal::on_can(&right_can, 23)?.actuator().clone()),
        ("elbow".into(), PulsarActuatorReal::on_can(&right_can, 24)?.actuator().clone()),
    ],
)?;
let left_arm = ActuatorGroup::new(
    "left_arm",
    [
        ("shoulder".into(), PulsarActuatorReal::on_can(&left_can, 23)?.actuator().clone()),
        ("elbow".into(), PulsarActuatorReal::on_can(&left_can, 24)?.actuator().clone()),
    ],
)?;

let robot = Platform::new([
    ("right_arm".into(), right_arm),
    ("left_arm".into(), left_arm),
])?;

Repeated actuator addresses (23, 24) are valid because each CAN adapter is an independent domain.

Core workflow

Constructors validate names, addresses, and membership without performing I/O. Connection and digital-twin model loading happen when connect() is called (or a Python with context manager is entered).

Pulsar SDK runtime ownership model

  1. Construct domains, actuators, groups, and optionally a platform.
  2. Optionally set safety error actions (set_error_action / set_diagnostic_action).
  3. Connect (or enter a Python with block).
  4. Configure control mode, periodic telemetry, and control_rate_hz.
  5. Optionally zero position (zero_position) and write parameters.
  6. Register telemetry, control, or diagnostic callbacks.
  7. Enable drive output (enable).
  8. Stream commands or let the control callback run.
  9. Disable (disable) before changing mode, writing non-limit parameters, or shutting down.
  10. Disconnect (disconnect) or exit the context manager.

Configuration

from pulsar_sdk import ControlConfiguration, Mode, TelemetryItems

configuration = ControlConfiguration(
    mode=Mode.POSITION,
    telemetry_items=(
        TelemetryItems.POSITION,
        TelemetryItems.VELOCITY,
        TelemetryItems.TIMESTAMP_MS,
    ),
    telemetry_rate_hz=500,
    control_rate_hz=500,  # sizes firmware command timeout automatically
)
use pulsar_rs_sdk::{ControlConfiguration, Mode, TelemetryItem};

let configuration = ControlConfiguration::new(
    Mode::Position,
    [
        TelemetryItem::Position,
        TelemetryItem::Velocity,
        TelemetryItem::TimestampMs,
    ],
    500.0,
)?
.with_control_rate_hz(500.0)?; // sizes firmware command timeout automatically
  • At most 12 unique telemetry items may be configured.
  • telemetry_rate_hz is 0 (disabled) or 1..10_000 Hz.
  • control_rate_hz sizes the firmware command freshness watchdog to ceil(4000 / hz) ms (minimum 50 ms), or pass 0.0 to disable command-timeout latching for non-streaming/one-shot use.
  • Configuration never enables drive output.

Commands and units

Mode Primary command unit
TORQUE / Mode::Torque N·m
VELOCITY / Mode::Velocity rad/s
POSITION / Mode::Position rad
IMPEDANCE / Mode::Impedance rad (with optional impedance fields)

All physical values use SI units unless a suffix states otherwise (_ms, _hz).

Lifecycle ownership

When an actuator belongs to an ActuatorGroup, lifecycle calls (configure, enable, disable, clear_faults, resume, recover) route through the group so one member cannot silently desynchronize shared group state.

Shutdown and drop behavior

  • disable() quiesces active callbacks cleanly and moves to CONFIG_AND_TELEM (drive output off, runtime telemetry still available).
  • disconnect() moves cleanly to INIT_CONFIG before releasing the transport (while preserving an active latched firmware safety response if faulted).
  • State-aware drop/exit (3.1.0 / 1.1.0): if a connected handle is dropped or a Python with block exits on an unhandled exception while in DRIVE_ACTIVE, the SDK applies the configured firmware safety action (preserving the safety latch). While in CONFIG_AND_TELEM, it returns cleanly to INIT_CONFIG. Always prefer explicit disable() + disconnect() for normal shutdown.

Warning

If communication is lost, the physical actuator state is reported as UNKNOWN. Software cannot confirm unreachable hardware state; firmware >= 2.2.5 provides on-device command-timeout fallback (DampedRelease by default) to protect the hardware independently of the host.

Next steps