Grafito CANStepper

What it is

canstepper.sim.SimNetwork is a drop-in transport whose far end is a set of simulated boards implementing the GCSP v1 command table: parameters with the real validation rules, motion, homing, e-stop latching, events, even leader/follower coupling.

from canstepper import CANStepperBus
from canstepper.sim import SimNetwork

bus = CANStepperBus(SimNetwork([1, 2, 3]))
print(bus.discover(timeout=0.1))     # {1: '1.0', 2: '1.0', 3: '1.0'}

node = bus.node(1)
node.move_to(180.0, blocking=True)   # completes instantly, emits MOVE_DONE
print(node.get_position())           # 180.0

Everything above the transport — node API, groups, axes, kinematics, machine configs — behaves identically against the simulator and against real hardware.

Simplifications

  • Position moves complete instantly (the shaft teleports, then the move-done event fires).
  • Velocity mode only advances when you call net.tick(dt):
net = SimNetwork([1])
bus = CANStepperBus(net)
bus.node(1).run(90.0)
net.tick(2.0)                        # advance 2 simulated seconds
assert bus.node(1).get_position() == 180.0
  • No CAN arbitration, loss, or latency.

Use in tests

The package's own suite runs entirely on the simulator:

cd can_stepper
python3 -m pytest        # 50 tests, no hardware, well under a second

Write your machine logic against a CANStepperBus and inject SimNetwork in CI — your integration tests will cover everything except physics.

On this page