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

ASI stage not waiting for idle before next move #296

Open
juliomateoslangerak opened this issue Nov 2, 2023 · 1 comment
Open

ASI stage not waiting for idle before next move #296

juliomateoslangerak opened this issue Nov 2, 2023 · 1 comment

Comments

@juliomateoslangerak
Copy link
Contributor

juliomateoslangerak commented Nov 2, 2023

While setting some experiments I realized that the stage was not waiting until the next move.

I think I fixed this and I also tried to remove some redundancy in the code managing the moves and the waiting for the stage to idle.

This is all in my branch here. @iandobbie can you check this? You can use this code to test with a tiling array. In my case it was drawing little circles no matter the size of the tile. now it seems to work. Simultaneous move in x and y is kept.

PORT = None
baudrate = 9600

from microscope.controllers.asi import ASIMS2000
controller = ASIMS2000(port=PORT, baudrate=baudrate)
stage = controller.devices["stage"]
stage.enable()

x_tile_size = 1000
y_tile_size = 1000
array_size = 5

pre_experiment_position = stage.position

def spiral(n):
    x = y = 0
    dx = 0
    dy = -1
    for i in range(n**2):
        if (-n/2 < x <= n/2) and (-n/2 < y <= n/2):
            yield (pre_experiment_position["X"] + (x * x_tile_size) , 
                   pre_experiment_position["Y"] + (y * y_tile_size))
        if x == y or (x < 0 and x == -y) or (x > 0 and x == 1-y):
            dx, dy = -dy, dx
        x, y = x+dx, y+dy
        
for pos_x, pos_y in spiral(array_size):
    stage.move_to({"X": pos_x, "Y": pos_y})

stage.move_to(pre_experiment_position)
@iandobbie
Copy link
Collaborator

This appears to work fine. I didnt have a camera connected and wasn't taking images but from feeling the stage it appears to move in x and then y, then back in x etc. The movement weren't regular I assume this is this is the servo have a bit of variable seek time, I strongly suspect out stage could do with some lubrication. I might try to do this.

Overall I think the ASI updates are a big win and appear to work so should be merged into master.

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

No branches or pull requests

2 participants