Theater StepperSpline Firmware Interface

The motion control server uses the following module to communicate with the Arduino motion controllers running the StepperSpline Arduino Sketch over USB serial.

stage.steppers

steppers.py : sample code in Python to communicate with an Arduino running StepperSpline

No copyright, 2021-2023, Garth Zeglin. This file is explicitly placed in the public domain.

class stage.steppers.StepperSplineClient(port=None, verbose=False, debug=False, **kwargs)[source]

Class to manage a connection to a serial-connected Arduino running the StepperSpline script.

Parameters:
  • port – the name of the serial port device

  • debug – true when debug log is enabled

  • verbose – flag to increase logging output

  • kwargs – collect any unused keyword arguments

close()[source]

Shut down the serial connection to the Arduino, after which this object may no longer be used.

motor_enable(value=True)[source]

Issue a command to enable or disable the stepper motor drivers.

send_knots(knots, mask='xyza')[source]

Issue a series of knot commands to append Bezier spline segments (specified in microsteps) to the current path.

Parameters:
  • knots – a matrix in which each row specifies a knot point value for each active channel

  • mask – a string specifying the channels to include

send_move(position)[source]

Issue a command to move to a [x, y, z, a] absolute position (specified in microsteps) and return immediately.

Parameters:

position – a list or tuple with at least four elements

send_relative_move(position, mask='xyza')[source]

Issue a command to move to a relative position (specified in microsteps) and return immediately.

Parameters:
  • position – a list or tuple with one element per channel mask entry

  • mask – a string specifying the channels to include

send_tempo(tempo, mask='xyza')[source]

Issue a command to set the spline rate and return immediately.

Parameters:
  • tempo – a scalar spline rate in segments/minute

  • mask – a string specifying the channels to include (default is all)

wait_for_wakeup()[source]

Issue a status query and wait until status has been received.