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

Stage start moving before stage up to load position #190

Closed
CedricEsp opened this issue Jul 12, 2022 · 4 comments
Closed

Stage start moving before stage up to load position #190

CedricEsp opened this issue Jul 12, 2022 · 4 comments

Comments

@CedricEsp
Copy link

Hello,

When I move the stage from well to well I try to bring the focus device to the load position between the move but the stage start moving before the focus is done moving up, here the function I use:

def move_load_pos(core=None, XY=None):
    #Move stage to load position
    previous_z = core.getZPosition()
    core.setZPosition(0)
    core.waitForDevice(core.getFocusDevice())
    #Move to XY position
    core.setXYPosition(XY[0] ,XY[1])
    #Bring the stage back down
    core.waitForDevice(core.getXYStageDevice())
    core.setZPosition(previous_z)
    core.waitForDevice(core.getFocusDevice())

Do you see any reason for that to happens? I could definitely add some time delays.

Thanks for all your help!

@CedricEsp
Copy link
Author

CedricEsp commented Jul 14, 2022

To go with that, when I run an engine with multiple position and z stack, the first z image of every position is a little off, while if I add a time.sleep(0.5) before self._mmc.snapImage() it seems to fix the issue.

Here is the engine:

for event in sequence:
            
      cancelled = self._wait_until_event(event, sequence)
      
      # If cancelled break out of the loop
      if cancelled:
          break
      
      logger.info(event)
      
      self._prep_hardware(event)
      
      time.sleep(0.5)
      self._mmc.snapImage()
      self.img = self._mmc.getImage()
      
      self.write_data(event)
      
      self._events.frameReady.emit(self.img, event)
      
self._finish_run(sequence)

@ianhi
Copy link
Contributor

ianhi commented Jul 14, 2022

So in prep_hardware there is a core.waitForSystem() which is meant to block until the hardware is finished moving. If that's not happening then you may want to consider opening an issue on https://github.com/micro-manager/mmCoreAndDevices

@tlambert03
Copy link
Member

@CedricEsp let us know if you need any more help here. but I'll assume this is resolved for now

@CedricEsp
Copy link
Author

Thanks @tlambert03, indeed the issue is with micromanager as suggested by @ianhi

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

3 participants