Flying the Ar.Drone 2.0 is an interesting and enjoyable experience. We hope to increase the experience for the reader by providing step-by- step tutorial to program the drone. This article will guide the reader to create a platform to program the basic functionalities of the Ar.Drone.
Programming the Parrot AR.Drone 2.0
The smartphone apps are very efficient for flying the drones and they provide pre-built features, but the Parrot Ar.Drone is also programmable. Here we provide a step-by-step hands-on tutorial to program the Parrot Ar.Drone, using Java APIs. The tutorial has two phases, one to create the control panel and the second to connect the panel to the drone functions.
- The Parrot Ar.Drone 2.0
- An Ms Windows or Mac os computer/laptop with Wi-Fi connectivity.
- Download and install the NetBeans Integrated Development Environment (IDE)¹. Ensure to download the correct version depending on your computer’s operating system (Windows or Mac).
- Some knowledge of a programming language preferably Java.
Create a basic control panel for the drone using Java Graphical User Interface (GUI). With the control panel the take-off, and Land functions of the Ar.Drone is accessed. The process of creating a basic control panel for the drone is done in two phases. The first phase is to create a simple GUI using Java swing. The second phase is to connect the GUI elements with the Drone’s functionalities.
Phase 1: At the end of this phase you will create a control panel as shown below
Phase 1 steps:
1. Open NetBeans and create a new project i.e. New Java Application, as shown in the figure below.
- Project name: DronePanel
- Exclude the creation of Main class, by leaving the option unchecked (circled in figure).
2. In the left panel, use the right mouse click on the project name (DronePanel) and create a new JFrame Form by selecting new- >JFrame Form. The JFrame will contain for the control panel for the drone.
3. In the next window, provide the class name and package name for the JFrame Form.
- Class name: ControlPanel
- Package: drone
5. To create the control panel:
a. Drag the button GUI three times from the Palette onto the Frame. Similarly drag the Label GUI from the Palette onto the Frame and arrange it as shown below.
b. Select each of the GUI elements, and change the text property in the Properties window to reflect the names shown below.
6. Save and Run the project to test the look of the GUI panel. The Run option can be found in the menu of NetBeans.
Phase 1 conclusion:
In this phase we created a control panel using simple Java GUI to control two functions of the drone i.e. take- off and Land. The third button is to stop and exit the control panel.
Phase 2: In this phase you will connect the GUI buttons that was created in the previous phase to the functions that control the drone.
Phase 2 steps:
1. Add Library to the DronePanel Project.
- A Library is a set of programs that are already made available for a specific purpose. Java libraries are usually called JAR files.
- Download the JAR file for drone functions
i. In your browser, navigate to the following location² (copy paste the URL to your browser):
http://vsis-www.informatik.uni- hamburg.de/oldserver/teaching/ projects/yadrone/download.html
111. Click on: jar (Library only)
1v. This will download the file yadrone_32.jar, to your computer.
c. Include the Jar file into the project that was created in Phase 1 (see figure below).
- Right mouse click on the Project name in the left panel.
- Go to the Properties of the project
- Select Libraries from Categories
- Click on Add Jar/Folders on the right
- Select the downloaded Jar file (yadrone_032.jar) on your computer, to include it into your project
d. If the file was included correctly you should see the Jar file included in the Library folder of your project.
2. 2. Initial Configuration in ControlPanel.java, source file (see figure below).
a. Double mouse click the ControlPanel.java file under source Packages.
b. Make the following changes as shown in figure below
1. Create a global instance of iArDrone class.
11. Initialize the Drone Managers.
111. Import the two class ArDrone and iArDrone.
3. Next, the functions for three button are added to the source code.
a. Make the following changes to the methods as shown in figure below.
i. Take off: Lift from the ground and wait for 5 sec.
ii. Land: Land on the ground.
iii. Stop: stop drone functions and exit the control panel.
4. Fly the drone from your control panel.
a. Connect your computer/laptop to the Wi-Fi of the Ar.Drone 2.0.
b. Run the above application.
c. Ensure that the Drone is kept in an open space at a safe distance from people.
d. Ensure to have the outdoor hull attached on the drone for safety.
e. Click the TakeOff button on your control panel; the drone should lift from the ground.
f. Click the Land button on your control panel; the drone should land.
g. Click the Stop button to close the Control Panel.
The above tutorial introduced the use of Java, to program two functions of the drone, i.e. take-off, and land. The yadrone jar file provides many more APIS3 to program different features of the drone and it also supports Android development. the tutorial presented one of the many ways that drones are programmed, for a different approach check out www.nodejs.org.
The growing interests in drones and the various possibilities they present are indicators of how computers and it are changing our future. Innovative applications and services are foreseen as faster and robust version of drones hit the market. This article introduced the basic features of drones and some application areas. A step-by-step guide on how to program the Parrot Ar.Drone 2.0, is presented to help ICT teachers and students to have a hands-on approach with drones.
Hidden away in many young minds are some of the great and novel applications for drones. A few institutions like the College of it, UAE University in Al Ain, have included the study of drones into their curriculum. The college hosts the it Marathon4, an ideal venue for young minds to showcase innovative IT skills and possibly a good place to demonstrate innovative application with the drones.
By Dr Sujith Matthew & Tony Ng
Dr Sujith Matthew is an Assistant Professor at Zayed University, Abu Dhabi with a PhD from university of Adelaide. With more than 15 years of experience, his research focuses are in ubiquitous and distributed computing, concentrating on the Internet of Things.
Mr Tony Ng received both bachelor and Master degrees in Computer science from the USA. He has over 15 years of experience working in the industry and academia. His research interests include Grid/Cloud Computing, IT Mobility (Integration), and Human-Computer (Robot) Interaction.