Code Monkey home page Code Monkey logo

pyapt's Introduction

pyAPT

Python interface to Thorlab's APT motion controllers. Depends on libftdi1 and pylibftdi. Under Linux the easiest way to get these is to install libftdi1 using the package management system, and then install pylibftdi into a virtual environment or equivalent.

Development is ongoing, and I will be adding functionality as I need them in the course of my DPhil.

Note on stage limits

The stage limits (maximum acceleration, velocity, etc) as quoted on the Thorlabs website, or in their user manuals, often don't agree with reality. The best way to get these limits is to install the APT User software, which seems to have built-in limits for the various stages. These correspond much better to the actual performance of stages.

pyapt's People

Contributors

anthonyclays avatar freespace avatar paweldefee avatar roflmaostc avatar thymios13 avatar vascotenner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyapt's Issues

Other project

Hello!

I'm currently working on an alternative implementation of Thorlab's APT protocol in Python, which can be found on: https://github.com/UniNE-CHYN/thorpy

My code is GPL-2 licensed, which is not compatible with the MIT license you use, but feel free to borrow ideas for your implementation.

Since I don't have access to many stage/controllers, I would greatly appreciate any feedback/contribution.

Thanks a lot,

Laurent

Laurent

Can't Connect

I trying to use your code on linux but I got some problems.
When I connect the device on Ubuntu, I've got:

new full-speed USB device number 15 using ehci-pci
New USB device found, idVendor=0403, idProduct=faf0
New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 3-1.2.5: Product: APT Piezo Controller
Manufacturer: Thorlabs
usb 3-1.2.5: SerialNumber: 81846609
ftdi_sio 3-1.2.5:1.0: FTDI USB Serial Device converter detected
usb 3-1.2.5: Detected FT232BM
usb 3-1.2.5: FTDI USB Serial Device converter now attached to ttyUSB4
usb 3-1.2.6: new full-speed USB device number 16 using ehci-pci
usb 3-1.2.6: New USB device found, idVendor=0403, idProduct=faf0
usb 3-1.2.6: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 3-1.2.6: Product: APT Piezo Controller
usb 3-1.2.6: Manufacturer: Thorlabs
usb 3-1.2.6: SerialNumber: 81845777
ftdi_sio 3-1.2.6:1.0: FTDI USB Serial Device converter detected
usb 3-1.2.6: Detected FT232BM
usb 3-1.2.6: FTDI USB Serial Device converter now attached to ttyUSB5

I'm trying to do "pyAPT.Controller(81846609)" but doesn't work.. I always receive a error -9 or -8 that means (erros that come from ftdi.h library https://www.intra2net.com/en/developer/libftdi/documentation/group__libftdi.html#ga3c5ccb0678b0e268b4081ea978e8eb78)
-8 get product description failed
-9 get serial number failed

Can anyone help me ?

No outputs for `get_info.py` with BSC203 and NRT150

Hi

I am wondering if anyone (i.e. @freespace, @dorox, @matteoschiav, @mn14tm, @PawelDefee, @pumphaus, @raouf-barboza, @teletoby, @vascotenner, @victorliu, @weinshec, @yuriy-kozlov, etc. ) have tested pyAPT under Ubuntu 18.04x6x with Controller BSC203 and linear stages NRT150/M?. I am asking that as I have been facing some communication problems and perhaps you have some advice. Let me share how I am setting the USB port, library installation and then show the terminal output for get_info.py

USB setting up

First, *ftdi.rules have been setup as follow

/etc/udev/rules.d/11-ftdi.rules

SUBSYSTEM=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="faf0", GROUP="dialout", MODE="0666"

/etc/udev/rules.d/99-libftdi.rules

SUBSYSTEMS=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="faf0", GROUP="dialout", MODE="0666"

Also, it has been changed the permissions and its group of the USB port of the controller as shown below.

$ ls -la /dev/ttyUSB0
crw-rw-rw- 1 root dialout 188, 0 Dec  3 08:09 /dev/ttyUSB0
$ groups
pyapt tty dialout sudo

Library requirements

pip install -r requirements.txtin (linearstages) virtual environment with python3 using a standard user (i.e. no root user).

Issue the python get_info.py just get stuck:

I am not sure what I am missing perhaps you have some hints for the following bug:

(linearstages) pyapt@$MACHINE:$HOME/pyAPT$ python get_info.py 
Looking for APT controllers
Found b'Thorlabs' b'APT Stepper Motor Controller' S/N: b'70112214'
###  TESTING get_info.py  ####
serial=    b'70112214'
pyAPT.Controller(70112214) =    Controller(serial=70112214, device=<pylibftdi.device.Device object at 0x7f0847d4c5c0>)
message.MGMSG_HW_GET_INFO= 6
reqmsg= Message(messageID=5, param1=0, param2=0, dest=80, src=1, data=None)
6

Any ideas?

Python3 controller.info() error

Exception has occurred: TypeError
ord() expected string of length 1, but int found

I can contribute to solve that as soon as the owner is still working on it

Assert data type error

Hello I'm working on adapting this code to work with a Thorlabs k-cube piezo controller for a project for my Masters degree. While, I can use it to identify the controllers I got the following error when I tried to set the drive voltage:

File "/usr/local/home/labuser/pyAPT/pyAPT/controller.py:, line 536, in opset
setmsg = Message(message.MGMSG_PZ_SET_OUTPUTVOLTS, data=setpar)
File"/usr/local/home/labuser/pyAPT/pyAPT/message.py:, line 66, in new
assert(type(data) in [list, tuple, str])
AssertionError

Did the data type for the variables handled in the coms protocols need to be predefined in the controller code or do I need to modify the code in the message code?

I've attached copies of my set voltage code as well as the modified controller code.

Any assistance would be greatly appreciated.

code.zip

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.