ase.MiniMaestroProtocol

A protocol for communicating with a Pololu Mini-Maestro USB Servo Interface using a serial port transport.

Copyright (c) 2015-2018, Garth Zeglin. All rights reserved. Licensed under the terms of the BSD 3-clause license.

class ase.MiniMaestroProtocol.MiniMaestroProtocol[source]

Communicate with a Pololu Mini-Maestro USB servo interface. An instance of this class can be passed to a serial transport class (e.g. SerialTransport or QtSerialTransport) which handles the device port. The Mini Maestro enumerates as two separate ports; this protocol should be attached to the ‘command’ port at 115200 baud.

data_received(data)[source]

Process a bytestring received from the port, matching it to any data requests.

is_connected()[source]

Return true if the serial port device is open.

logger = None

logging object for controlling or capturing an event log

messages_received = None

Count of total messages received.

messages_sent = None

Count of total messages sent.

send_acceleration(channel, accel)[source]

Send a single Set Acceleration command to the Mini Maestro. The valid range is 0.3125 to 79.6875. Zero sets unlimited acceleration. Out-of-range values are silently clamped.

Parameters:
  • channel – integer channel number; the first servo channel is 0
  • accel – acceleration of servo pulse width in milliseconds/second/second
send_get_moving_state(callback=None)[source]

Send a Get Moving State request to the Mini Maestro. This is an asynchronous request, but a callback function can be provided to receive the eventual return value.

Parameters:callback – callable to be called with a Boolean value
send_get_position(channel, callback=None)[source]

Send a Get Position request to the Mini Maestro. This is an asynchronous request, but a callback function can be provided to receive the eventual return value.

Parameters:
  • channel – integer channel number; the first servo channel is 0
  • callback – callable to be called with a (channel, position) tuple, with position specified in milliseconds of pulse width
send_multiple_accelerations(first_channel, accels)[source]

Send multiple Set Accel commands to a Mini Maestro. N.B. there is no special protocol support, this is a convenience function to issue multiple Set Acceleration commands.

Parameters:
  • first_channel – integer channel number for the first value
  • accels – list of accel values in milliseconds-of-pulse-width/second/second
send_multiple_speeds(first_channel, speeds)[source]

Send multiple Set Speed commands to a Mini Maestro. N.B. there is no special protocol support, this is a convenience function to issue multiple Set Speed commands.

Parameters:
  • first_channel – integer channel number for the first value
  • speeds – list of speed values in milliseconds-of-pulse-width/second
send_multiple_targets(first_channel, pulse_widths)[source]

Send a single Set Target command to the Mini Maestro.

Parameters:
  • first_channel – integer channel number for the first value
  • pulse_widths – list of servo pulse width in milliseconds; the typical range is 1.0 to 2.0
send_speed(channel, speed)[source]

Send a single Set Speed command to the Mini Maestro. The valid range is 0.025 to 409.575, but for most servos practical values are less than 10. Zero sets unlimited speed. Out-of-range values are silently clamped.

Parameters:
  • channel – integer channel number; the first servo channel is 0
  • speed – maximum rate of change of servo pulse width in milliseconds/second
send_target(channel, pulse_width)[source]

Send a single Set Target command to the Mini Maestro.

Parameters:
  • channel – integer channel number; the first servo channel is 0
  • pulse_width – servo pulse width in milliseconds; the typical range is 1.0 to 2.0
transport = None

object representing the device connection