ardrone_bottom_camera
Differences
This shows you the differences between two versions of the page.
ardrone_bottom_camera [2016/11/01 10:56] – created dwallace | 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:// | + | |
+ | 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 " | 2.Now go to folder named " | ||
- | ====Code==== | + | === Code === |
- | <source lang=" | + | <code c++ ardrone_driver.cpp> |
#include " | #include " | ||
#include " | #include " | ||
Line 135: | Line 138: | ||
return 0; | return 0; | ||
} | } | ||
- | </source> | + | </code> |
- | ''' | + | **Save and close the file.** |
- | ===ardrone_driver.h=== | + | ==== ardrone_driver.h ==== |
- | In the same folder " | + | |
- | <source lang="C"> | + | In the same folder |
+ | <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 | ||
+ | </ | ||
+ | **save and close the file.** | ||
- | </ | + | ==== teleop_twist.cpp |
- | + | ||
- | ''' | + | |
- | + | ||
- | < | + | |
- | < | + | |
- | ===teleop_twist.cpp=== | + | |
In the same folder " | In the same folder " | ||
- | <source lang=" | + | <code c++ teleop_twist.cpp> |
#include " | #include " | ||
Line 317: | Line 316: | ||
close_teleop | close_teleop | ||
}; | }; | ||
- | </source> | + | </code> |
- | ''' | + | **Save and close the file.** |
- | ===teleop_twist.h=== | + | |
+ | ==== teleop_twist.h ==== | ||
Likewise in the same " | Likewise in the same " | ||
- | <source lang=" | + | <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:: | //bool toggleCamCallback(std_srvs:: | ||
#endif | #endif | ||
- | </source> | + | </code> |
- | ''' | + | **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=" | ||
- | 1. roscd ardrone_brown | ||
- | 2. sh build_sdk.sh | ||
- | 3. cmake . | + | roscd ardrone_brown |
+ | |||
+ | sh build_sdk.sh | ||
+ | |||
+ | | ||
+ | |||
+ | rosmake | ||
- | 4. rosmake | ||
- | </ | ||
- | ''' | + | **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 | ||
- | | + | |
- | <br>After you enter the drone_teleop package go to folder " | + | |
- | <source lang="python"> | + | After you enter the drone_teleop package go to folder " |
+ | |||
+ | <code python | ||
# | # | ||
import roslib; roslib.load_manifest(' | import roslib; roslib.load_manifest(' | ||
Line 464: | Line 469: | ||
termios.tcsetattr(sys.stdin, | termios.tcsetattr(sys.stdin, | ||
+ | </ | ||
+ | **Save and close the file.** | ||
- | </ | + | ===== Test toggling between the frontal view and bottom view of the ARDRONE ===== |
- | ''' | + | |
- | ==Test toggling between | + | ==== 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(''' | + | 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: | + | |
- | rosrun drone_teleop drone_teleop.py | + | |
+ | roscore | ||
+ | rosrun ardrone_brown ardrone_driver | ||
+ | rosrun image_view image_view image: | ||
+ | rosrun drone_teleop drone_teleop.py | ||
- | ''' | + | **Now you can toggle between the bottom and frontal camera by hitting the letter " |
ardrone_bottom_camera.txt · Last modified: 2016/11/06 02:09 by dwallace