Difference between revisions of "AngelR-PFC-Drone01"
(→Installing the Drone) |
m |
||
(25 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | * '''Project Name:''' AR. Drone | + | * '''Project Name:''' PFC-Drone01 |
+ | * '''Author:''' Ángel Rojo Román | ||
+ | * '''Email Addres:''' infarr00@estudiantes.unileon.es | ||
+ | * '''Academic Year:''' 2010-2011 | ||
+ | * '''Degree:''' Undergraduate | ||
+ | * '''Technologies:''' c, opencv, ARDrone API: sdk 1.5, svn | ||
+ | * '''Status:''' Finished | ||
+ | |||
+ | |||
+ | =Flying AR.Drone(9 May 2011)= | ||
+ | |||
+ | * Taking off | ||
+ | |||
+ | ardrone_tool_set_ui_pad_start(1); | ||
+ | |||
+ | * Landing | ||
+ | |||
+ | ardrone_tool_set_ui_pad_start(1); | ||
+ | |||
+ | * Turn to left | ||
+ | |||
+ | ardrone_at_set_progress_cmd(1, 0, 0, 0, -0.3); | ||
+ | |||
+ | * Turn to right | ||
+ | |||
+ | ardrone_at_set_progress_cmd(1, 0.3, 0, 0,0); | ||
+ | |||
+ | * Move Forward | ||
+ | |||
+ | ardrone_at_set_progress_cmd(1,0,-0.3,0,0); | ||
+ | |||
+ | * Move Backward | ||
+ | |||
+ | ardrone_at_set_progress_cmd(1, 0, 0.3, 0, 0); | ||
+ | |||
+ | * Move Up | ||
+ | |||
+ | ardrone_at_set_progress_cmd(1, 0.3, 0, 0.5, 0); | ||
+ | |||
+ | * Move Down | ||
+ | |||
+ | ardrone_at_set_progress_cmd(1, 0.3, 0, 0.5, 0); | ||
+ | |||
+ | * Move to Left | ||
+ | |||
+ | ardrone_at_set_progress_cmd (1, -0.3, 0, 0,0); | ||
+ | |||
+ | * Move to Right | ||
+ | |||
+ | ardrone_at_set_progress_cmd (1, 0.3, 0, 0,0); | ||
+ | |||
+ | =Using Subversion(18 dec 2010)= | ||
+ | |||
+ | * Creating a new Branch for your project | ||
+ | |||
+ | $ svn copy http://robotica.unileon.es/svn/Projects/PFC/ardrone \ | ||
+ | http://robotica.unileon.es/svn/Projects/PFC/ardrone/branches/InterfazArdrone_aroro_18122010 \ | ||
+ | -m "Creating a new branch InterfazArdrone_aroro_18122010." | ||
+ | |||
+ | * Import your project in your branch: | ||
+ | |||
+ | $svn import /(YOUR PROJECT DIR) http://robotica.unileon.es/svn/Projects/PFC/ardrone/branches/InterfazArdrone_aroro_18122010 -m "first import" | ||
+ | |||
+ | * Getting your project: | ||
+ | |||
+ | $svn checkout http://robotica.unileon.es/svn/Projects/PFC/ardrone/branches/InterfazArdrone_aroro_18122010 | ||
+ | |||
+ | * Remove a directory in svn repository: | ||
+ | |||
+ | $svn delete http://(URL DIRECTORY) -m "DIRECTORY DELETED" | ||
+ | |||
+ | =Makefile(18 dec 2010)= | ||
+ | |||
+ | Don't forget use: | ||
+ | |||
+ | * gtk and ardrone libraries: | ||
+ | |||
+ | GENERIC_LIBS=-lpc_ardrone -lgtk-x11-2.0 -lrt | ||
− | * | + | * compile fichero.c: |
− | * ''' | + | GENERIC_BINARIES_COMMON_SOURCE_FILES+= \ |
+ | fichero/fichero.c \ | ||
+ | |||
+ | |||
+ | |||
+ | =Debug File(18 dec 2010)= | ||
+ | |||
+ | I do an other two files called fichero.c and fichero.h | ||
+ | |||
+ | * '''fichero.h''' had the declaration of the function. | ||
+ | |||
+ | * '''fichero.c''' implements ''InsertarDatos'' function. InsertaDatos uses fopen(ruta, "a") to create a debug file or append text if the file already exist. | ||
+ | |||
+ | |||
+ | To check if debug is active, I use a control variable called debug in main. If debug = 0, debug file is not active. If debug =1, debug file is active. | ||
+ | |||
+ | =Building a GTK window(18 dec 2010)= | ||
+ | |||
+ | To Build a window you need gtk library: #include <gtk/gtk.h>. To keep a clear code, the main function have a call to paint the window. | ||
+ | |||
+ | int | ||
+ | main (int argc, char *argv[]){ | ||
+ | GtkWidget *window; | ||
+ | gtk_init (&argc, &argv); | ||
+ | window = create_window (); | ||
+ | gtk_widget_show_all (window); | ||
+ | gtk_main (); | ||
+ | return 0; | ||
+ | } | ||
+ | |||
+ | There is an other functions for received the events for the buttons: | ||
+ | |||
+ | void on_button_aterrizar(GtkButton * button, gpointer user_data); | ||
+ | void on_button_despegar(GtkButton * button, gpointer user_data); | ||
+ | void on_button_mostrar_video(GtkButton * button, gpointer user_data); | ||
+ | void on_button_debug(GtkButton * button, gpointer user_data); | ||
+ | void on_button_ocultar_video(GtkButton * button, gpointer user_data); | ||
+ | void func_crea_ventana_video(GtkButton * button, gpointer user_data); | ||
+ | void func_oculta_ventana_video(GtkButton * button, gpointer user_data); | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | =Installing OpenCv (1 dec 2010)= | ||
+ | |||
+ | Open a new terminal and go to your workspace. The fist step is get the Opencv package: | ||
+ | |||
+ | svn co https://opencvlibrary.svn.sourceforge.net/svnroot/opencvlibrary/tags/latest_tested_snapshot | ||
+ | |||
+ | Building Opencv: | ||
+ | |||
+ | cd /opencv | ||
+ | mkdir release | ||
+ | cd release | ||
+ | cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_PYTHON_SUPPORT=ON .. | ||
+ | |||
+ | After this command, you can see a list of libraries you don't have. Use Synaptic to install it. | ||
+ | |||
+ | make | ||
+ | sudo make install | ||
+ | |||
+ | |||
+ | |||
+ | =Configuring ARDrone API: sdk 1.5 with Ps3pad in Linux (25 nov 2010)= | ||
+ | |||
+ | |||
+ | |||
+ | '''Downloading sdk 1.5''' | ||
+ | |||
+ | *You should register in [https://projects.ardrone.org ARDRONE open API platform]. | ||
+ | *Download [https://projects.ardrone.org/attachments/download/221/ARDrone_SDK_1_5_Version_20101004.tar.gz sdk 1.5]. | ||
+ | *Unpack the archive ARDrone_SDK_1_5_Version_20101004.tar.gz | ||
+ | |||
+ | |||
+ | '''Configure example files''' | ||
+ | |||
+ | *'''sdk_demo: '''It's the most simple example, you should change two files, so: | ||
+ | |||
+ | cd (SKD)/Examples/Linux/sdk_demo/Sources | ||
+ | |||
+ | The first file is ''ardrone_testing_tool.c'', it contains the main function in the project. You need to edit the input device, so copy this line into your file: | ||
+ | |||
+ | ardrone_tool_input_add( &ps3pad ); | ||
+ | |||
+ | The other file is ''/UI/gamepad.h'' and serves to configure Ps3pad buttons, you can copy the next values: | ||
+ | |||
+ | #define GAMEPAD_PLAYSTATION3_ID 0x054C0268 | ||
+ | typedef enum | ||
+ | { | ||
+ | PS3BTN_SELECT=0, | ||
+ | PS3BTN_L3=1, | ||
+ | PS3BTN_R3=2, | ||
+ | PS3BTN_START=3, | ||
+ | PS3BTN_UPARROW=4, | ||
+ | PS3BTN_RIGHTARROW=5, | ||
+ | PS3BTN_DOWNARROW=6, | ||
+ | PS3BTN_LEFTARROW=7, | ||
+ | PS3BTN_L2=8, | ||
+ | PS3BTN_R2=9, | ||
+ | PS3BTN_L1=10, | ||
+ | PS3BTN_R1=11, | ||
+ | PS3BTN_TRIANGLE=12, | ||
+ | PS3BTN_CIRCLE=13, | ||
+ | PS3BTN_CROSS=14, | ||
+ | PS3BTN_SQUARE=15, | ||
+ | PS3BTN_PS3=16, | ||
+ | }PS3PAD_BUTTONS; | ||
+ | |||
+ | *'''Navigation: '''This is a more complete example, the change is exactly the same as the second step in the '''sdk_demo example'''. | ||
+ | |||
+ | |||
+ | '''Compile and Running the examples''' | ||
+ | |||
+ | *The first step is get some libraries that let us compile ARDONE skd: | ||
+ | |||
+ | $sudo apt-get install libsdl-dev libgtk2.0-dev libiw-dev | ||
+ | |||
+ | *Next you must build the ARDroneLIB library | ||
− | + | $cd SDK /ARDroneLib/Soft/Build | |
+ | $make | ||
− | * | + | * Compile the sdk_demo example: |
− | + | $cd SDK /Examples/Linux/sdk_demo/Build | |
+ | $make | ||
− | * | + | * Compile the Navigation example: |
− | + | $cd SDK /Examples/Linux/Navigation/Build | |
+ | $make | ||
− | + | Now, you should have two executable files in (SDK)/Examples/Linux/Build/Release. Plug your ps3pad and prepare yourself to fly the PARROT ARDrone. | |
− | * | + | *Execute the sdk_demo example: |
− | + | ./linux_sdk_demo | |
− | + | *Execute the Navigation example: | |
− | + | ./ardrone_navigation |
Latest revision as of 08:37, 25 June 2014
- Project Name: PFC-Drone01
- Author: Ángel Rojo Román
- Email Addres: infarr00@estudiantes.unileon.es
- Academic Year: 2010-2011
- Degree: Undergraduate
- Technologies: c, opencv, ARDrone API: sdk 1.5, svn
- Status: Finished
Contents
Flying AR.Drone(9 May 2011)
- Taking off
ardrone_tool_set_ui_pad_start(1);
- Landing
ardrone_tool_set_ui_pad_start(1);
- Turn to left
ardrone_at_set_progress_cmd(1, 0, 0, 0, -0.3);
- Turn to right
ardrone_at_set_progress_cmd(1, 0.3, 0, 0,0);
- Move Forward
ardrone_at_set_progress_cmd(1,0,-0.3,0,0);
- Move Backward
ardrone_at_set_progress_cmd(1, 0, 0.3, 0, 0);
- Move Up
ardrone_at_set_progress_cmd(1, 0.3, 0, 0.5, 0);
- Move Down
ardrone_at_set_progress_cmd(1, 0.3, 0, 0.5, 0);
- Move to Left
ardrone_at_set_progress_cmd (1, -0.3, 0, 0,0);
- Move to Right
ardrone_at_set_progress_cmd (1, 0.3, 0, 0,0);
Using Subversion(18 dec 2010)
- Creating a new Branch for your project
$ svn copy http://robotica.unileon.es/svn/Projects/PFC/ardrone \ http://robotica.unileon.es/svn/Projects/PFC/ardrone/branches/InterfazArdrone_aroro_18122010 \ -m "Creating a new branch InterfazArdrone_aroro_18122010."
- Import your project in your branch:
$svn import /(YOUR PROJECT DIR) http://robotica.unileon.es/svn/Projects/PFC/ardrone/branches/InterfazArdrone_aroro_18122010 -m "first import"
- Getting your project:
$svn checkout http://robotica.unileon.es/svn/Projects/PFC/ardrone/branches/InterfazArdrone_aroro_18122010
- Remove a directory in svn repository:
$svn delete http://(URL DIRECTORY) -m "DIRECTORY DELETED"
Makefile(18 dec 2010)
Don't forget use:
- gtk and ardrone libraries:
GENERIC_LIBS=-lpc_ardrone -lgtk-x11-2.0 -lrt
- compile fichero.c:
GENERIC_BINARIES_COMMON_SOURCE_FILES+= \ fichero/fichero.c \
Debug File(18 dec 2010)
I do an other two files called fichero.c and fichero.h
- fichero.h had the declaration of the function.
- fichero.c implements InsertarDatos function. InsertaDatos uses fopen(ruta, "a") to create a debug file or append text if the file already exist.
To check if debug is active, I use a control variable called debug in main. If debug = 0, debug file is not active. If debug =1, debug file is active.
Building a GTK window(18 dec 2010)
To Build a window you need gtk library: #include <gtk/gtk.h>. To keep a clear code, the main function have a call to paint the window.
int main (int argc, char *argv[]){ GtkWidget *window; gtk_init (&argc, &argv); window = create_window (); gtk_widget_show_all (window); gtk_main (); return 0; }
There is an other functions for received the events for the buttons:
void on_button_aterrizar(GtkButton * button, gpointer user_data); void on_button_despegar(GtkButton * button, gpointer user_data); void on_button_mostrar_video(GtkButton * button, gpointer user_data); void on_button_debug(GtkButton * button, gpointer user_data); void on_button_ocultar_video(GtkButton * button, gpointer user_data); void func_crea_ventana_video(GtkButton * button, gpointer user_data); void func_oculta_ventana_video(GtkButton * button, gpointer user_data);
Installing OpenCv (1 dec 2010)
Open a new terminal and go to your workspace. The fist step is get the Opencv package:
svn co https://opencvlibrary.svn.sourceforge.net/svnroot/opencvlibrary/tags/latest_tested_snapshot
Building Opencv:
cd /opencv mkdir release cd release cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_PYTHON_SUPPORT=ON ..
After this command, you can see a list of libraries you don't have. Use Synaptic to install it.
make sudo make install
Configuring ARDrone API: sdk 1.5 with Ps3pad in Linux (25 nov 2010)
Downloading sdk 1.5
- You should register in ARDRONE open API platform.
- Download sdk 1.5.
- Unpack the archive ARDrone_SDK_1_5_Version_20101004.tar.gz
Configure example files
- sdk_demo: It's the most simple example, you should change two files, so:
cd (SKD)/Examples/Linux/sdk_demo/Sources
The first file is ardrone_testing_tool.c, it contains the main function in the project. You need to edit the input device, so copy this line into your file:
ardrone_tool_input_add( &ps3pad );
The other file is /UI/gamepad.h and serves to configure Ps3pad buttons, you can copy the next values:
#define GAMEPAD_PLAYSTATION3_ID 0x054C0268 typedef enum { PS3BTN_SELECT=0, PS3BTN_L3=1, PS3BTN_R3=2, PS3BTN_START=3, PS3BTN_UPARROW=4, PS3BTN_RIGHTARROW=5, PS3BTN_DOWNARROW=6, PS3BTN_LEFTARROW=7, PS3BTN_L2=8, PS3BTN_R2=9, PS3BTN_L1=10, PS3BTN_R1=11, PS3BTN_TRIANGLE=12, PS3BTN_CIRCLE=13, PS3BTN_CROSS=14, PS3BTN_SQUARE=15, PS3BTN_PS3=16, }PS3PAD_BUTTONS;
- Navigation: This is a more complete example, the change is exactly the same as the second step in the sdk_demo example.
Compile and Running the examples
- The first step is get some libraries that let us compile ARDONE skd:
$sudo apt-get install libsdl-dev libgtk2.0-dev libiw-dev
- Next you must build the ARDroneLIB library
$cd SDK /ARDroneLib/Soft/Build $make
- Compile the sdk_demo example:
$cd SDK /Examples/Linux/sdk_demo/Build $make
- Compile the Navigation example:
$cd SDK /Examples/Linux/Navigation/Build $make
Now, you should have two executable files in (SDK)/Examples/Linux/Build/Release. Plug your ps3pad and prepare yourself to fly the PARROT ARDrone.
- Execute the sdk_demo example:
./linux_sdk_demo
- Execute the Navigation example:
./ardrone_navigation