Actuator calibration MATLAB functions (/PTU/stepsPerPixelX and /PTU/stepsPerPixelY)¶
Load the MATLAB functions into the PATH and compile the PTU, camera and SIFTGPU mex files using the provided MakeFiles. A MATLAB script has been included in the "MATLAB_actuatorCalib" folder that compiles and sets up paths but if there are any erros, specially during compilation, one can compile each MEX file on the Linux terminal.
A slower version for extracting SIFT features is also included. To enable this, in calibAct_rh.m set: logger.GPU = false in line 42.
NOTE: The actuator calibration has to be run only once. If the camera's zoom is changed, the actuator calibration must be performed again.
NOTE 2: If you get an error regarding shared libraries that MATLAB could not find, you just need to simply run this from a terminal window: LD_PRELOAD=/usr/local/opencv/lib matlab
Steps to perform the calibration of actuators¶
The script scriptCalib.m in the ActuatorCalibration folder describes the procedure to calibrate the actuators. For completeness, the steps are described as follows:
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:
columns denote left-X coord, left-Y coord, right-X coord and right-Y coord
5) Finally, 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.