PART B: Line Tracking Using A Camera Module(...continued from this tutorial) After getting the Mid_Pos, steering the robot will be easy. In this tutorial we are going to use the FI40 to steer our robot. However we will not be going through the details of programming the FI40 as this is done on a separate tutorial “Differential drive for a general purpose Bot”. You can attach VBOT.vbC file to the project in the IDE to access the library.
This really simplifies our task. The next task we would need to do is to look for a cross junction. Again we must make a few assumptions about how a cross junction will look like. Essentially, the cross junction should be made up of 2 fairly straight lines.
The above example shows how a good cross junction should look like. Now we need an algorithm to determine if there is a cross section. In Part A, we were looking for a line from y = 60 to y = 100. Basically we are tracking the line at the lower part of the screen. We can now look for the cross junction at the top part of the screen ie y=0 to y = 55.
A simple way is to look for a black line at x = 30 and at x = 130. If we find black pixels at both regions, we can calculate the mid point and check if that point is black.
The code should look something like this. CL = -1 Note: From the illustration above, it is obvious that we could easily look for a line above the horizontal line that we obtained. In order to do this, we should allow the bot to move until the horizontal line is about 30 < y < 40 (that is the CM value must be in between 30 to 40). We can now use the same technique in Part I to look for the vertical line. If the vertical line exists, then it’s a cross junction. If it does not exist then it’s a T-junction.
Download the full source code for the BlazingCore controlling the OLED and CMOS Camera here. Download the full source code for the FlamingICE controlling the tracked robot here.
|






or 