<< Click to Display Table of Contents >> Search and approach |
This example describes a program which allows Robotino to search for a colored object and drive to it. The program consists of two sub programs:
• | Rotate: This sub program rotates Robotino towards the colored object |
• | Approach: This sub program drives Robotino to the colored object and stops as soon as the object area in the camera image exceeds some threshold. |
The main program looks like shown below:
From the empty init step the main program directly executes "Step1". This sub program is executed as long as the global variable "next" equals 0. The sub program "Rotate" sets "next" to 1, as soon as Robotino is facing the colored object.
The sub program "Approach" sets "next" to 0 on startup. When the distance between Robotino and the colored object falls below a certain threshold "next" is set to 1 by the sub program "Approach". The main program terminates by a jump to "Terminate".