In the last tutorial we learnt how to fly the ardrone using ROS (http://​dasl.mem.drexel.edu/​wiki/​index.php/​Controlling_the_ARDRONE_with_the_Brown-ROS_package). In this tutorial we will learn to access the bottom camera of the ARDRONE and also to toggle the between the two cameras.

+

+

In the [[ardrone_brown_ros|last tutorial]] we learnt how to fly the ardrone using ROS. In this tutorial we will learn to access the bottom camera of the ARDRONE and also to toggle the between the two cameras.

+

+

===== Make the necessary changes =====

+

+

==== ARDRONE_DRIVER.CPP ====

-

==Make the necessary changes==

-

===ARDRONE_DRIVER.CPP===

1.Open up a terminal and enter :

1.Open up a terminal and enter :

Line 12:

Line 15:

2.Now go to folder named "​src"​ and open up the file in '''​ardrone_driver.cpp'''​ in a editor and replace the whole code with the code below.

2.Now go to folder named "​src"​ and open up the file in '''​ardrone_driver.cpp'''​ in a editor and replace the whole code with the code below.

-

====Code====

+

=== Code ===

-

<source lang="​C"​>

+

<code c++ ardrone_driver.cpp>

#include "​ardrone_driver.h"​

#include "​ardrone_driver.h"​

#include "​teleop_twist.h"​

#include "​teleop_twist.h"​

Line 135:

Line 138:

return 0;

return 0;

}

}

-

</source>

+

</code>

-

'''​Save and close the file.'''​

+

**Save and close the file.**

-

===ardrone_driver.h===

+

==== ardrone_driver.h ====

-

In the same folder "​src"​ look for the file "​ardrone_driver.h"​.Open up the file and replace the code with the code below.

+

-

<source lang="C">

+

In the same folder ​"src" ​look for the file "​ardrone_driver.h"​. Open up the file and replace the code with the code below.

+

<code c++ ardronedriver.h>​

#ifndef _ARDRONE_DRIVER_H_

#ifndef _ARDRONE_DRIVER_H_

#define _ARDRONE_DRIVER_H_

#define _ARDRONE_DRIVER_H_

Line 181:

Line 184:

};

};

#endif

#endif

+

</​code>​

+

**save and close the file.**

-

</​source>​

+

==== teleop_twist.cpp ​====

-

+

-

'''​save and close the file.'''​

+

-

+

-

<​br>​

+

-

<​br>​

+

-

===teleop_twist.cpp===

+

In the same folder "​src"​ look for the file "​teleop_twist.cpp"​.Open up the file and replace the code with the code below.

In the same folder "​src"​ look for the file "​teleop_twist.cpp"​.Open up the file and replace the code with the code below.

-

<source lang="​C"​>

+

<code c++ teleop_twist.cpp>

#include "​teleop_twist.h"​

#include "​teleop_twist.h"​

Line 317:

Line 316:

close_teleop

close_teleop

};

};

-

</source>

+

</code>

-

'''​Save and close the file.'''​

+

**Save and close the file.**

-

===teleop_twist.h===

+

+

==== teleop_twist.h ====

Likewise in the same "​src"​ folder open up the file and replace the code with the code below.

Likewise in the same "​src"​ folder open up the file and replace the code with the code below.