Skip to content

Quickstart

Virtual actuators with Pulsar SDK

Run a PULSE115-60G virtual actuator using AUGUR Digital Twin assets in Python (3.1.0) or Rust (1.1.0). No physical actuator, power supply, USB cable, or CAN adapter is required.

Install the SDK and assets

Install Pixi first, then create a project environment:

pixi init pulsar-virtual-quickstart
cd pulsar-virtual-quickstart
pixi workspace channel add --prepend https://prefix.dev/pulsarhri/pulsar-forge
pixi add pulsar-sdk pulsar-assets
pixi init pulsar-virtual-quickstart
cd pulsar-virtual-quickstart
pixi workspace channel add --prepend https://prefix.dev/pulsarhri/pulsar-forge
pixi add pulsar-rs-sdk pulsar-assets

Add pulsar-rs-sdk to Cargo.toml (see Install for Linux, Windows, and standalone Cargo archive paths):

[dependencies]
pulsar-rs-sdk = { path = ".pixi/envs/default/share/pulsar-rs-sdk/interface" }

License notice

pulsar-assets and AUGUR Digital Twin operate under the AUGUR Development Licence (ADL) and AUGUR Commercial License (ACL). Read the AUGUR license before using the digital twins.

Check the installed models:

pixi run pulsar-cli vscan  # or virtual-scan, vs
pixi run pulsar-rs-cli vscan  # or virtual-scan

Run the virtual actuator

Create virtual_quickstart.py:

from pulsar_sdk import (
    ControlConfiguration,
    Mode,
    PulsarActuatorVirtual,
    TelemetryItems,
    VirtualWorld,
)

world = VirtualWorld()
actuator = PulsarActuatorVirtual(
    world,
    model="PULSE115-60G",
    address=1,
)

with actuator:
    actuator.configure(
        ControlConfiguration(
            mode=Mode.VELOCITY,
            telemetry_items=(
                TelemetryItems.POSITION,
                TelemetryItems.VELOCITY,
            ),
            telemetry_rate_hz=100,
        )
    )
    actuator.enable()
    actuator.set_command(1.0)

    for _ in range(10):
        world.step()

    print(
        actuator.read_telemetry((
            TelemetryItems.POSITION,
            TelemetryItems.VELOCITY,
        ))
    )
    actuator.disable()

Run it:

pixi run python virtual_quickstart.py

In src/main.rs:

use pulsar_rs_sdk::{
    ControlConfiguration, Mode, PulsarActuatorVirtual, TelemetryItem,
    VirtualWorld,
};

fn main() -> pulsar_rs_sdk::Result<()> {
    let world = VirtualWorld::new()?;
    let actuator = PulsarActuatorVirtual::new(&world, "PULSE115-60G", Some(1))?;

    actuator.connect()?;
    actuator.configure(&ControlConfiguration::new(
        Mode::Velocity,
        [TelemetryItem::Position, TelemetryItem::Velocity],
        100.0,
    )?)?;
    actuator.enable()?;
    actuator.set_command(1.0)?;

    for _ in 0..10 {
        world.step()?;
    }

    let telem = actuator.read_telemetry(&[
        TelemetryItem::Position,
        TelemetryItem::Velocity,
    ])?;
    println!(
        "pos={:.3} rad, vel={:.3} rad/s",
        telem[&TelemetryItem::Position].as_f64(),
        telem[&TelemetryItem::Velocity].as_f64(),
    );

    actuator.disable()?;
    actuator.disconnect()?;
    Ok(())
}

Run it:

pixi run cargo run

VirtualWorld.step() advances to the next periodic telemetry event and waits for due callbacks. If periodic telemetry is disabled, each call advances one 50 µs model tick.

Next steps