7.5. Getting started with actuators¶
Initialisation and common properties of the
actuator are described below.
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.
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.
184.108.40.206. Initialisation of an actuator¶
Before using an actuator, we have to initialise it.
myactuator = actuator("[your plugin name]") # e.g. "dummyMotor"
Some actuators may start a calibration run after initialization. Ensure that there are no obstacles somewhere.
220.127.116.11. 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.
If you want to move only a relative step relStep from your current position you can do it by this command:
18.104.22.168.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
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
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
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.
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
If you don’t know the name of the parameter you want to check, try getParamListInfo().
22.214.171.124. 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.
7.5.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.
# be gui.myMotorController a designer widget of type MotorController gui.myMotorController["actuator"] = myactuator