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

Issue with core.waitForSystem() and AxioImager in napari-micromanager #297

Open
CedricEsp opened this issue Nov 9, 2022 · 4 comments
Open

Comments

@CedricEsp
Copy link

Hello,

In napari-micromanager when trying:

core.set_position(0) # assuming this is a safe position for your system
core.set_position(3000)
core.waitForSystem()
print(core.get_position())

I get 0 and the core.waitForSystem() seems to not be communicating properly see #pymmcore-plus/napari-micromanager#204 for some reference.

I am working with a Zeiss AxioImager Z.2

Thanks!

Cedric

@nicost
Copy link
Member

nicost commented Nov 9, 2022

Can you post the relevant excerpt from the Corelog file?

It may actually be easiest to do this in the Micro-Manager GUI, use Help > Report a Problem, and run a Beanshell script with the same commands.

@nicost
Copy link
Member

nicost commented Nov 9, 2022

Also, can you try:

core.set_position(0) # assuming this is a safe position for your system
core.waitForSystem()
print(core.get_position())
core.set_position(3000)
core.waitForSystem()
print(core.get_position())

@CedricEsp
Copy link
Author

Thanks @nicost for your (very) quick reply! I am not sure which part of the report is the most relevant but I have a report on both script and attached the files.

Problem_Report_AxioImagerZ2_1.txt

Problem_Report_AxioImagerZ2_2.txt

Please let me know if it's relevant or if you need anything else.
Thanks

@nicost
Copy link
Member

nicost commented Nov 10, 2022

Not quite sure what is happening.

2022-11-09T11:34:15.632261 tid9632 [dbg,Core] Will start absolute move of ZeissFocusAxis to position 0.00000 um
2022-11-09T11:34:15.632261 tid9632 [dbg,dev:COM17] Write -> (hex) 10 02 19 11 08 1b a3 11 01 0f 00 00 00 00 00 10 03
2022-11-09T11:34:15.633256 tid9632 [dbg,Core] Will start absolute move of ZeissFocusAxis to position 3000.00000 um
2022-11-09T11:34:15.633256 tid9632 [dbg,dev:COM17] Write -> (hex) 10 02 19 11 08 1b a3 11 01 0f 00 00 2d c6 c0 10 03

Those are your two core-set_position() commands executed in rapid succession (fair, since you are not waiting for the stage to reach position 0 before executing the next command). Each of these will set the busy flag for the device (in the ZeissCAN29 microscope model) to true. However:

2022-11-09T11:34:15.633256 tid9632 [dbg,Core] Waiting for device ZeissFocusAxis...
2022-11-09T11:34:15.660139 tid6268 [dbg,dev:COM17] Read <- (hex) 10 02 11 19 07 07 a3 07 01 0f 00 00 00 00 10 03 10 02 11 19 07 07 a3 06 04 0f 00 00 04 09 10 03
2022-11-09T11:34:15.660139 tid6268 [dbg,dev:ZeissReflectorTurret] Monitoring Thread incoming message: 11 19 7 7 a3 7 1 f 0 0 0 0 
2022-11-09T11:34:15.660139 tid6268 [dbg,dev:ZeissReflectorTurret] Monitoring Thread incoming message: 11 19 7 7 a3 6 4 f 0 0 4 9 
2022-11-09T11:34:15.660139 tid6268 [dbg,dev:ZeissReflectorTurret] Busy flag of device f changed to  true
2022-11-09T11:34:15.671090 tid6268 [dbg,dev:COM17] Read <- (hex) 10 02 11 19 07 07 a3 00 02 0f ff f2 3a 10 10 10 03
2022-11-09T11:34:15.671090 tid6268 [dbg,dev:ZeissReflectorTurret] Monitoring Thread incoming message: 11 19 7 7 a3 0 2 f ff f2 3a 10 
2022-11-09T11:34:15.769430 tid6268 [dbg,dev:COM17] Read <- (hex) 10 02 11 19 07 07 a3 00 02 0f ff f3 0a 76 10 03
2022-11-09T11:34:15.769430 tid6268 [dbg,dev:ZeissReflectorTurret] Monitoring Thread incoming message: 11 19 7 7 a3 0 2 f ff f3 a 76 
2022-11-09T11:34:15.878949 tid6268 [dbg,dev:COM17] Read <- (hex) 10 02 11 19 07 07 a3 00 02 0f ff f5 6a 14 10 03
2022-11-09T11:34:15.878949 tid6268 [dbg,dev:ZeissReflectorTurret] Monitoring Thread incoming message: 11 19 7 7 a3 0 2 f ff f5 6a 14 
2022-11-09T11:34:15.972538 tid9632 [dbg,Core] Finished waiting for device ZeissFocusAxis

Note these are messages from two different threads. The monitoring thread sets the busy flag to true (even though it already was true). Then the main thread finished waiting for the device. That does not make sense. The busy flag has been set true 3 times in a row, and there is nothing in the code setting it false (that happens later in the logs, when the stage reaches its final position).

Not sure how to trouble shoot this further without having the actual equipment. You may need to set up Visual Studio and set breakpoints in the ZeissCAN29 adapter code.

B.t.w., you can use:
core.wait_for_device("ZDrive")
instead of
core.waitForSystem()
(funny that it is camel case)

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