Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No outputs for get_info.py with BSC203 and NRT150 #12

Open
mxochicale opened this issue Dec 7, 2019 · 5 comments
Open

No outputs for get_info.py with BSC203 and NRT150 #12

mxochicale opened this issue Dec 7, 2019 · 5 comments

Comments

@mxochicale
Copy link

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?

@freespace
Copy link
Owner

Can post the modified get_info.py to a gist or in a comment? Can you insert some print statements into Controller._read_message and see what the hardware is sending back?

@mxochicale
Copy link
Author

For above output of python get_info.py , I added some print lines in \pyAPT\controller.py to see what is happening. However, I have just put controller.py back as it is in the repository. Then I have added controller._read_message which did not show any output as seen below:

python get_info.py

#!/usr/bin/env python
"""
Usage: python get_info.py [<serial>]

Gets the controller information of all APT controllers, or the one specified
"""
from __future__ import absolute_import
from __future__ import print_function

import pyAPT

from runner import runner_serial

@runner_serial
def info(serial):
    print ('###  TESTING get_info.py  ####')
    print('serial=   ',serial) #70112214

    con=pyAPT.Controller(serial_number=serial)
    print('pyAPT.Controller(70112214) =   ', con)
    con._read_message()
    con.info()

if __name__ == '__main__':
  import sys
  sys.exit(info())

terminal output

the terminal output is the following and the script just get stuck there (i.e. not showing anything for con.read_message() and con.info()).

(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 0x7ff0748fc5c0>)

Any suggestions?

@freespace
Copy link
Owner

@mxochicale I have pushed a new branch that has debugging output inserted. Can you please checkout branch issue-12 and re-run get_info.py

FYI I am no longer at Oxford and therefore do not have access to any Thorlabs hardware.

@mxochicale
Copy link
Author

Thanks @freespace for your kind reply and your message on not having access to any Thorlabs hardware. I have updated my local repo and checkout issue-12 branch and apparently there is no response for the reading message header as shown below:

(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'
Reading message header

Do you have any suggestions?

By the way, I will come back to the lab on 13 of January 2020 to hopefully sort out this issue with your help.

@freespace
Copy link
Owner

@mxochicale it looks like the controller isn't responding to the APT commands. This could be due to a few things: a change in how APT is implemented; hardware fault; configuration issue; etc.

The first step would be to determine if it is at all possible to communicate with these controller using the APT protocol. Download the APT software from https://www.thorlabs.com/software_pages/ViewSoftwarePage.cfm?Code=Motion_Control&viewtab=1 and attempt to manipulate your stages and controllers. If this work then it rules out hardware and configuration issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants