Here's a fun little project I've been working on for ~6 months now.  It started when I looked at my phone and thought this has everything needed for an autopilot - 3-axis gyros, accelerometers, magnetometers, GPS, fast CPU, plus a nice big touch screen and more wireless modems than you can point a stick at.  The only problems are (1) it's a multitasking operating system, not real-time; and (2) needs extra hardware to drive servos and switch between manual and auto control.

I solved the first problem by buying a used Samsung Nexus S with a faulty screen (discolouration) on ebay for $80, installing a stable, bare-bones version of android 2.3, rooting it, and disabling CPU throttling.  50Hz servo update loops and 110Hz sampling loops are no problem - timing is reliable and it only uses ~5% CPU (using floating point everywhere and some bloaty object-oriented code). 

Second problem was solved like this:

The Ardupilot legacy board doesn't actually run any ardupilot code - it's just a convenient and cheap way to get an Arduino and a multiplexer.  It just takes servo commands from the phone and uses the Arduino servo library code to drive the servos.  Most of its time is spent sampling the baro sensor.  It samples at around 20kHz, and using 4096x oversampling I get 4 16-bit samples per second with an altitude resolution of around 15cm and noise of about +/- 30cm.  The bluetooth link looks scary but works fine.  It's done about 10 hours of autonomous flight with no issues, and only drops out if I take the phone at least 10 meters away from the plane. 

Waypoints are selected on a google map interface:

Gains etc can be easily adjusted:


And, of course, a flight video:

Behind the scenes it runs the DCM + complimentary filter code.  I've added some extra features over the last few months:

Autonomous thermaling (works well in warmer weather)

Hardware in loop simulation with X-Plane and MS FSX over WiFi

Wind and airspeed estimation

Dead reckoning (using gyros/magnetometer and estimated speed - can work through short GPS dropouts)

Android-to-Android Telemetry over WiFi or mobile internet (later requires sim with public IP - hard to find)

Features I plan to add:

Waypoint addition/modification from Android groundstation (if/when I can convince a telco to give me public IPs)

Fly-by-wire(less) over mobile internet (ditto)

Photo/video taking at specified locations with onboard camera (will require mounting under wing)

I'll post about some of these over the next few weeks.

Views: 10141

Comment by Azam Shahani on July 15, 2012 at 5:28am

Wow! Finally an android autopilot! Great work!

Comment by JP on July 15, 2012 at 6:07am

really cool.. great post and work. time to replace the screen on the old driod x

Comment by Eivind Bø on July 15, 2012 at 6:20am

Impressive work!! Looks like it does more than Ardupilot does...


3D Robotics
Comment by Chris Anderson on July 15, 2012 at 7:32am

This is awesome! Is it going to be open source?

Comment by Savraj Singh on July 15, 2012 at 9:06am

why do you need public IPs from the telco? You can send a 'push notification' to your app from a server.  On iOS it's the push notification API, not sure what it is on Android but there's an equivalent.

Comment by Carl Clegg on July 15, 2012 at 2:17pm

You could also use a reverse ssh tunnel through a publicly accessible server.

Comment by Savraj Singh on July 15, 2012 at 2:19pm

you could also poll a url... but that's totally a hack. ;)

Comment by Carl Clegg on July 15, 2012 at 2:29pm

True I guess :) I just have a somewhat strange love for using ssh for everything I can :)

Comment by John Moore on July 16, 2012 at 8:46am

But how do you pass the time waiting for your drone to come back if your phone is in the air?

Comment by johnm545 on July 16, 2012 at 8:46am

@Chris: I plan on releasing the code at some point, but want to clean it up a bit first.  There's some big chunks of code with no comments and some "workyouf$&$#&%" variable names floating around in there.

@Savraj - Could use a server, but direct comms would be much simpler and more elegant... will go that way if I have to though.

Comment

You need to be a member of DIY Drones to add comments!

Join DIY Drones

© 2018   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service