ardrone_line_following
Differences
This shows you the differences between two versions of the page.
Last revisionBoth sides next revision | |||
ardrone_line_following [2016/11/01 11:05] – created dwallace | ardrone_line_following [2016/11/06 02:37] – dwallace | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Making the AR.Drone do Line Following ====== | ====== Making the AR.Drone do Line Following ====== | ||
- | =Introduction= | + | ==== Introduction ===== |
In this tutorial we will scratch the surface of computer vision and robotics. In the past tutorials you controlled the ardrone using the keyboard and also joystick but autonomy did not come into play. This tutorial opens the gate of machine learning ,control systems and autonomous aerial vehicles. | In this tutorial we will scratch the surface of computer vision and robotics. In the past tutorials you controlled the ardrone using the keyboard and also joystick but autonomy did not come into play. This tutorial opens the gate of machine learning ,control systems and autonomous aerial vehicles. | ||
- | ==Goal== | + | ==== Goal ==== |
The purpose of this tutorial is to implement basic computer vision algorithms for the autonomy of the ardrone. The bottom camera of the ardrone is use to track a line and keep on course. I used a proportional controller in this case to make this simple and you can develop it from here to make it do complex things. All of the code developed in my tutorial is for basic autonomy of the quad-rotor ardrone. | The purpose of this tutorial is to implement basic computer vision algorithms for the autonomy of the ardrone. The bottom camera of the ardrone is use to track a line and keep on course. I used a proportional controller in this case to make this simple and you can develop it from here to make it do complex things. All of the code developed in my tutorial is for basic autonomy of the quad-rotor ardrone. | ||
- | == Add the line following module == | + | ==== Add the line following module |
- | In order to continue with this tutorial make sure you finished | + | In order to continue with this tutorial make sure you finished |
Step 1: | Step 1: | ||
Open up a new terminal and enter: | Open up a new terminal and enter: | ||
- | <br> < | + | |
+ | | ||
Step 2: | Step 2: | ||
Go to folder named " | Go to folder named " | ||
- | <source lang="python"> | + | <code python |
# | # | ||
import roslib; roslib.load_manifest(' | import roslib; roslib.load_manifest(' | ||
Line 170: | Line 172: | ||
termios.tcsetattr(sys.stdin, | termios.tcsetattr(sys.stdin, | ||
- | </source> | + | </code> |
- | + | **Save | |
- | + | ||
- | < | + | |
Step 3: | Step 3: | ||
Go to the folder bin in drone_teleop and right lick on the file " | Go to the folder bin in drone_teleop and right lick on the file " | ||
- | + | Step 4: | |
- | step 4: | + | |
Go to folder named " | Go to folder named " | ||
- | step 5: | + | Step 5: |
In the empty file and paste the following code and after that save the file. | In the empty file and paste the following code and after that save the file. | ||
- | <source lang="c"> | + | |
+ | << | ||
#include < | #include < | ||
#include < | #include < | ||
Line 349: | Line 349: | ||
return 0; | return 0; | ||
} | } | ||
+ | </ | ||
- | </ | + | ===== Make changes in the CMakeLists.txt |
- | + | ||
- | =Make changes in the CMakeLists.txt= | + | |
Step 1: Open up the file named " | Step 1: Open up the file named " | ||
- | =Environmental setup= | + | ===== Environmental setup ===== |
Step 1: | Step 1: | ||
Make sure you have a plain ground and paste tape on it so that it would form a straight line(not necessarily perfect | Make sure you have a plain ground and paste tape on it so that it would form a straight line(not necessarily perfect | ||
- | [[image:line1.jpg|200px|sample line on the floor]] | + | {{dylanw:line1.jpg}}\\ |
- | [[image:line2.jpg|200px|sample line on the floor]] | + | {{dylanw:line2.jpg}}\\ |
- | [[image:line3.jpg|200px|sample line on the floor]] | + | {{dylanw:line3.jpg}}\\ |
Step 2: | Step 2: | ||
After you have set the line,run and test the program. | After you have set the line,run and test the program. | ||
Make sure you have done the following things before you fly. | Make sure you have done the following things before you fly. | ||
+ | |||
1. Interface the drone with laptop | 1. Interface the drone with laptop | ||
2. Make sure you have connected the joystick to the computer (logitech dual controller) | 2. Make sure you have connected the joystick to the computer (logitech dual controller) | ||
Line 377: | Line 377: | ||
Open up a terminal and enter the commands one after the other: | Open up a terminal and enter the commands one after the other: | ||
- | < | + | |
- | roscd roscv | + | cmake . |
- | cmake . | + | rosmake |
- | rosmake | + | |
- | </ | + | |
Step 4: | Step 4: | ||
Line 388: | Line 386: | ||
Enter the following commands each in a new terminal: | Enter the following commands each in a new terminal: | ||
- | < | + | |
- | roscore | + | rosrun ardrone_brown ardrone_driver |
- | rosrun ardrone_brown ardrone_driver | + | rosrun joy joy_node |
- | rosrun joy joy_node | + | rosrun roscv roscv |
- | rosrun roscv roscv | + | rosrun drone_teleop linefollow.py |
- | rosrun drone_teleop linefollow.py | + | |
- | </ | + | |
Step 5: | Step 5: | ||
Line 403: | Line 399: | ||
Now the drone is in autonomous mode. Your controls wont have any effect here.It should be following the line now.To have the control of the drone hit button 8 again and it should be in manual mode. | Now the drone is in autonomous mode. Your controls wont have any effect here.It should be following the line now.To have the control of the drone hit button 8 again and it should be in manual mode. | ||
- | =Video= | + | ===== Video ===== |
- | <html> | + | {{youtube> |
- | <iframe width=" | + | |
- | </ | + |
ardrone_line_following.txt · Last modified: 2016/11/06 02:38 by dwallace