Registered by Henry Gomersall

A python class originally designed to provide a high level interface to the Zaber motorized linear slides (see http://www.zaber.com). However the classes should be useful for many low data rate serial devices with little modification. Provided is an asynchronous connection class that acts as a general thread safe data dispatcher from the hardware to the device handlers as well as any other code.

This project attempts to provide a high level pythonic interface to the Zaber motorized linear slides. These slides have a simple but elegant serial interface receiving commands and responding accordingly.

The low level interfacing with the Zaber is abstracted away to a connection class and a device class. The connection class attempts to offer a thread safe interface between instances of the Zaber device classes and any other code (as well as direct low level writing to the hardware). The device classes are designed to provide a nice high level command interface to the capabilities of the Zaber hardware, including state lookup, command queues and extensible meta-instructions.

The implementation should be useful for many other kinds of devices. The architecture is such that little specific to the Zaber devices is implemented in the classes of general interest.

Essentially, the serial device talks to the async_serial class which uses the serial.py module. The listening portion of the code runs in a separate thread and blocks until data is available on the serial port. At this point, the data is parsed (using Struct.Struct) and puts the resulting packet onto a queue object.

The connection class, once open() has been called on it, blocks until a packet has been placed on the queue object (either by the serial device or some other function). At this point, it wakes up and deals the packet, dispatching it to the relevant handler. If it is a packet from the serial device, it gets passed to a device handler (if one has been registered). If it is a general packet, it gets passed to its destination (assuming that destination has been registered as a handler).

A device handler base class with almost no functionality is implemented. The zaber_device class inherits from this and then the linear_slide class inherits from the zaber_device class.

The nice API is presented that handles reasonably the asynchronous nature of the devices. When commands are made on the device, they are placed on a queue until they are ready to be passed.

Additionally, the API is exposed over a queue. This allows for thread safe operation of the zaber device.

Project information

Maintainer:
Henry Gomersall
Driver:
Not yet selected
Licence:
GNU GPL v3

RDF metadata

View full history Series and milestones

trunk series is the current focus of development.

All code Code

Version control system:
Bazaar
Programming languages:
python

All bugs Latest bugs reported

Get Involved

  • Report a bug
  • warning
    Ask a question
  • warning
    Help translate

Downloads

Latest version is 0.1
released

All downloads