8.6. 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.
220.127.116.11. Initialisation of an actuator¶
Before using an actuator, we have to initialise it.
1myactuator = actuator("[your plugin name]") # e.g. "dummyMotor"
Some actuators may start a calibration run after initialization. Ensure that there are no obstacles somewhere.
18.104.22.168. 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:
22.214.171.124.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:
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
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
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().
126.96.36.199. 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.
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