python-microscope / microscope

Python library for control of microscope devices, supporting hardware triggers and distribution of devices over the network for performance and flexibility.
https://www.python-microscope.org
GNU General Public License v3.0
66 stars 39 forks source link

Support for thorlabs ELL6, 9 and 12 #252

Open juliomateoslangerak opened 1 year ago

juliomateoslangerak commented 1 year ago

I'm trying to add support for Thorlabs ELL Multi-Position Sliders. Models ELL6, 9 and 12. These devices are controlled through a serial interface.

It is just disturbing to not know where that extra mm comes from.

Connecting...
Scanning for devices
Tx: 0in
Rx: 0IN091090010620200801005D00000000
Tx: 1in
1 device found
Get Jogstep Size...
Tx: 0gj
Rx: 0GJ0000001F
Requesting Motor1 info...
Tx: 0i1
Rx: 0I1100000FFFFFFFF00B2008D
Get Device Status:
Motor ID 1
Loop State On
Motor State Off
Current 0.00A
Fwd Freqency 82.8kHz
Rev Frequency 104.5kHz
RampUp 65535
RampDown 65535
Requesting Motor2 info...
Tx: 0i2
Rx: 0I2100000FFFFFFFF00B2008C
Get Device Status:
Motor ID 2
Loop State On
Motor State Off
Current 0.00A
Fwd Freqency 82.8kHz
Rev Frequency 105.3kHz
RampUp 65535
RampDown 65535
Homing device ...
Tx: 0ho0
Rx: 0PO00000000
Move device to 0.0 mm...
Tx: 0ma00000000
Rx: 0PO00000000
Move device to 32.0 mm...
Tx: 0ma00000020
Rx: 0PO0000001F
Move device to 64.0 mm...
Tx: 0ma00000040
Rx: 0PO0000003E
Move device to 96.0 mm...
Tx: 0ma00000060
Rx: 0PO0000005D
iandobbie commented 1 year ago

I understand your frustration but in our experience hardware control often has extreme weirdness and manufactures are very reluctant to fix the firmware or interface code.

I suggest we document it carefully, including something in the code so any future person working on it (maybe even your future self) can see why you are doing something "wrong", and then not worry about it too much. Having some kind of issue with the manufacturing is good practice as well. If they give you some kind of ticket number or similar you could add that to the documentation for the issue.

juliomateoslangerak commented 1 year ago

Thorlabs support is frustrating indeed. Looking into micro-manager's code https://micro-manager.org/ThorlabsElliptecSlider https://github.com/micro-manager/mmCoreAndDevices/blob/main/DeviceAdapters/ThorlabsElliptecSlider/ThorlabsElliptecSlider.cpp

const char* g_pos0 = "00000000";
const char* g_pos1 = "0000001F";
const char* g_pos2 = "0000003E";
const char* g_pos3 = "0000005D";