C# SDK for AR Drone now available

by Stephen Hobley on November 28, 2010

Post image for C# SDK for AR Drone now available

We got the OK from Parrot a couple of days ago to release the source code for the C# .Net ARDrone API .

It can be downloaded from here.

Big thanks to Thomas and Julien for all their help with this project – there’s no way I could have finished it without them.

Note : This is an unsupported proof-of-concept project – so I won’t be bug-fixing or updating it as the latest firmware comes along. It’s open source, so feel free to have at it yourself…

Share

{ 66 comments… read them below or add one }

Miguelb November 28, 2010 at 9:10 pm

Is there a place where we may submit comments, suggestions or bugs?
For instance, while installing the SDK I found out that I had to install SDL, wich is not part of the libraries described on the wiki or readme.txt.

Stephen Hobley November 28, 2010 at 9:15 pm

You are correct, this is a wrapper for the Win32 SDK – so you will need to do everything that the documentation for that SDK asks you to do.

The Github repository has an issue tracker, you might need to register with GitHub, but you can submit there.

Keith November 29, 2010 at 12:07 am

I am also stuck on this SDL issue. I am not able to compile I dont do much work with the Windows SDK I dont think many of your users will. Any information you can share on how to resolve would be great.

Stephen Hobley November 29, 2010 at 12:51 am

Keith – what I did was download the SDL toolkit from here:
http://www.libsdl.org/release/SDL-1.2.14.zip
and unzipped it to a folder on my drive D:

Then update the property page (edit ARDroneProperties.props) to point to this location:
<sdldir>D:\SDL-1.2.14</sdldir>

That’s all I had to do, if you are having a more specific error, please let me know what it is.

Susa November 29, 2010 at 5:42 am

I always get the following error while trying to run the project:

Unable to start programm’…\bin\Debug\ARDroneAPI\ARDroneAPI.lib’
The specific file is an unrecognized or unsupported binary format.

Am I missing something?

Stephen Hobley November 29, 2010 at 10:54 am

I’ll shoot a movie showing exactly what I did to get the project to build and run.

In the meantime – can we start logging these errors over at the Github repository site, they may get lost if posted here…

https://github.com/shtejv/ARDrone-Control-.NET/issues

Hans Jakob Bosshard November 29, 2010 at 6:21 pm

Hi Steve,

First of all thanks for your immense effort! The updated exe runs fine (at least not yet made flying tests).

I cannot build your solution i.e. the project ARDroneUI Forms with Visual Studio 2010 on my Vista system. As I have seen your above input concerning the installation of the SDL folder and changing the prop file accordingly the build process failed with the following VS messages:

Error 1 error C1083: Datei (Include) kann nicht geöffnet werden: “SDL.h”: No such file or directory c:\users\jack\documents\visual studio 2010\projects\ardrone_control_net\ardroneapi\vp_sdk\vp_stages\vp_stages_o_sdl.h 33 1 ARDroneAPI
Error 2 error LNK1104: Datei “ARDroneAPI.lib” kann nicht geöffnet werden. C:\Users\Jack\Documents\Visual Studio 2010\Projects\ARDrone_Control_NET\ARDroneDLL\LINK ARDroneDLL

Remark: “kann nicht geöffnet werden” means: “cannot be opened”

Regards

Hans Jakob Bosshard
Switzerland

Stephen Hobley November 29, 2010 at 6:37 pm

OK so it looks like error 2 is because of error 1.

First question – Can you find the SDL.h file on your computer?

I set up my props file to point to the folder containing the SDL root folder, not the \include folder, but the one that contains the \include, \lib, \docs, BUGS, COPYING etc…

Then it can locate the SDL.h file in Debug build mode.

Miguelb November 29, 2010 at 7:37 pm

Here’s what I did:

1) Go to http://www.libsdl.org/download-1.2.php
2) Download SDL-devel-1.2.14-VC8.zip (Visual C++ 2005 Service Pack 1)
3) Extract the .h file somewhere to the hard drive – for instance d:\sdl
4) Instead of changing properties for the project, i changed the following line:

#include

to

#include

This is not as correct as stephen’s solution, but should at least let you compile the solution. It might give some problems later on some functionalities – I haven’t tested it yet.

Susa November 30, 2010 at 6:22 am

Hey!

Where exactly did you changed the line and into what Miguelb? I can only see, that you changed #include into #include. I don’t get this. ;)

I unzipped the SDL.h and changed the properties, like you said Stephen and this is working fine for me. I do not have errors with the SDL file anymore. I also can build the entire solution, but if I want to start there is still the error with the unrecognized and unsupported format of ARDroneAPI.lib. I’m using Windows XP.

Greetings and thanks Stephen for the great work!
Susa

Stephen Hobley November 30, 2010 at 9:07 am

I have only built the project on Windows 7 – but I would try doing a complete “Clean” of the solution and building again.

Take a look at the output window where you will see the C++ build steps in more detail – if an error occurs there it will break the rest of the build.

Frenkys November 30, 2010 at 10:41 am

Hi Stephen,
after making the settings you suggest, I get the following errors when compiling:
1) \ardroneapi\vlib\video_mem32.c(39): warning C4013: ‘bswap’ undefined.
2) \ardroneapi\vlib\uvlc\uvlc_codec.c(269): warning C4013: ‘clz’ undefined.
3) \ardroneapi\vlib\uvlc\uvlc.c(29): warning C4013: ‘clz’ undefined.
Then after code generation:
time.obj : warning LNK4006: _gettimeofday already defined in video_stage_recorder.obj; second definition ignored
ardrone_navdata_file.obj : warning LNK4006: _gettimeofday already defined in video_stage_recorder.obj; second definition ignored.
Any help?
Thanks

Stephen Hobley November 30, 2010 at 10:47 am

These are warnings – they will not stop the solution from building.

These warnings are left over from the Win32 SDK provided by Parrot – we did not remove them as they did not stop the project from building.

Stephen Hobley November 30, 2010 at 10:52 am

I just read over the comments and I think that there might be some misunderstanding on the differences between a C, C++ and C# (Managed) project.

1. Warnings do not break a build, just errors.
2. Libs/Dlls cannot be run, just the sample applications – WPF and Windows forms – make sure you have one of these as the start-up project.
3. Unmanaged code is different to managed projects, all the unmanaged projects should be built first, before trying to run the managed ones. Also the solution is not as “aware” of the build order and sequence with unmanaged code as it is with the managed stuff.

Hans Jakob Bosshard November 30, 2010 at 1:25 pm

Hi Steve,

Thanks for your comments! I just sent to Thomas Enders at the Parrot Forum the Build errors and warnings in an attached file and the props file of a new solution build trial. If you want to have a look on it.

An additional question: Could I use also VS 2008 prof. academic edition. As a retired engineer without actual links to a high school I have no more a possibilty to get an academic edition for a “reasonable” price. The trial VS 2010 will end in the nearer future!

Stephen Hobley November 30, 2010 at 1:30 pm

I think the solution could compile on VS2008 – I can see no reason why not.

Actually once you have compiled all the C/C++ stuff you should be able to compile all the C# stuff using the free “Express” version of 2008 or 2010.

Hans Jakob Bosshard December 1, 2010 at 10:25 am

Hi Steve,

Hurrah! After sending the failed build error list and the props via the forum to Thomas he loaded up a correction with a new textfile. Now I can build, run your fine software, connection to the drone and video are coming up. The next steps will be a fly with a Ninetendo Wiimote device.

Thanks a lot to you and the other members of the team for the immense work, that extends the AR.Drone applications also in the “Microsoft Windows World”!

The pre-built program under VS 2010 can also be used within VS 2010 Express edition.

Regards
Hans Jakob

Miguelb December 1, 2010 at 6:59 pm

Actually you can’t open the solution directly in vs2008 – it will tell you that it was created by a newer version of visual studio. However you will very likely be able to create a new vs2008 solution and add the projects into that solution.

Hans Jakob Bosshard December 2, 2010 at 5:39 am

Hi Miguelb,

I had the same problem. Proposal: Build the SDK with the Microsoft trial version of VS 2010 Prof. Edition. Afterward you can run it within the Expess Edition of VS 2010 for C#. There you can edit and add C# parts of the program.

Regards

Hans Jakob

Thomas December 2, 2010 at 11:49 am

A downgrade of the Visual Studio version is a bit ugly, and since we use .NET 4, you’ll also have to downgrade to .NET 3.5 before.

Juan December 15, 2010 at 11:32 pm

I tried the executable and worked fine. One thing I do not se is how to control altitude with the keyboard… Does it have a key programmed to it??

Roberto December 19, 2010 at 8:04 pm

Hi Thomas,
hi build all fine and the c# application start but when i press the button for connection It told me that dll not found ?! The DLL is available is update and in correct directory i build the dll for support pthread32
But I don’t understand the README for windowsxp I need pthread32 or no ? In the instruction

!!! IMPORTANT INFO for Windows XP users !!!

Please uncomment the line

“#define USE_WINDOWS_CONDITION_VARIABLES”

in vp_os_signal_dep.h.
Otherwise, you will get a DLLNotFoundException when pressing the startup button.

/*
IMPORTANT – select here whether to use condition variables from
the Windows SDK (Vista and later) or from the ‘Pthread for Win32′ library (XP and earlier).
*/
#define USE_WINDOWS_CONDITION_VARIABLES
//#define USE_PTHREAD_FOR_WIN32

So for Windows XP I need PTHREAD or USE WINDOWS CONDITION ecc ecc ?
Regards
Roberto

Mike Walker December 27, 2010 at 6:40 am

Stephen, firstly thank you for all of this hard work … the program looks fantastic!

I am having problems getting it to build however. I have done everything stated in the ReadMe file, but when I build, using VS2010, I get the following error which is messing it up:

c:\users\mike\downloads\shtejv-ardrone-control-.net-1.0.2-0-g99ed9d1\shtejv-ardrone-control-.net-9d7a029\ardroneapi\vp_sdk\vp_stages\vp_stages_o_sdl.h(33): fatal error C1083: Cannot open include file: ‘SDL.h’: No such file or directory

Any help would be very much appreciated! Really cant wait to get this up and running! Thanks again mate!

Mike Walker December 27, 2010 at 6:43 am

Also, I have read a few people on here talking about an executable file which works fine? Where could I find this? Have looked everywhere but no luck? Cheers, Mike

AnonymousYoon January 7, 2011 at 4:45 pm

Excellent job, Steve!

I could compile successfully but it doesn’t work. When I press “Start”…program just hangs. I look into the code and it is being killed without a reason when it tries to start the API’s thread. Wierd, huh? Any suggestions would be appreciated although I’ll try to fix it by myself.

To those who can’t compile:
1. specify SDL, DirectX AND JDK correctly to your include/lib directories and macro configs.
2. see below for tackling API level warnings and errors:
http://www.sparticusthegrand.com/ardrone/ardrone-compile-windows-sdk-1-5-in-visual-studios-2010/

Mad January 8, 2011 at 6:40 am

I have a problem and can’t resolve it ,I did all the modification but i have another problem for compilation

6>c:\users\yannick\desktop\shtejv-ardrone-control-.net-9d7a029\ardronedll_jni\ardronedll.h(11): fatal error C1083: Impossible d’ouvrir le fichier include : ‘jni.h’ : No such file or directory

And I searched the file in the ardronedll_jni folder and didn’t find the jini.h ….
Can someone help me ?

Mad January 8, 2011 at 6:59 am

Sorry I found what I didn’t understand , the file properties.props is in the DDL-JNI folder !
Thanks Stephen for this wonderful things !

Ryan January 9, 2011 at 2:18 pm

Hi Stephen,
Are you making the application shown in your YouTube demo available to end users?

I would love to be able to fly my drone that way.

Thanks,
Ryan

Stephen Hobley January 9, 2011 at 3:47 pm

Yes – it is all available on GitHub:

https://github.com/shtejv/ARDrone-Control-.NET

AnonymousYoon January 21, 2011 at 7:29 pm

Hi, Stephen!

I found the bug. In GetCurrentFrameRate() of MainForm, it seems like in some cases timePassed can be zero and the formula for computing frameRate was causing the divide-by-zero exception. I added if-cause and now it works perfectly.

Thank you very much again for your all hard work!

Gutemberg Ribeiro January 26, 2011 at 3:26 pm

Hello!

Awesome work with this SDK! Thanks! Do you need help with one more hand to code the SDK? I have some free time and interest on do this.

Thanks!

Gutemberg
MSN: iron_mala@hotmail.com
email: galvesribeiro@hotmail.com
Twitter: @galvesribeiro

Jan February 4, 2011 at 5:50 pm

Hi, I have problem. I keep getting error when I try to compile the solution.
Error 6 error C1083: Cannot open include file: ‘jni.h’: No such file or directoryd:\parrot\december2010\visualstudio\shtejv-ardrone-control-.net-1.0.2-0-g99ed9d1\shtejv-ardrone-control-.net-9d7a029\ardronedll_jni\ardronedll.h 11 1 ARDroneDLL_JNI
The “jni.h” file should be located in SDL directory? I cannot find this file anywhere.
Thanks for help. Jan

Simon Crozier February 15, 2011 at 6:20 am

Jan,

I think you’ve made the same a mistake I did. The release notes say :

“For the ARDrone JNI bridge project, you will also need to set properties in the properties.props file: “.

At first I read this as being add the location of your JDK to the “ARDroneProperties.props” file if you want to use ARDrone JNI bridge. But what it’s actually saying is you need to add the JDK reference to the file “ARDroneDLL_JNI\properties.props”. Not the props file in the root. In my case the line I added to this file was:

C:\Program Files\Java\jdk1.6.0_23

Depending on where you’re JDK is installed yours maybe different.

Hope that helps

Simon Crozier February 15, 2011 at 6:22 am

The comments system has removed the formatting of my post – it include items

Arpit Mittal February 19, 2011 at 1:04 pm

Hey Stephen,

First of all great job with the .NET SDK.

I wanted to build and run the SDK on my machine.

Specs: OS: Windows 7
VS2010 .NET 4 Framework
Downloaded and installed latest Microsoft SDK, DirectX and SDL files.
As mentioned on
http://www.sparticusthegrand.com/ardrone/ardrone-compile-windows-sdk-1-5-in-visual-studios-2010/
i added the lib and include folders in the ARDrone API properties.

The solution is building with no errors or warnings.

However, when i try to run it its giving me an error:
Unable to start program
‘\ARDroneAPI\ARDroneAPI.lib
The specified file is an unrecognized or unsupported binary format.

My machine is Windows 7, Home Edition. Does this make a difference.

What do i do to make it run.

If you have the source code, then I can build the .lib file on my machine.

Arpit

Menna February 22, 2011 at 4:21 pm

Hi Steve
First great thanks for your SDK and the awesome aviation gadgets u did.

Now, I have an issue (Front Left Move Syndrome) whenever I try to yaw or change the height the drone glides forward.
I found this link that has the same issue and said it’s a problem in win 32 SDK,
https://projects.ardrone.org/boards/1/topics/show/1719

but I’ve tried to delete the files still the same problem occurs, have you tried to fix this bug in the win32 SDK itself? thanks

Brian April 15, 2011 at 7:06 pm

Hey Steve

This is AWESOME! I was able to complile the VS2010 project and I got my AR.Drone flying. However, I don’t get any video from any of the two cameras.
One other thing. I am trying to modify this project to run this program on a Windows 7 tablet (touchscreen).
Do you have any suggestions on how to go about doing this??

Thank you so much!

Anders May 18, 2011 at 3:12 pm

Hi guys.
I’ve managed to compile the project (Was really easy thansk to good doc)
Everything is fine, except i get no video feed.

I tracked it down to that the ArDrone.dll method GetCurrentImage return a zero pointer. Do you guys now what can be wrong?

mike May 22, 2011 at 10:05 pm

hi, thanks for your code it alowed my to test my drone.
I have to say that i am having issues with the code that released parrot ( linux and windows) and i am still debugging it, but your code sucesfully compiled and make my drone fly.
At first all the keys configured in the keyboard works but after a time flying the A-D, W-S (left-right, forward-backward) keys of the keyboard dont control the drone anymore, the others keys still controll the drone .
Anyone else is having this behavior?
Once again thanks for your work.

flo June 3, 2011 at 1:09 pm

Hi! Thanks for the great work!

I think I’m missing a file called droneConfig.xml in the AppData folder. Does anyone know where I can get this file?

Thanks a lot!

Mc June 30, 2011 at 2:52 am

Hey everybody
I can’t switch camera, when I click to change camera it show frontal camera and front(Pip) but bottom camera does’nt work
Who can help me

Thank

Matthias July 1, 2011 at 11:07 am

Hello,
I have tried to compile the project, but it doesnt work, I am not the Computer ACE. Is there any possibility to get the finished Programm to install it to the Laptop?
Thanks
Matthias ;)

oxo July 8, 2011 at 1:10 pm

Hy guys.

I got the code compile on VC2010.
I can’t connect to the drone.
Have someone already fixed this issue ?
The environnement is Windows XP SP3.

Thanks a lot.
Oxo.

Alessandro October 24, 2011 at 7:38 am

Hi Stephen,
First of all, I would say that this SDk is simply amazing!
I’m trying to install your SDk on Win 7 Ultimate with Visual Studio 2010. The SDK is compiled but when I try to run, I get the following error:

“PlatformNotSupportedException”
inside ArDrone.Input.Speech.InitSpeechRecognition()

Do you have some suggestion?

Thanks in advance

Regards

Alessandro

Zouza January 9, 2012 at 6:04 am

Hi Guys,
This is so amazing.. I would like to know if it’s possible to programme the Ar drone to flight on its own with a predefined path?

Stephen Hobley January 9, 2012 at 9:59 am

No reason why not – although it’s not something we have done. Seems a bit dangerous ;-)

uzman January 15, 2012 at 5:16 am

hay Stephen

well thanks for a very nice SDK….. Your sdk compiles well…but the problem is that ….I can take off and land ardrone but cannot steer…not with joy pad or keyboard… it seems it do not respond when it takes off…. any thoughts…. the ardrone is updated to latest firmware……

i am doing a student project so your help really mean allot!…..

thanx

Brian Noel January 17, 2012 at 9:07 pm

A little over my head, but here goes. I am unable to run the executable (ARDrone.ui I think it is?). The program’s main screen opens and then fades out and a windows message box pops up and states that the program has stopped working. I then downloaded the VS 2010 Prof edition and followed the tips in the read me file. I can build the solution with ARDoneUI_WPF set as the start-up project, however, when I run the debug I get this error:
“An unhandled exception of type ‘System.InvalidOperationException’ occurred in System.Speech.dll
Additional information: Cannot find the requested data item, such as a data key or value.”
Here’s the line it points to in the InitSpeechRecognition() function:
speechRecognizer.SpeechRecognized += new “EventHandler(speechRecognizer_SpeechRecognized);”

I am using Windows 7 64bit (hope the 64bit version isn’t the problem) Thoughts?

Stephen Hobley January 17, 2012 at 9:27 pm

Just off the top of my head I would say that the 64-bit has something to do with it. The errors you describe are very “generic” – Invalid Operation, rather than “File Not Found”, or “Out of Memory”. I would try building as a 32-bit application.

Brian Noel January 18, 2012 at 11:00 am

Thank you Stephen,

I continued to have the same problem and since the problem kept pointing to the speechRecognizer I decided to plug a microphone into the computer and enable the Windows Speech Recognition system and that fixed the problem. Now I can use either the executable, or the build from the source files. Does this program use voice recognition for inputs?

Leave a Comment

Comments links could be nofollow free.

{ 4 trackbacks }

Previous post:

Next post: