This project provides an open source firmware for the AR.Drone quadrocopter by Parrot.
WARNING: This project is not supported nor endorsed by Parrot S.A., using this sofware will most likely void your warranty and might destroy your drone or make it fly away into deep space. Use at your own risk.
Click here to download the Custom Firmware or browse the source code on github
The new firmware for the drone is called ‘fly’. Upon start it will listen on UDP port 7777, waiting for the PC based controller called ‘OpenFlight’ to connect. Once OpenFlight connects, ‘fly’ kills the Parrot firmware ‘program.elf’ and takes control of the drone. Now you can fly the drone with the PC keyboard. OpenFlight logs the flight data to a file called YYYYMMDDHHMMSS_navlog.csv.
Known Issues
- The PID controller parameters have not been optimized yet and currently only use ‘P’ parameters. In particular the height controller will probably settle below the target height, or the drone might not have enough power to take off.
- The OpenFlight user interface is very rudimentary.
- No soft landing function is implemented. In order to land: fly the drone to minimum altitude and then switch off the motors.
- ‘Flat Trim’ parameters are not saved and are estimated after OpenFlight connects. Place the drone on a horizontal surface before connecting with OpenFlight.
- No battery voltage monitoring. The drone will fall out of the sky once the battery is drained.
Install
1) FTP the folder ardrone/bin to your drone
2) Open a telnet session to your drone and execute:
# chmod 777 /data/video/bin/*
# /data/video/bin/fly
3) On your pc, start OpenFlight.exe and follow the instructions on screen.
4) (Optional) Execute the following command to make ‘fly’ start everytime you powerup the drone:
# echo -e “\n\n/data/video/bin/fly &” >> /etc/init.d/rcS
Other telnet commandline demo programs on the drone are:
You’ll need to execute `killall program.elf` before using these programs!
# /data/video/bin/navboard – to see the navboard raw sensor data (3-axis accelleration, 3-axis gyro, sonar echos)
# /data/video/bin/attitude – to see the navboard attitude data (pitch angle, roll angle, yaw angle, height)
# /data/video/bin/motorboard – to control the motors/leds
# /data/video/bin/vbat – to see the on board voltages
# /data/video/bin/video – turns the drone into a giant optical mouse, keep it about 1 meter above ground and move it parallel to the ground. The program should report the movement.
Directories
ardrone/bin – Pre-compiled binaries. FTP these files to your drone and run them in a telnet session.
ardrone/fly – Custom firmware to fly the drone, the controller is in directory /pc/OpenFlight
ardrone/navboard – Navboard driver and demo getting raw data from the navboard and converting it to realworld units
ardrone/attitude – Attitude driver and demo calculating attitude (pitch,roll,yaw and height) estimates from navboard data
ardrone/motorboard – Motorboard driver and demo control of the 4 motors and leds
ardrone/vbat – Battery voltage driver and demo
ardrone/gpio – GPIO driver and demo
ardrone/video – Video driver and demo (needs start&kill of program.elf to init the video)
ardrone/util – Utilities
pc/OpenFlight – C# controller for /ardrone/bin/fly
Compiling
For ardrone source code:
1) Download and install arm-2011.03-41-arm-none-linux-gnueabi.exe “Sourcery G++ Lite 2011.03-41 for ARM GNU/Linux” from http://www.codesourcery.com/sgpp/lite/arm/portal/release1803
2) On Windows: open a command prompt and cd to one of the directories
3) Run the make.bat batch file to compile the program in that directory
For pc source code
1) Download and install Visual Studio C# 2010 Express
2) Open pc/OpenFlight.sln
Changelog
19-Sep-2011 V03 Added ardrone/fly and pc/OpenFlight
20-Jul-2011 V02 Added video
17-Jul-2011 V01 Initial release
> With lower speed values than 0×66 the motor will not start.
On my AR.Drone, my test shows that 0×33 is the minimum speed value.
For safe test with AR.Drone motors, I removed the spin-blades. But I got motor CUTOUT after ~3 seconds of running. How to avoid it and make a continued long running? (So I’m able to test the speed changes with different PWM values)
Awesome work Perquin
I guess that if you publish that code on github or bitbucket, other developers could reach you and/or help you better.
Keep up the good work !
Thanks for the suggestion! I’ve published the code here: https://github.com/ardrone/ardrone
Awaiting for your first addition
Yes, yes my aim is to mod my Ar drone to make it substantially lighter, just need a way to greatly reduce the speed of the motors. This I am hoping when I have finished with my brilliant plan to also get longer flight time and coverage. Please let me know if this can be done easily.
You probably can fly your superlight drone with the stock Parrot software, I would expect the controllor to adapt the motor speeds accordingly.
If you really want to experiment you can use the software I just published on this page, but be prepared for some nasty crashes of both sofware and hardware!!!
Is the version from github up to date? It seems to be still marked as September 11, 2011 First commit.
Now it is, still learning github…
Dear Hugo,
Thanks for the great effort towards writing the open source firmware for the ARdrone. I have a couple of questions to ask please. I need to implement some control algorithms on the AR.drone and I need to write an application which can easily access the motors(Send PWM commands) and get the feedback from the sensors so that I can plugin every control algorithms I like into the application and validate the results. I don’t really want to use the original firmware by Parrot as it looks complicated and unnecessarily large in terms of codes and files!
I am not a professional programmer but I do have some general C/C++ and VC++ knowledge! Do you think working on your codes for the aforementioned task would lead me to results in a couple of weeks? Do you have any recommendation or advice regarding this issue?
Thanks so much
P.S: Is there any documentation for your codes so one can start up quickly?
Another question!! Is there any UML for the source code?
Thanks
Mohammad
Hi Sep, please have a look at the comments in source code itself. Each module, for example motor control, has its own demo progam that explains how to use it. Happy hacking
Thanks hugo, you’ve done a great job!
Sep
Hi, I got a problem with the toolchain. The compiled binaries I get after compilation are not correct and make a segmentation fault on the drone. I’ve tried several versions of the toolchain (2009, 2010, 2011) on linux and the 2011 on windows, always the same problem. I tried also with a Hello World application.
Could this be due to my drone version (1.7.11) ? I tried to downgrade in many ways but err.log says my version is ok even if I set the current to 0.0.0 in firmware/version.txt.
Do you know if there is a difference between the source toolchains given by parrot and the original codesourcery one?
Just found where the problem is. It’s not about the toolchain but about my ftp client who corrupts the binaries during the transfer!
HI,
What kind of adjustments are required to make the firmware work on AR.drone. 2? One should probably change some of the hardware memory addresses and identify the new pressure sensor address and write the codes for it. Any update?
Sep
Hi Sep, I don’t have a AR Drone 2.0. From reading the specs I expect the motor drivers to work without change. The navdata structure has changed for sure. According to http://www.parrot.com the AR.Drone 2 has pressure and magnetometer sensors added, and the gyros have changed. If you have a new drone, you could capture the navdata stream and try to reverse engineer it with a hex editor. Once you know the format of the new navigation data, updating the source should be fairly straightforward. Let me know your findings! Cheers!
The AR.Drone 2.0 the serial and i2c interfaces changed quite a bit in some areas. The motor controllers did not change too much, so Hugo’s code is mostly functional. The commands for the LEDs don’t work properly.
The format of the navigation board data package changed a lot, offsets and some formats are different, I have only figured out the stuff we really need so far (accelerometers, gyros, ultrasonic).
The cameras are controlled by media-ctl (v4l) which makes things easy once you have understood what it actually does (media-ctl documentation is rather poor imho).
The only thing that is really bugging me right now is that I have not been able to locate the battery voltage measurements.
Hello Hugo and tvjunk,
I am working in a very similar project that the one you have done two years ago. I would be very grateful if you could send me the updated code for the drone 2.0.
Thank you in advance.
Hi Hugo,
I am contacting you since I am having some issues with the ardrone. I was following your instructions here;
I did FTP the folder ardrone/bin to my drone, and I did use the commands you mentioned on the telnet session. Unfortunately, the minute I try to run ‘fly’, there’s some sort of seg fault – the drone won’t fly, and the control light at the bottom turns red.
I think other files, except for ‘fly’, work fine. I was trying to run ‘motorboard’ just to test the lights and propellers, and they seem to work fine. Also, when trying to run navboard it said “calibration failed”.
To tell you the truth, I’m not exactly sure of what I am doing. I am a student and this is a part of my project. Maybe you could help me by giving me some directions of how to debug my problem? and also – where can I find the log files for this thing?
Thanks a lot in advance
Ok.. just one question:
If you crash the firmware by toying around with the command line stuff or accidentally delete some important system file and render the system unbootable – is there some kind of debug port inside the drone to flash the original firmware back or anything else to recover the drone in such a case?
Thanks.
Shir and Hugo,
I just started last night and am having the same issue as Shir. Motorboard worked for the motors. The LEDs looked like it behaved differently than intended. I will look at it closer later and report back.
The fly app connects and the drone receives the space bar input as SET (all 0s). All other input does not seem to be received. I also can’t seem to exit the program. Looking at the code it seems this small item is just from an endless while loop instead of having any kind of end condition. I need to look at all of this more later.
Hugo – is there any known issues with new Parrot hardware or firmware compatibility? I have the drone 1 (not 2) but not sure if they had any different batches that might make a difference. Any hints? I will try to debug further but it would be great to know if this situation has been diagnosed and fixed already.
Thank you!
I have started to work on DroneProxy some time ago to work around bugs in the firmware of the drone. Basically it is a transparent proxy for the UDP AT command packets arriving on port 5556. The packets are parsed to keep track of the sequence number. If no packets are received for 1500 ms the proxy will start sending “landing” commands with increasing sequence numbers (until somebody plugs the battery…).
Hi Hugo,
This comment is branched from the ardrone USB Drive thread, I though I would post on this more related thread.
Yep, got the video thread to process a different algorithm ‘snapshot’ for calculating velocity and position. It runs ‘simultaneously’ with the fly control thread so I can fly at the same time. I notice I can get the video program to calculate at around 60Hz which is consistent with the rate Parrot says the ARdrone1.0 bottom camera can refresh its image.
However the controls are only accepted around 15-20Hz which is slower than the 200Hz the Navboard works at. This may be due to the code waiting for confirmed commands or a wifi thing. (wifi thing?)
If it is a ‘wifi thing’ i might still be able to use these ‘positioning’ calculations in conjunction with the gyro data at 60Hz to achieve stabilisation. This has to be done onboard to achieve that rate.
I have seen someones attempt at PID improvements on your program but it still seems to drift a little on my drone.
Anyone got some tips for me???
James.
Got it this morning and really like the combined yaw and pitch, but got 1 problem:I can`t get the altitude control working (up&down), reset to default, used different control modes but non working Latest drone firmware 1.5.1 with iPhone4Any idea`s?
Hey,
your project is really cool. Are you still working on it? I’m trying to make an ardrone fly with a custom controller based on sliding modes and I found a library to do it with Python, but the problem is that it is too slow. I think it is because of the time it takes to send the signal from the ardrone, process it in the PC and send it back, so I was wondering if it would be possible to implement a sliding modes controller with your firmware, and if so, if it’s possible to use it on Linux. Hope you read this
Alberto