Stepper Motor Controller Interface

rcp.winch

Interfaces to hardware winch systems. Uses the QtSerialPort module for communication event processing using the Qt event loop.

class rcp.winch.QtSerialWinch[source]

Class to manage a serial connection to a hardware winch system using Qt QSerialPort object for data transport. The data protocol is based on the StepperWinch Arduino sketch.

available_ports()[source]

Return a list of names of available serial ports.

close()[source]

Shut down the serial connection to the Arduino.

increment_reference(axis, offset)[source]

Add a signed offset to one or more winch reference positions.

Parameters
  • axis – either a integer axis number or list of axis numbers

  • offset – either a integer step offset or list of step offsets

increment_target(axis, offset)[source]

Add a signed offset to one or more winch target positions.

Parameters
  • axis – either a integer axis number or list of axis numbers

  • offset – either a integer step offset or list of step offsets

motor_enable(value=True)[source]

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

open()[source]

Open the serial port and initialize communications. If the port is already open, this will close it first. If the current name is None, this will not open anything. Returns True if the port is open, else False.

set_freq_damping(axis, freq, ratio)[source]

Set the second order model resonance parameters for one or more path generators. Note that the same parameters are applied to all specified axes, unlike the target setting functions.

Parameters
  • axis – either a integer axis number or list of axis numbers

  • freq – scalar specifying the frequency in Hz

  • ratio – scalar specifying the damping ratio, e.g. 1.0 at critical damping.

set_speed(axis, speed)[source]

Set the ramp speed for one or more target positions. Speeds less than or equal to zero are treated as infinite on the winch.

Parameters
  • axis – either a integer axis number or list of axis numbers

  • speed – either an integer speed or list of integer velocities

set_target(axis, position)[source]

Set the absolute target position for one or more winch axes.

Parameters
  • axis – either a integer axis number or list of axis numbers

  • positions – either a integer step position or list of step positions

set_velocity(axis, velocity)[source]

Set the constant velocity of one or more target positions. Note: this is currently ignored by the winch firmware.

Parameters
  • axis – either a integer axis number or list of axis numbers

  • velocity – either an integer velocity or list of integer velocities