ase.DFMocoProtocol¶
Abstract protocols for managing communications with Dragonframe motion control.
Copyright (c) 2018, Garth Zeglin. All rights reserved. Licensed under the terms of the BSD 3-clause license.
-
class
ase.DFMocoProtocol.
DFMocoClientProtocol
[source]¶ Communicate with a motion control device using the DFMoco protocol. This class is intended to be subclassed for specific applications.
-
data_received
(data)[source]¶ Callback to receive a new bytestring of data, not necessarily line-terminated.
-
full_version_string
= '1.3.0'¶
-
logger
= None¶ logging object for controlling or capturing an event log
-
major_version
= 1¶
-
number_of_axes
= None¶ the number of axes reported by the server
-
process_line
(tokens)[source]¶ Protocol interpreter to process one status input line, supplied as a list of token strings with whitespace removed.
-
send_get_moving_state
(callback=None)[source]¶ Send a request for the trajectory generator status. This is an asynchronous request so a callback function is normally provided to receive the return value. This is an informal protocol implemented by multiple devices to support waiting for completion.
Parameters: callback – callable to be called with True if any motors are still moving else False
-
transport
= None¶ a file-like bidirectional object for the communication with the motion control device, e.g. socket or serial port
-
-
class
ase.DFMocoProtocol.
DFMocoServerProtocol
(number_of_axes=4)[source]¶ Communicate as a motion control device with Dragonframe using the DFMoco protocol. This class by itself is a trivial simulation but is intended to be subclassed to control specific hardware.
Parameters: number_of_axes – number of channels offered for motion control -
full_version_string
= '1.3.0'¶
-
inch_motor
(motor, direction)[source]¶ Process a ‘im’ Inch Motor command.
Parameters: - motor – motor index, starting with zero
- direction – -1 or 1 to indicate the direction of travel.
-
jog_motor
(motor, direction)[source]¶ Process a ‘jm’ Jog Motor command.
Parameters: - motor – motor index, starting with zero
- direction – -1 or 1 to indicate the direction of travel.
-
logger
= None¶ logging object for controlling or capturing an event log
-
major_version
= 1¶
-
motor_move
(motor, position)[source]¶ Process a ‘mm’ Motor Move command.
Parameters: - motor – motor index, starting with zero
- position – target position in pulses.
-
moving
= None¶ array of flags indicating whether each axis is in motion
-
new_position
(motor, position)[source]¶ Process a ‘np’ New Position command. This sets the position count without physical movement.
Parameters: - motor – motor index, starting with zero
- position – target position in pulses
-
positions
= None¶ array of current stepper positions
-
pulse_rate
(motor, speed)[source]¶ Process a ‘pr’ Pulse Rate command.
Parameters: - motor – motor index, starting with zero
- speed – maximum rate in steps/second
-
send_motor_position
(motor)[source]¶ Transmit a ‘mp’ Motor Position status.
Parameters: motor – motor index, starting with zero
-
send_motor_status
()[source]¶ Transmit the motor status response with a binary string generated from self.moving.
-
speeds
= None¶ array of maximum stepper speeds in pulses/second
-
stop_motor
(motor)[source]¶ Process a ‘sm’ Stop Motor command.
Parameters: motor – motor index, starting with zero
-
targets
= None¶ array of desired stepper positions
-