This tutorial you will learn to write an other simple program for filtering blue colored objects.In tutorial "How to make ROS and Opencv work together"​ you would have created a package called "​roscv"​ if you have not done that please follow that tutorial. Another prerequisite for this tutorial is the ardrone. I have given directions ​ in the first tutorial on how to connect your computer to the ardrone.

This tutorial you will learn to write an other simple program for filtering blue colored objects.In tutorial "How to make ROS and Opencv work together"​ you would have created a package called "​roscv"​ if you have not done that please follow that tutorial. Another prerequisite for this tutorial is the ardrone. I have given directions ​ in the first tutorial on how to connect your computer to the ardrone.

-

==Add an other source file==

-

step 1:Go to folder named "​src"​ in the package "​roscv"​and create a file called "​bluetrack.cpp"​

-

-

step 2: In the empty file and paste the following code and after that save the file.

-

<source ​lang="C">

+

===== Add an other source ​file =====

+

+

Step 1:Go to folder named "​src"​ in the package "​roscv"​and create a file called ​"bluetrack.cpp"

+

+

Step 2: In the empty file and paste the following code and after that save the file.

+

<code c++ bluetrack.cpp>​

#include <​ros/​ros.h>​

#include <​ros/​ros.h>​

#include <​stdio.h>​

#include <​stdio.h>​

Line 100:

Line 102:

return 0;

return 0;

}

}

-

</source>

+

</code>

+

+

===== Make changes in the CMakeLists.txt =====

-

==Make changes in the CMakeLists.txt==

Step 1:

Step 1:

Open up the file named "​CMakeLists.txt"​ and search for the lines beginning with "​rosbuild_add_executable"​. In that add the file you created which is "​bluetrack.cpp"​. Save and close the file.

Open up the file named "​CMakeLists.txt"​ and search for the lines beginning with "​rosbuild_add_executable"​. In that add the file you created which is "​bluetrack.cpp"​. Save and close the file.

+

===== Test the code =====

-

==Test the code==

Step 1:

Step 1:

While you are at the folder of the package ​ "​roscv"​. Open up a terminal and enter

While you are at the folder of the package ​ "​roscv"​. Open up a terminal and enter

-

cmake .

+

​cmake .

-

<​br>​

+

-

After that enter <br>

+

-

rosmake

+

After that enter

-

<​br>​

+

-

Make sure rosmake gets you "​0"​ failures.

+

+

rosmake

+

Make sure rosmake gets you "​0"​ failures.

Step 2:

Step 2:

Turn on the ARDRONE and connect to it using WiFi.Now enter the following commands one after the other :

Turn on the ARDRONE and connect to it using WiFi.Now enter the following commands one after the other :

-

<br> <br>

-

<pre>

-

roscore ​

-

-

rosrun ardrone_brown ardrone_driver ​

-

-

rosrun roscv roscv

-

</​pre>​

-

-

<​br><​br>​

+

roscore ​

+

rosrun ardrone_brown ardrone_driver ​

+

rosrun roscv roscv

You should be getting two windows. ​ I used a blue cup for detecting and the here is a picture of that.

You should be getting two windows. ​ I used a blue cup for detecting and the here is a picture of that.