Quickstart
Multiple physical actuators over CAN FD with Pulsar Python SDK
Use one USB-to-CAN adapter to control several physical actuators on one CAN FD bus.
Prepare the bus
Before writing code:
- securely mount and power every actuator;
- wire the CAN bus with CAN termination at both physical ends;
- connect the Pulsar USB-to-CAN adapter;
- confirm that every actuator has a unique address using
pulsar-cli; - read CAN FD connectivity.
Find actuator addresses
After installing Pulsar Python SDK, scan the bus:
With one connected Pulsar device:
With several connected devices, select the adapter port:
Replace the example port with the exact port on your machine.
Configure one group
Replace the example addresses below with the values reported by the scan.
from time import sleep
from pulsar_sdk import (
ActuatorGroup,
ControlConfiguration,
ControlParams,
Mode,
PcpOverCan,
PulsarActuatorReal,
)
can = PcpOverCan()
arm = ActuatorGroup(
"arm",
{
"shoulder": PulsarActuatorReal(can, address=23),
"elbow": PulsarActuatorReal(can, address=24),
},
)
with arm:
arm.configure(ControlConfiguration(Mode.VELOCITY))
arm.enable()
arm.set_commands({
"shoulder": {ControlParams.COMMAND: 0.2},
"elbow": {ControlParams.COMMAND: -0.2},
})
sleep(2)
arm.disable()
PcpOverCan() automatically selects the port when only one Pulsar CAN Adapter is connected. With several adapters, use PcpOverCan.list_ports() and construct the domain as PcpOverCan(chosen_port).
The SDK validates the complete selected batch before the first write. Member writes are still sequential, so a later transport failure can occur after an earlier actuator was updated.