Linux (Ubuntu) SDK Example Walkthrough.

Parrot SDK, Linux SDK, Java, PC, Mac, scripts for Parrot drones... etc.
daveyoi
Ready for take off
Posts: 17
Joined: 27 Aug 2010, 14:14

Linux (Ubuntu) SDK Example Walkthrough.

Post by daveyoi » 13 Sep 2010, 21:54

Here is a small step by step to get the SDK examples compiled on an Ubuntu 10.4 install. I used virtualbox to install Ubuntu on my mac - I will provide a step by step for that setup if people are interested.
  1. There are some packages required to compile the SDK code.
    • apt-get install libgtk2.0-dev
    • apt-get install libsdl1.2-dev
    • apt-get install libiw-dev
  2. Download the SDK from the ARDrone development Wiki
  3. Unpack to a folder of your choice (I have mine under my account in /home and renamed to ARDroneAPI)
  4. First we need to compile the base SDK.
    • cd ARDroneAPI/ARDroneLib/Soft/Build
    • make and let it build.
    • within ARDroneLib there will now be a targets_versions folder with the compiled code.
  5. Now we will compile the navigation example as it is the most verbose and has support for a PS3 controller.
    • cd ARDroneAPI/Examples/Linux/Navigation/Build
    • make and let it build
    • cd ARDroneAPI/ARDroneLib/Version/Release
  6. Run the example ./ardrone_navigation
All being well this should make a connection to your Drone and you can control it using a PS3 controller or logitech pad, there is also support for RC controllers but I haven't played with that.

Hope this helps.

Symon
Site Admin
Posts: 443
Joined: 18 Aug 2010, 21:45
Drone Type: Jumping Sumo
Location: Southampton, UK
Contact:

Re: SDK Example Walkthrough.

Post by Symon » 13 Sep 2010, 23:42

daveyoi,

Thank you for the walk though, hopefully other users can benefit and we can start to see some PC/Laptop based apps hit the scene.

P.S. Stickied.

Symon
Site Admin
Posts: 443
Joined: 18 Aug 2010, 21:45
Drone Type: Jumping Sumo
Location: Southampton, UK
Contact:

Re: SDK Example Walkthrough.

Post by Symon » 18 Sep 2010, 17:59

@daveyoi, have you actually flown the AR Drone from Ubuntu?
Cause I have followed these steps on two installs and neither work with my Drone.

daveyoi
Ready for take off
Posts: 17
Joined: 27 Aug 2010, 14:14

SDK Example Walkthrough.

Post by daveyoi » 18 Sep 2010, 19:03

Yeah - using a ps3 pad.

What pad are u using and what output do you get from the code?


Sent from my iPhone using Tapatalk

Symon
Site Admin
Posts: 443
Joined: 18 Aug 2010, 21:45
Drone Type: Jumping Sumo
Location: Southampton, UK
Contact:

Re: SDK Example Walkthrough.

Post by Symon » 18 Sep 2010, 19:13

Ahhh!!!! I don't have a controller!!! D'oh!
Could I not map to k'brd.
Mmmm Wii controller should work.

daveyoi
Ready for take off
Posts: 17
Joined: 27 Aug 2010, 14:14

SDK Example Walkthrough.

Post by daveyoi » 18 Sep 2010, 19:42

I think there is wii support in the example - although it should be easy enough to add kboard support - just a case of copying the inputs for the pad code - might have a play around this evening while the missus watches crap-factor :)


Sent from my iPhone using Tapatalk

cristiano1971
Newcomer
Posts: 2
Joined: 24 Sep 2010, 21:56

Re: SDK Example Walkthrough.

Post by cristiano1971 » 24 Sep 2010, 22:03

Daveyoi, well done, really good job, so i hope you can help also to find or develop an app for android .... :-)
what do you think ?
Thanks !

zenocha
Ready for take off
Posts: 27
Joined: 09 Sep 2010, 12:39
Location: Glasgow. Scotland

Re: SDK Example Walkthrough.

Post by zenocha » 28 Sep 2010, 00:35

Ive been working on getting input devices other than the ps3 gamepad and wii controller working seeing as i have neither. What i do have is a cheap ps2 controller to usb adapter.

Ive successfully got this controller to work

UPDATE - Ive got all the basic controls mapped out so here goes

So to get any gamepad to work navigate to:

/Examples/Linux/Navigation/Sources/UI

This is within the SDK.

Then open up 'gamepad.h' in any text editor.

It seems that the demo looks directly for the specific hardware referenced in this file so find the line that begins

#define GAMEPAD_PLAYSTATION3_ID 0x046dc21a

It is the code in this line that refers to the usb gamepad, to find out the code to replace this with, plug in your desired gamepad and open up a terminal and type

lsusb

This will give you a list of connected use devices. Find the description for your gamepad and in that line you will see

ID YYYY:YYYY

Where the Y's are alphanumeric characters. This is your device, take the code add '0x' to the start and remove the colon so we would therefore have

0xYYYYYYY

Now we want to replace the ID code in gamepad.h with this new code and hey presto the demo is now pointing towards your device. Next we need to know how to map the device.

To do this we need to install the joystick program, to do this in a terminal type

sudo apt-get install joystick

Now we can find out what buttons correspond to what so type

jstest /dev/input/js0

You will now get an output that will show you what buttons correspond to what number. You can then edit gamepad.h by adding the corresponding number to the button you want.

So for example if i press the start button on my controller i get an 'on' in the terminal for button 9.

So in gamepad.h i find the line that says PAD_START, and edit it to

PS3BTN_START = 9,

Now if i make the program as shown in the first post on here when i press the start button the drone will launch, and pressing again the drone will land.

Im going to work on getting the whole thing mapped out but hopefully this will help other people to work it out.

UPDATE Heres a list of the corresponding keymappings for basic function

PS3BTN_SELECT - Emergency, Cuts motors
PS3BTN_START - Initiates take off and landing
PS3AXIS_STICK1_LR - Pitch Left/Right
PS3AXIS_STICK1_UD - Pitch Forward/Back
PS3AXIS_STICK2_LR - Yaw counter/clockwise
PS3AXIS_STICK2_US - Height Control

So just map each button and axes to the one that corresponds to your desired controlpad.

Im currently working on setting up some dead zones on the joysticks and working out how to reduce the sensitivity of the controls as they are very sensitive.

You can see my current testing setup

Image

Image


Ive tethered the drone at its 4 corners to some water bottles to prevent it running away as i had happen with some incorrectly assigned controls. Its actually really good for testing purposes.

zenocha
Ready for take off
Posts: 27
Joined: 09 Sep 2010, 12:39
Location: Glasgow. Scotland

Re: SDK Example Walkthrough.

Post by zenocha » 29 Sep 2010, 16:11

has anyone worked out how the vision control works for tracking etc in the linux demo app?

NuttyProfessor
Ready for take off
Posts: 13
Joined: 05 Oct 2010, 21:06

Re: SDK Example Walkthrough.

Post by NuttyProfessor » 05 Oct 2010, 21:17

Thanks for the instructions! My current project is to try and use the OpenCV computer vision platform with the AR.Drone. So this means I'm starting to play with the Linux side of AR.Drone, and I'm having lots of trouble getting anything to compile. Most folks, like you, seem to favor the ardrone_navigation program in Examples/Linux/Navigation, but under Fedora 13 I'm having lots of problems compiling.

Maybe Ubuntu is the way to go? Has anyone got any of Linux examples to work on Fedora?

NuttyProfessor
Ready for take off
Posts: 13
Joined: 05 Oct 2010, 21:06

Re: SDK Example Walkthrough.

Post by NuttyProfessor » 06 Oct 2010, 08:24

daveyoi,

I decided to do exactly what you did (virtualbox to install Ubuntu on mac) and am almost there, but would like you take you up on your offer below: specifically, how do you connect to the drone from Ubuntu/virtualbox/OSX? I've got the code compiled and running, but no connection to ardrone!

Thanks!

[quote="daveyoi"]Here is a small step by step to get the SDK examples compiled on an Ubuntu 10.4 install. I used virtualbox to install Ubuntu on my mac - I will provide a step by step for that setup if people are interested.

daveyoi
Ready for take off
Posts: 17
Joined: 27 Aug 2010, 14:14

Re: SDK Example Walkthrough.

Post by daveyoi » 06 Oct 2010, 16:13

Hey NP.

I put a step by step for VB here

http://www.ardrone-flyers.com/forum/vie ... p?f=8&t=86

I think the part you are missing is the Bridging of the Airport and manually inheriting the IP Address... Its at the bottom of the post above.

Drop another post if you are still having trouble mate.

NuttyProfessor
Ready for take off
Posts: 13
Joined: 05 Oct 2010, 21:06

Re: SDK Example Walkthrough.

Post by NuttyProfessor » 06 Oct 2010, 17:53

Thanks for the quick reply and walk-through, daveyoi!

Now I *can* ping the drone's IP addr from an Ubuntu terminal within VirtualBox; however, starting up the ardrone_navigation app still shows no connection: http://www.cs.wlu.edu/~levy/ardrone.png

I'm supposed to see a connection, as well as the camera image, right?

Maybe I need to fiddle with some Makefile settings?

NuttyProfessor
Ready for take off
Posts: 13
Joined: 05 Oct 2010, 21:06

Re: SDK Example Walkthrough.

Post by NuttyProfessor » 06 Oct 2010, 17:57

Oops -- just realized, no USB gamepad/joystick plugged in! This is probably what's causing the Timeout and lack of connection.

Lemme try hooking up a gamepad and see what happens.

Thanks,
Simon

daveyoi
Ready for take off
Posts: 17
Joined: 27 Aug 2010, 14:14

Re: SDK Example Walkthrough.

Post by daveyoi » 07 Oct 2010, 01:15

Hey simon,

Not sure it matters too much if the pad is plugged in or not.

I had the same problem to start with where I could ping the drone but was seeing timeouts from the codes output - after I setup the network bridge and manually configured Ubuntu to have the same ip address as the mac host it was working for me.

So the drone will be on 192.168.1.1, and the connected mac should be on 192.168.1.2. In ubuntu you need to map these settings manually

IP address = 192.168.1.2 (same as mac)
Netmask 255.255.255.0
Gateway = 192.168.1.1 (drone)

Once mapped - the code should start to do its stuff - you need to click the Vision checkbox in the gui to bring up the camera feed!

Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests