User Tools

Site Tools


ardrone_bottom_camera

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

ardrone_bottom_camera [2016/11/01 10:56]
dwallace created
ardrone_bottom_camera [2016/11/06 02:09] (current)
dwallace
Line 1: Line 1:
 ====== Getting the Bottom Camera View from the Ar.Drone ====== ====== Getting the Bottom Camera View from the Ar.Drone ======
  
-==Introduction== +===== Introduction ===== 
-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.
  
-<source lang="​C"​>+<code c++ teleop_twist.h>
 #ifndef _TELEOP_TWIST_H_ #ifndef _TELEOP_TWIST_H_
 #define _TELEOP_TWIST_H_ #define _TELEOP_TWIST_H_
Line 343: Line 344:
 //bool toggleCamCallback(std_srvs::​Empty::​Request&​ request, std_srvs::​Empty::​Response&​ response); //bool toggleCamCallback(std_srvs::​Empty::​Request&​ request, std_srvs::​Empty::​Response&​ response);
 #endif #endif
-</source+</code
-'''​Save  and close the file.'''​+**Save  and close the file.** 
 + 
 +===== Compile the ardrone_brown package again =====
  
-==Compile the ardrone_brown package again== 
 Open up a new terminal and enter the following commands one after the other. Open up a new terminal and enter the following commands one after the other.
-<source lang="​C">​ 
-1.  roscd ardrone_brown 
  
-2. sh build_sdk.sh 
  
-3. cmake .+  roscd ardrone_brown 
 + 
 +  sh build_sdk.sh 
 + 
 +  ​cmake . 
 + 
 +  rosmake
  
-4. rosmake 
-</​source>​ 
    
-'''​Make sure you get 0 failures while making this package.'''​+**Make sure you get 0 failures while making this package.**
  
  
-==Adding the toggle cam option in the drone_teleop package==+===== Adding the toggle cam option in the drone_teleop package ​=====
  
 Open up a new terminal and enter  Open up a new terminal and enter 
  
-    ​roscd drone_teleop +  ​roscd drone_teleop 
-<br>After you enter the drone_teleop package go to folder "​bin"​ and open up the file drone_teleop.py and replace the code in the file with the code below. +     
-<source lang="python">+After you enter the drone_teleop package go to folder "​bin"​ and open up the file drone_teleop.py and replace the code in the file with the code below. 
 + 
 +<code python ​drone_teleop.py>
 #​!/​usr/​bin/​env python #​!/​usr/​bin/​env python
 import roslib; roslib.load_manifest('​drone_teleop'​) import roslib; roslib.load_manifest('​drone_teleop'​)
Line 464: Line 469:
     termios.tcsetattr(sys.stdin,​ termios.TCSADRAIN,​ settings)     termios.tcsetattr(sys.stdin,​ termios.TCSADRAIN,​ settings)
  
 +</​code>​
 +**Save and close the file.**
  
-</​source>​ +===== Test toggling between the frontal view and bottom view of the ARDRONE =====
-'''​Save ​and close the file.'''​+
  
-==Test toggling between ​the frontal view and bottom view of the ARDRONE.==+==== Set up the connection with the ardrone ====
  
-===Set up the connection with the ardrone=== 
 Turn on the ARDRONE and make sure the led lights on the ARDRONE turns green. Turn on the ARDRONE and make sure the led lights on the ARDRONE turns green.
  
 Make sure you connect to the ARDRONE by synchronizing with the wi-fi of your Computer. ​ Make sure you connect to the ARDRONE by synchronizing with the wi-fi of your Computer. ​
  
-1.Open up a new terminal and enter the commands('''​each of them must be entered in a new terminal one after the other'''​): +1.Open up a new terminal and enter the commands (**each of them must be entered in a new terminal one after the other**):
- +
-    roscore +
-    rosrun ardrone_brown ardrone_driver +
-    rosrun image_view image_view image:​=/​ardrone/​image_raw +
-    rosrun drone_teleop drone_teleop.py+
  
 +  roscore
 +  rosrun ardrone_brown ardrone_driver
 +  rosrun image_view image_view image:​=/​ardrone/​image_raw
 +  rosrun drone_teleop drone_teleop.py
  
-'''​Now you can toggle between the bottom and frontal camera by hitting the letter "​C"​.'''​+**Now you can toggle between the bottom and frontal camera by hitting the letter "​C"​.**
ardrone_bottom_camera.txt · Last modified: 2016/11/06 02:09 by dwallace