Khepera III Toolbox/Examples/infrared proximity sensor response

This example shows how to experimentally measure the response of the infrared sensors in proximity mode. The robot starts right in front of an obstacle and then moves backwards in small steps. After each step, a series of infrared proximity measurements are taken.

Setup
Boot a Khepera III robot and make sure it is connected to your computer via WLAN. In the following explanation, we assume that you are working with robot 203. Put the robot in front of an obstacle and make sure that there is at least 50 cm space behind it.

Copy the motor_initialize, motor_stop and infrared_proximity programs onto the robot cd Programs k3put +203 motor_initialize motor_stop infrared_proximity Log on to the robot k3go +203 and type cd your_username ./motor_initialize to initialize the motors.

To check if everything is working, type ./infrared_proximity If your robot touches the obstacle in front of it, you should get results like this: The two highest values in the middle (3963 and 3965) belong to the front sensors and are those which we actually use in this experiment. These values may differ in your setup, since they are heavily influenced by the color and texture of your obstacle. Don't worry if you get values around 3000.

Running the Experiment
Position the robot right in front of your obstacle (such that it touches the obstacle) and launch ./run.pl The robot will now move backwards in small steps and take 10 infrared measurements which are stored in a file called run_results in the same folder. A complete run will take about 2 min, and the robot will stay at its place afterwards.

Parsing the Result File
Type the following line to process the result file ./parse_results.pl 5 < run_results > matlab_run_results_5 ./parse_results.pl 6 < run_results > matlab_run_results_6

Sensors 5 and 6 are the two front sensors. You could - in a similar fashion - take measurements with the other sensors as well.

Plotting the Result in Matlab
Launch Matlab and type plot_results The resulting diagram will show a curve for both sensors. Each point is an average of 10 samples.