# MATLAB functions for calibration the actuators (/PTU/stepsPerPixelX and /PTU/stepsPerPixelY)¶

Load the MATLAB functions into the PATH and compile the PTU, camera and SIFTGPU mex files. These functions are organised in folders.

**NOTE: The actuator calibration has to be run only once. If the zoom is changed on the cameras, actuator calibration must be performed again.**

## Steps to perform the calibration of actuators¶

**1)** Initialise "sock = 0"

**2)** Run the following to get images and save them in disk (see sweepScene for more options). Initially, it is required to run for 'X' and 'Y':

sweepScene(sock, 10, 'X', -250, 250);

The last command will sweep a scene over the X axis with a step of 10 motor steps. The scene should contain objects that produce good SIFT features (e.g. cereal box). This function will create a folder named "SX_1000".

**3)** After acquiring all of the desired images in both, 'X' and 'Y' directions, copy the newly created folders to a common directory. It is recommended to capture images with different steps.

**4)** To obtain the calibration parameters of the actuators (following the example) run:

out = calibAct_rh('SX_100', 'png', 1, 1);

For more options type "help calibAct_rh". For each row in "out", the calibration parameters are contained as follows:

- slope
- intercept
- correlation

columns denote left-X coord, left-Y coord, right-X coord and right-Y coord

**5)** Finally, the inverse of the slope computed should be used and defined in /PTU/stepsPerPixelX and /PTU/stepsPerPixelY in the ROS parameter server. The mean value can be used if different steps where considered. One should take care that the correlation is close to one, otherwise the regression is not optimal and a new set of images must be acquired.