7.6. Getting started with actuators

7.6.1. Introduction

This tutorial gives a short introduction to the use of the class actuator. Similar tutorials are available for grabbers and A/D converters.

Initialisation and common properties of the actuator are described below.

7.6.2. Functions

For this tutorial, we will focus on the standard application of actuators: move or rotate some stage. The axis numbers of the actuator are define 0 for x, 1 for y and 2 for z. If the actuator have only one axis, the number is 0.

Note

As one of the major advatages of the plugin concept, all actuators shall behave in the same manner when given the same command. There may however be some special properties of some devices, wich cause slightly different behavior in very specialised cases. For further information read the plugin documentation of your device.

7.6.2.1. Initialisation of an actuator

Before using an actuator, we have to initialise it.

1
myactuator = actuator("[your plugin name]") # e.g. "dummyMotor"

Note

Some actuators may start a calibration run after initialization. Ensure that there are no obstacles somewhere.

7.6.2.2. Move actuator

Actuators can be moved by using the function setPosRel() for relative move steps and setPosAbs() for absolut move steps. Depending on your application one of both may be better to use. Following command moves the axis of your actuator to the absolute absPos position in global actuator coordinates. It may be useful to run the calibration before usage.

1
myactuator.setPosAbs(axis, absPos)

If you want to move only a relative step relStep from your current position you can do it by this command:

1
myactuator.setPosRel(axis, relStep)

7.6.2.2.1. Move actuator and take pictures

Most times an actuator is used to move your object you want to measure and take a picture by a camera. First you need a running instance of your actuator and dataIO grabber (Getting started with grabbers). Define the parameters of the camera and actuator parameters before usage. Define your dataObject to save the captured data. Then you need to define the actuator trajectory as absolute or relative positions.

This example shows how you can move your object and take a picture at different positions using relative position steps:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
numberPos = 10 #number of positions
relStepSize = 0.1 # relative step size 100um
axis = 2 #move in z direction
sizeX = mycamera.getParam("sizex")
sizeY = mycamera.getParam("sizey")
dObj = dataObject([numberPos, sizeY, sizeX]) #define dataObject with the size: numberPos x sizeY x sizeX.
for cnt in range(0, numberPos): #loop to get at each position a camera picture
    myactuator.setPosRel(axis, relStepSize)
    d = dataObject()
    mycamera.acquire()
    mycamera.getVal(d)
    dObj[cnt,:,:] = d

Note

Depending on your application it may be better first to acquire the camera and then to move the actuator.

This example shows how you can do the same procedure using absolute actuator positions:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
numberPos = 10 #number of positions
relStepSize = 0.1 # relative step size 100um
axis = 2 #move in z direction
currentPos = myactuator.getPos(axis)
sizeX = mycamera.getParam("sizex")
sizeY = mycamera.getParam("sizey")
dObj = dataObject([numberPos, sizeY, sizeX]) #define dataObject with the size: numberPos x sizeY x sizeX.
for cnt in range(0, numberPos): #loop to get at each position a camera picture
    myactuator.setPosAbs(axis, currentPos + cnt * relStepSize)
    d = dataObject()
    mycamera.acquire()
    mycamera.getVal(d)
    dObj[cnt,:,:] = d

Note

Some actuators may have only the option to move in absolute positions. Hence, here the first acquisition position is as the currentPos position, because the first loop has for the variable cnt the value 0.

7.6.3. Parameters

Most actuator plugins let you control the device’s settings through a set of parameters. Common parameters are speed, accel or async. Some are read only. Parameters are checked and set by getParam() and setParam() as seen here

Note

If you don’t know the name of the parameter you want to check, try getParamListInfo().

7.6.3.1. Synchronized/ Asynchronized move

As default the actuators move command waits until the actuator has arrived the target position. With the parameter async you can deactivate the option and the itom script will not wait until the end of the movement.

1
myactuator.setParam("async", 1)

7.6.4. Use actuator in your own GUI

If you are developing your own GUI and want to use the current position of each actuator axis, you can assign the actuator to the design widget MotorController.

1
2
# be gui.myMotorController a designer widget of type MotorController
gui.myMotorController["actuator"] = myactuator