sangaboard package

Submodules

Module contents

The sangaboard control module.

class sangaboard.Sangaboard(port=None, timeout: int = 2, **kwargs)[source]

Bases: ExtensibleSerialInstrument

Class managing serial communications with a Sangaboard

The Sangaboard class handles setting up communications with the sangaboard, wraps the various serial commands in Python methods, and provides iterators and context managers to simplify opening/closing the hardware connection and some other tasks like conducting a linear scan.

Arguments to the constructor are passed to the constructor of Sangaboard.extensible_serial_instrument.ExtensibleSerialInstrument, most likely the only one necessary is port which should be set to the serial port you will use to communicate with the motor controller.

This class can be used as a context manager, i.e. it’s encouraged to use it as:

with Sangaboard() as sb:
    sb.move_rel([1000,0,0])

In that case, the serial port will automatically be closed at the end of the block, even if an error occurs. Otherwise, be sure to call the close() method to release the serial port.

valid_firmwares = [(1, 0), (0, 5), (0, 4)]

List of valid and deprecated firmwares, for communication checks.

Each is a tuple of (major version, minor version). So v1.0 is (1, 0).

deprecated_firmwares = [(0, 4)]

Firmwares that are valid for communication but throw deprecation wanrings.

port_settings = {'baudrate': 115200, 'bytesize': serial.EIGHTBITS, 'parity': serial.PARITY_NONE, 'stopbits': serial.STOPBITS_ONE}
port_settings_list = [{'baudrate': 115200, 'bytesize': serial.EIGHTBITS, 'parity': serial.PARITY_NONE, 'stopbits': serial.STOPBITS_ONE}, {'baudrate': 115200, 'bytesize': serial.EIGHTBITS, 'parity': serial.PARITY_NONE, 'stopbits': serial.STOPBITS_ONE}]
position

Get the position of the axes as a tuple of 3 integers.

step_time

Get or set the minimum time between steps of the motors in microseconds.

The step time is 1000000/max speed in steps/second. It is saved to EEPROM on the sangaboard, so it will be persistent even if the motor controller is turned off.

ramp_time

Get or set the acceleration time in microseconds.

The motors will accelerate/decelerate between stationary and maximum speed over ramp_time microseconds. Zero means the motor runs at full speed initially, with no accleration control. Small moves may last less than 2*ramp_time, in which case the acceleration will be the same, but the motor will never reach full speed. It is saved to EEPROM on the sangaboard, so it will be persistent even if the motor controller is turned off.

axis_names = ('x', 'y', 'z')
firmware = None
supported_light_sensors = ['TSL2591', 'ADS1115']
test_communications()[source]

Overrides superclass, used in self.open(), and port scanning

check_valid_firmware()[source]
move_rel(displacement, axis=None)[source]

Make a relative move.

displacement: integer or array/list of 3 integers axis: None (for 3-axis moves) or one of ‘x’,’y’,’z’

release_motors()[source]

De-energise the stepper motor coils

zero_position()[source]

Set the current position to zero

move_abs(final, **kwargs)[source]

Make an absolute move to a position

Note the sangaboard only accepts relative move commands, so this first queries the board for its position, then instructs it to make about relative move.

query(message, *args, **kwargs)[source]

Send a message and read the response.

See ExtensibleSerialInstrument.query()

list_modules()[source]

Return a list of strings detailing optional modules.

Each module will correspond to a string of the form Module Name: Model

print_help()[source]

Print the stage’s built-in help message.