Skip to content

Pulsar SDK

Groups and platforms

Use an ActuatorGroup for named actuators that share one execution domain and one control mode. Use a Platform to coordinate one or more groups across multiple CAN buses or across mixed physical and virtual domains.

Actuator group

from pulsar_sdk import (
    ActuatorGroup,
    ControlConfiguration,
    ControlParams,
    Mode,
    PcpOverCan,
    PulsarActuatorReal,
)

can = PcpOverCan()
arm = ActuatorGroup(
    "arm",
    {
        "shoulder": PulsarActuatorReal(can, 0x10),
        "elbow": PulsarActuatorReal(can, 0x11),
    },
)

with arm:
    arm.configure(ControlConfiguration(Mode.VELOCITY, control_rate_hz=50.0))
    arm.enable()
    arm.set_commands({
        "shoulder": {ControlParams.COMMAND: 0.2},
        "elbow": {ControlParams.COMMAND: -0.2},
    })
    arm.disable()
use std::collections::BTreeMap;

use pulsar_rs_sdk::{
    ActuatorGroup, ControlConfiguration, ControlParam, Mode, PcpOverCan,
    PulsarActuatorReal,
};

let can = PcpOverCan::new()?;
let arm = ActuatorGroup::new(
    "arm",
    [
        ("shoulder".into(), PulsarActuatorReal::on_can(&can, 0x10)?.actuator().clone()),
        ("elbow".into(), PulsarActuatorReal::on_can(&can, 0x11)?.actuator().clone()),
    ],
)?;

arm.connect()?;
let cfg = ControlConfiguration::new(Mode::Velocity, [], 0.0)?
    .with_control_rate_hz(50.0)?;
arm.configure(&cfg)?;
arm.enable()?;
arm.set_commands(&BTreeMap::from([
    ("shoulder".into(), BTreeMap::from([(ControlParam::Command, 0.2)])),
    ("elbow".into(), BTreeMap::from([(ControlParam::Command, -0.2)])),
]))?;
arm.disable()?;
arm.disconnect()?;

Group rules:

  • every member belongs to the same execution domain and uses the same control mode;
  • an actuator belongs to at most one active group;
  • member names and mappings are immutable for the lifetime of the group;
  • close() detaches members so they can be placed in a new group;
  • selected command batches may omit members (omitted members retain their previous command).

Platform

A Platform coordinates multiple groups as one robot:

from pulsar_sdk import ControlConfiguration, Mode, Platform

robot = Platform({
    "right_arm": right_arm,
    "left_arm": left_arm,
})

config = ControlConfiguration(Mode.IMPEDANCE, control_rate_hz=100.0)

with robot:
    robot.configure({
        "right_arm": config,
        "left_arm": config,
    })
    robot.enable()
    robot.disable()
use std::collections::BTreeMap;

use pulsar_rs_sdk::{ControlConfiguration, Mode, Platform};

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

let config = ControlConfiguration::new(Mode::Impedance, [], 0.0)?
    .with_control_rate_hz(100.0)?;

robot.connect()?;
robot.configure(&BTreeMap::from([
    ("right_arm".into(), config.clone()),
    ("left_arm".into(), config),
]))?;
robot.enable()?;
robot.disable()?;
robot.disconnect()?;

A platform:

  • coordinates connect, configure, sync, enable, disable, zero_position, clear_faults, resume, and disconnect across all groups;
  • spans multiple CAN buses or mixed physical + virtual domains;
  • propagates active safety across all groups and records per-member results in SafetyAttempt.member_attempts (using group.member names);
  • does not merge telemetry batches across domains or synchronize independent domain clocks.

Group and platform safety configuration (3.1.0 / 1.1.0)

Configure error-level safety actions or per-diagnostic overrides across an entire group or platform before connecting or while drive output is inactive:

from pulsar_sdk import ControllerErrorAction, DiagnosticFlag

robot.set_error_action(ControllerErrorAction.HOLD_POSITION)
robot.set_diagnostic_action(
    DiagnosticFlag.OVERTEMPERATURE,
    ControllerErrorAction.LIMIT_TORQUE,
)
use pulsar_rs_sdk::{ControllerErrorAction, DiagnosticFlag};

robot.set_error_action(ControllerErrorAction::HoldPosition)?;
robot.set_diagnostic_action(
    DiagnosticFlag::Overtemperature,
    ControllerErrorAction::LimitTorque,
)?;

disable() and switch_to() quiesce active control callbacks cleanly before changing actuator states, preventing late callback writes from racing with state transitions.

Lifecycle routing

When an actuator belongs to a group, lifecycle calls invoked on that actuator route through the group so one member cannot silently diverge from its cohort.