AllenNeuralDynamics / python-newscale

Python library for controlling the micromanipulator systems from New Scale Technologies
MIT License
0 stars 0 forks source link

Dev/distance step update #5

Closed Poofjunior closed 1 year ago

Poofjunior commented 1 year ago

Don't merge yet. Needs testing, but I cannot find any spare USB interfaces. Update: this is now tested and confirmed to work.

At the multistage.MultiStage level, I added a move_relative function:

xyz_stage.move_relative(x=10, y=-50)  # move x 10 [um] forward; move y 50 [um] backward

I also tweaked how the multistage class waits for moves to finish to avoid a slight race condition where a stage command has been issued, but the hardware has not registered it as a state change, so the device looks unbusy.

I also updated the implementation of command <06> to abstract out the need to use the Direction enums. Since the numbers are signed, positive is forward, and negative is backward.

stage.distance_step(-10)  # move x 10 [um] backward
stage.set_distance_step_size(-100) # set distance_step without stepping; negative indicates backward step.
stage.distance_step()  # Step previously specified amount
stage.distance_step()  # Step again
stage.distance_step()  # Step again
Poofjunior commented 1 year ago

@chronopoulos just a quick bump. These are relative move commands.