sangaboard package¶
Submodules¶
- sangaboard.extensible_serial_instrument module
list_serial_ports()ExtensibleSerialInstrumentExtensibleSerialInstrument.termination_characterExtensibleSerialInstrument.termination_lineExtensibleSerialInstrument.ignore_echoExtensibleSerialInstrument.port_settingsExtensibleSerialInstrument.port_settings_listExtensibleSerialInstrument.open()ExtensibleSerialInstrument.close()ExtensibleSerialInstrument.write()ExtensibleSerialInstrument.flush_input_buffer()ExtensibleSerialInstrument.readline()ExtensibleSerialInstrument.communications_lockExtensibleSerialInstrument.read_multiline()ExtensibleSerialInstrument.query()ExtensibleSerialInstrument.parsed_query()ExtensibleSerialInstrument.int_query()ExtensibleSerialInstrument.float_query()ExtensibleSerialInstrument.test_communications()ExtensibleSerialInstrument.find_port()
OptionalModuleQueriedProperty
- sangaboard.sangaboard module
SangaboardSangaboard.valid_firmwaresSangaboard.deprecated_firmwaresSangaboard.port_settingsSangaboard.port_settings_listSangaboard.positionSangaboard.step_timeSangaboard.ramp_timeSangaboard.axis_namesSangaboard.firmwareSangaboard.supported_light_sensorsSangaboard.test_communications()Sangaboard.check_valid_firmware()Sangaboard.move_rel()Sangaboard.release_motors()Sangaboard.zero_position()Sangaboard.move_abs()Sangaboard.query()Sangaboard.list_modules()Sangaboard.print_help()
LightSensorEndstopsIllumination
- sangaboard.testing module
DummySerialDeviceDummySerialDevice.termination_characterDummySerialDevice.responsesDummySerialDevice.unmatched_responseDummySerialDevice.timeoutDummySerialDevice.print_buffersDummySerialDevice.read_bufferDummySerialDevice.write_bufferDummySerialDevice.isOpen()DummySerialDevice.write()DummySerialDevice.inWaiting()DummySerialDevice.flushInput()DummySerialDevice.register_response()DummySerialDevice.remove_response()DummySerialDevice.replace_response()DummySerialDevice.respond_to()DummySerialDevice.readline()DummySerialDevice.read()DummySerialDevice.open()DummySerialDevice.close()
DummySangaboardDevice
Module contents¶
The sangaboard control module.
- class sangaboard.Sangaboard(port=None, timeout: int = 2, **kwargs)[source]¶
Bases:
ExtensibleSerialInstrumentClass 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 speedin 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']¶
- 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’
- 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()