8.6. Getting started with actuators#

8.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.

8.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, which cause slightly different behavior in very specialised cases. For further information read the plugin documentation of your device.

8.6.2.1. Initialisation of an actuator#

Before using an actuator, we have to initialise it.

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

Note

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

8.6.2.2. Move actuator#

Actuators can be moved by using the function setPosRel() for relative move steps and setPosAbs() for absolute 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.

1myactuator.setPosAbs(axis, absPos)

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

1myactuator.setPosRel(axis, relStep)

8.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:

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

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

8.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().

8.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. The next moving command will wait until the previously target is reached.

1myactuator.setParam("async", 1)

8.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# be gui.myMotorController a designer widget of type MotorController
2gui.myMotorController["actuator"] = myactuator