« The Long Tail of Brand Marketing | Main | Worlds's cheapest aerial video platform »

March 13, 2007

Two words: Lego Autopilot!

So you know how I'm trying to build a UAV for less than $1,000? And you know how thrilled I was to see that HiTechnic is releasing a gyro sensor for the Lego Mindstorms NXT? Put them together and you can see where this is going.

Here's the world's first Lego autopilot, which I threw together this eve. 

I haven't received the gyro sensor yet, so I've got a light sensor standing in for it in the picture, but the mechanicals are pretty much in place. Cool fact of the day: According to Google, this is the first time the phrase "Lego autopilot" has ever been used. I own this space!

This autopilot only controls the rudder, keeping the plane flying level when engaged and returning to the launch area. While the autopilot is disengaged, the servo arm controls the rudder under manual radio control as usual. But when you engage the autopilot (a third servo presses the "start" button on the NXT controller brick), the NXT servo drives the gear assembly above to move the entire R/C servo back and forth, while the R/C servo arm remains stationary. The effect is the same as if the R/C arm was moving, but the rudder is under Mindstorm control, not R/C control.

This autopilot is a "return bot". When engaged, it turns the aircraft 180 degrees (thanks to the compass) to point back at the launch area and keeps the plane level until the human pilot regains manual control.  

Next step is to ditch the compass and add a Bluetooth GPS module (the NXT brick has built-in Bluetooth), so it can follow waypoints and be fully autonomous. I'm not quite sure how to control the vertical dimension--the altitude--with this setup, so right now it's best to trim the plane for level flight and engage the autopilot at a relatively high altitude. Any ideas on how to solve the altitude problem in a Lego-friendly way? [Update: I'm told that the standard elevation output of the GPS module may be good enough to use for maintaining level flight, even if it's not high enough resolution to navigate to a soft autolanding. Once the gyro sensor arrives, I can test that.

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00d8341bfb6353ef00d83430606053ef

Listed below are links to weblogs that reference Two words: Lego Autopilot!:

Comments

To get the full control you are looking for you will simply need 3 gyros. The MIMU (Mini Inertial Measurement Units)that control many spacecraft as well as many comercial aircraft are not much more than 3 gyros (one for each axis).

I don't know if this works with Lego, but the easist way to get the altitude is with a barometric altiteter, preferably calibrated before you launch. However, I found that for landing I also needed an ultrasonic "radar" to get the required accuracy.

HTH

You might just ditch the compass and go completely GPS for direction and elevation with some statistical algorithms. It would not be as finite as a compass, but should be a workable solution.

I'd say the best way to get your altitude is via the gps. You could always try to find more sensors but that adds costs and weight so why bother? For landing you'll likely need one of the sonic distance add ons.

If you want a rough approximation of the altitude the Integral of the vertical acceleration (velocity), multiplied by time gives the vertical displacement (altitude). You can do this with nothing more than the sensors you already have.

Couldn't you use the NXT sonar sensor for the precise altitude control right at the end of your soft landing?

IE: Bring it down as far as you feel safe under GPS control, or whatever, and then switch to measuring the distance to the ground with the sonar sensor for that last little bit.

I have written some GPS software that displays among some obvious stuff the current altitude and displays it in a graph.
Having a quick look at the graph learn me that you don't want to land a plane with a GPS like mine, or perhaps not at all. A small proximity radar like in the parkdisatnce of your car can be crancked up to do the last bit.
Nice project by the way!

Ehm ah GPS is not good enough to retrieve height information for flights. Or you have to build something that can do parachute landings.
It just inform you because it would be sad if a first flight would kill your future to build drone...
But why not make a baloon drone, or zeplin then you wont have less of these problems as you can then decent more slowly downwards.
Or you have to think about building a Lego barometer :)

IMHO one of the most important tasks of an UAV is ... to fly :)
To achieve this task you need 2 informations: speed and rate of climb.

While speed is relatively easy to measure, the RoC needs a variometer. Here you can find a project which might be an overkill, but a good starting point
http://www.rocznik.de/Marko/electronic/project/vario/vario_engll.htm

btw. forget measuring speed via GPS. This will give you the ground speed of the vehicle. What you need is the indicated airspeed in flight direction, otherwise you'll never be able to maintain a steady flight

Last I knew 2 way communication to R/C airplanes is illegal without proper FCC licencing. The reason obviously... Terrorism! The government doesnt want someone loading up an RC plan with nerve gas and be able to fly it into a target someplace over the horizon.

You might want to be careful with who knows you got this.

--dan

gps' can be faulty on the Z axis (altitude). i'll second the suggestion for a barometric altimeter, at least in addition to a gps.

That's a negative on the FCC thing. First of all, it's not two way communiction. It's a drone taking over flight control. At no point does the drone communicate back to the ground. Secondly, you can do whatever you want as long as you keep it under 1 watt. Pretty much every commercial device you can buy, especially R/C devices has to be FCC certified already, and you need NO license. I've had experience with this as I'm FCC Certified. Great project by the way, I think we all want to see this come to fruition!

Correct me if I am wrong, but a R/C plane has four servos for control: Roll, Pitch, Yaw, and Throttle. You should be able to connect a Lego control to each one, similar to what you did above to control any aspect of the flight. The trick will be getting the program to complete coordinated turns. It should be easier to have a left and right turn routine, where the turn angle is determined by how long the aircraft stays in "turn mode".

You could always install an accelerometer vertically to measure how fast and how long your aircraft moved in the z-axis. As long as your software monitored the output for change, you should have a rough idea of how far above the takeoff altitude you are.

Good luck!

For further information on navigation using GPS, you might want to look at John Carmack's Armadillo Aerospace site, www.armadilloaerospace.com.

For interesting and useful information on potential applications of this technology, you might want to read Donald Kingsbury's 1987 book, The Moon Goddess and the Son, ISBN-10: 0671653814

RC helicopter gyros have been available for many years now, the lego offerings are nothing new.

The FCC code is not so much your problem as FAA regulations and AMA rules.

"No model aircraft shall be equipped with devices which allow it to be flown to a selected location which is beyond the visual range of the pilot." and "No model aircraft shall be equipped with devices that would allow for autonomous flight."

Be careful, state/federal authorities could get weird about this and take all the fun out of it, and really hose things for the rest of us.

I think you will find the GPS data to be too jittery and inconsistent for accurate flight control.

Ron,

The line you quote -- "No aircraft shall be equipped with devices that would allow for autonomous flight" -- is from the AMA insurance rules. The only consequence of violating it is that the AMA won't cover you in case of injury. And as for the visual range element, we have no plans to exceed visual range at the moment, and when we do we'll be in good company. The thermal soarer guys have been using Out-of-Sight control systems for years.

I'll be doing a post in the next few days on all FAA and FCC regs and how they apply to this. But the short form is that for the light balsa and foam planes we're talking about with sub 1-watt radios and flight patterns below 400 ft, it appears to be pretty much left to good judgment.

Chris

Agreed- technically not applicable to non AMA folks and the FAA guidelines are still "voluntary". Still its good that you mention the 400ft limit. All of this stuff is in flux and I fear the FAA will come down on us hard if/when a single well-publicized "incident" goes bad.

I think most of your issues have been addressed, with the exception of jittery data from the GPS. For ground work, I have read of people averaging across multiple GPSes to get a smoother plot. This will add weight and complexity, not to mention expense, but may be the way to go for smoothing.

D

This is very NEAT... But isn't that setup quite heavy??

If you have compute power a Kalman filter will sort out data from several sensors into a best estimate of real position and velocity. Add ultrasound and intetials to GPS and it'll really fly!

Regarding the compass, my garmin etrex vista switches to gps data for the compass once you are moving faster than 5km/hour. I use this when paragliding as it gives a near perfect bearing as opposed to a magnetic compass which needs to be relatively level and steady for an accurate reading. Your gps unit likely wont do this but it should be fairly easy to code. Then, you could possibly ditch the compass as well for some weight savings.

The only downside is in strong headwind when the ground speed is less than 5km/hour (not often) this method wont work. Although, if you coded your own routines you could set this to a lower value (say 2km/hour) and it may still work well, Im not sure where garmin got their 5km/hour figure.

anyway, good work, I hope your successful with it.

To what depth does GPS signal penetrate water?

So geek. So cool.

Sonic radar is... Sonar. The new automotive "front bumper sonar" might be small enough for what you want to do. It's short range stuff. There's another type for back bumpers, might be even shorter range. Also thinking infra-red circuit might work, for short range distance measurement. Not sure if it could defeat bright sunlight. And there's always the laser range finder. Some of those are very small. The sonar is pretty much fault proof, and not prone to interference or failure.

Agreed

http://www.studentbunk.com

A couple things:

Gyro sensor for pitch?
You don't discuss your pitch control, but I am assuming that you intend to use the gyro to measure/control the pitch axis, and you are relying on the static stability of the plane for roll stabilization (e.g. it will naturally maintain wings level flight). I also don't see any details about what this gyro sensor is, but I am guessing that it is a solid state rate gyro. If so, it outputs a value proportional to the rate of rotation. This is not a direct measurement of the pitch angle, but it can be integrated over time to keep track of your actual pitch angle. However, without any correctional input, small errors will accumulate and your pitch estimate WILL be subject to drift errors. Depending on the quality of gyro, ADCs, sampling rates, pitch rates, etc, you are talking somewhere between seconds and 20 minutes before the pitch estimate is completely unusable. Commercial Inertial Measurement Units (IMUs) typically have rate gyros along with accelerometers and possibly magnetic sensors to measure attitude (yaw, pitch, roll) angles.

GPS Altitude
With regard to some GPS altitude comments, it is true that the GPS altitude estimate is typically more noisy than the Lon/lat estimate. However, my research group has successfully used GPS altitude for UAV altitude control many times using both uBlox and Trimble GPS receivers. I can't speak for other brands, perhaps they are less accurate (output rate is also an issue here, 1Hz updates can prove to be a pretty big limitation on the longitudinal controls).

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment

Tidbits

Search this site

The Long Tail by Chris Anderson

Notes and sources for the book

FREE will be available in all digital forms--ebook, web book, and audiobook--for free shortly after the hardcover is published on July 7th (exact dates will be announced here as each form is released). The ebook and web book will be free for a limited time, the unabridged audiobook will be available free forever.[Update: the first free versions have now been released.]

Order the hardcover now!