Open lucduempelmann opened 6 years ago
Hello!
I'm glad that my code is useful.
The first message is due to the fact that the KST101 controller is not a "known" stage in my detection code. Try adding somewhere stage_name_from_get_hw_info
in thorpy/stages/__init__.py
something like:
elif controller_type in (26,):
return 'KST101'
Tell me what happens then.
Cheers, Laurent
Hey Laurent,
many thanks for your really fast response!! Thats really awesome and really helpful.
So with your code, the first error disappears, but now I have the following:
Constructed: SingleControllerPort('/dev/ttyUSB0',26001669)
_Unhandled message
Many thanks for any help. Cheers, Luc
Hello!
Simply try to find an updated MG17APTServer.ini
(you should find it on any Windows computer with Thorlabs APT software installed... I haven't tried recently though)
Laurent
Dear Laurent,
many thanks for your input. This partially solves the problem. Unfortunately I still get an error (while the code can read the position, so there is a connection). I used the test.py.
Constructed: SingleControllerPort('/dev/ttyUSB0',26001669)
Traceback (most recent call last):
File "/usr/lib/python3.5/configparser.py", line 1135, in _unify_values
sectiondict = self._sections[section]
Unhandled message
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "test.py", line 6, in
Do you have any idea what would have to be changed? Many thanks in advance. Luc
I'll have a look on Monday (I don't have a Windows computer at home), to see if an updated configuration file can help. Unfortunately I don't have the hardware...
Can you post your modified version somewhere? (a github repository would do)
I just made a fork with my changes (I hope you can access it). Sorry I am not an Git expert. The code as it is works with the other stages, but not yet with the KST101.
Ok, so I've had a look in the software. Let's try the following:
In thorpy/stages/__init__.py
, try returning instead of return 'KST101'
return 'ZST213(B)'
.
If it works, I suggest doing instead the following:
First, edit to add 26 to the line:
elif controller_type in (27, 63, 83, 2197):
to get:
elif controller_type in (26, 27, 63, 83, 2197):
Then you should add a sub-condition to detect the correct type. Unfortunately it won't work with the same logic, because it doesn't seem that it uses the same methods as the TDC for stage detection. Let me know?
Thanks!! So when I did the first (exchange of KST101 into ZST213(B)), it gave me:
Constructed: SingleControllerPort('/dev/ttyUSB0',26001669) Unhandled message
(dest=0x1, src=0x50, chan_ident=1, position=0, enc_count=0, status_bits=2147483648) Unhandled message (dest=0x1, src=0x50, chan_ident=1, position=0, enc_count=0, status_bits=2147483648) Constructed: <ZST213(B) on SingleControllerPort('/dev/ttyUSB0',26001669) channel 1> [<ZST213(B) on SingleControllerPort('/dev/ttyUSB0',26001669) channel 1>] Stage: ZST213(B) Position: 0.000mm Status: homed, channel enabled Velocity parameters: velocity: 0.000-4569.668mm/s, acceleration: 1096.720mm/s² Homing parameters: velocity: 4569.668mm/s, direction: 2, limit_switch: 1, offset_distance: 761.756mm ....
so it worked (it recognized the ZST213(B), e.g. I could also move it with s.position. But the parameters were all wrong (not corresponding to the MG17APTServer file.
I then added '26' as described and included:
elif stage_type == 0x0C:
return 'ZST213(B)'
I guess stage_type == 0x0C is not completely correct. Where do I get this information? If I run this I again get the following (although I can now control the motor):
Constructed: SingleControllerPort('/dev/ttyUSB0',26001669) If you see this message, please send a mail with the following information: controller type stage type this data:
(dest=0x1, src=0x50, serial_number=26000000, model_number=b'KST101\x00\x00', type=16, firmware_version=b'\x07\x00\x01\x00', notes=b'KST101 Stepper Controller v3.1 1\x00', empty_space=b'162009Nov\x00\x00\x00', hw_version=3, mod_state=32, nchs=1) Unhandled message (dest=0x1, src=0x50, chan_ident=1, position=49152, enc_count=0, status_bits=2147484672) Unhandled message (dest=0x1, src=0x50, chan_ident=1, position=49152, enc_count=0, status_bits=2147484672) Constructed: <Z606(B) on SingleControllerPort('/dev/ttyUSB0',26001669) channel 1> [<Z606(B) on SingleControllerPort('/dev/ttyUSB0',26001669) channel 1>] Stage: Z606(B) Position: 2.000mm Status: homed, channel enabled Velocity parameters: velocity: 0.000-182.365mm/s, acceleration: 43.768mm/s² Homing parameters: velocity: 182.365mm/s, direction: 2, limit_switch: 1, offset_distance: 30.400mm ....
So I think if I get the sub-condition right, it should work. Can you help?
Hello, Do you have any idea what stage_type I would have to add, when including the sub-condition? elif stage_type == 0x??: return 'ZST213(B)' Is this information documented somewhere? Or could Thorlabs help here? Many thanks for any information.
@lucduempelmann, would you be willing to help me get things going? I've tried on both Windows and Mac and can't seem to get the device to be discovered (trying with a KDC101).
Hi, sure, I am happy to help! I didn't test for the KDC101 yet, but will do that next week and let you know.
I assume you download and used my modified version (from 29.10.18), right? This was working fine for me, until I received some new KST101 stages, which couldn't be detected/controlled. Somehow I assume due to a new serial number, the controller_type was not 26 anymore but 4294 (which had to be added in the code). Then it worked again. Maybe you have this problem. I will update this updated version next week.
I was able to get it working on my mac by replacing pyserial with pylibftdi. However, the status_homed property always returns true. I am using your updated server file but that still does not help.
Hi Knoose, so I checked the software with the KDC101 and a Z812B actuator and everything works nicely. But I am using it on Linux. I also tried Windows, but this didn't work for me due to the libraries etc. But maybe this could be fixed, will give an update. For Windows I am using https://github.com/mcleu/PyAPT, which is not supported anymore, but still works fine, also for the Kinesis modules. Maybe you can post your error, to find out what the problem is? I hope this helps.
Hello, your code really works great for the old APT controller, and also for the KDC101. So many thanks for this, it has really been a great help!!!
Now we need to work with the stepper controller KST101 and actuator ZST213. Although it recognizes something, and also displays the current position (so the connection is there), there is an error message displaying:
Constructed: SingleControllerPort('/dev/ttyUSB1',26001669) If you see this message, please send a mail with the following information: - controller type - stage type _- this data:(dest=0x1, src=0x50, serial_number=26000000, model_number=b'KST101\x00\x00', type=16, firmware_version=b'\x07\x00\x01\x00', notes_b'KST101 Stepper Controller v 3.1 1\x00', empty_space=b'162009Nov\x00\x00\x00', hw_version=3, mod_state=32, nchs=1)
Unhandled message (dest=0x1, src0x50, chan_ident=1, position=0, enc_count=0, status_bits=2147483648)
Destructed: <None on SingleControllerPort('/dev/ttyUSB1', 26001669) channel 1>
Destructed: SingleControllerPort('/dev/ttyUSB1', 26001669)
Unhandled message (dest=0x1, src0x50, chan_ident=1, position=0, enc_count=0, status_bits=2147483648)
Unhandled message (dest=0x1, src0x50, chan_ident=1, position=0, enc_count=0, status_bits=2147483648)
Unhandled message (dest=0x1, src0x50, chan_ident=1, position=0, enc_count=0, statusbits=2147483648)
.....
.....
this message display until I switch off the controller.
Do you know if something in the code has to be adapted, so we can use this stage? Many thanks for any inputs / help.
Best, Luc