Skip to content

ASI stage not waiting for idle before next move #296

Open
@juliomateoslangerak

Description

@juliomateoslangerak

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions