Sunday, September 27, 2009

I almost forgot

Prototype two's wing is now almost complete. It will be mated to the fuselage hopefully tonight. I must have really bollocksed up using the pattern that I made on the first plane. It is a different diameter than the first. The second prototype has a more tear drop shaped fuselage that the first aircraft. I think it will make it easier to shore up the system with stringers than the purely round shape.

Before we get to actual code...


Before we hop off into any actual implementation, I would suggest that we sit and think about some basics. The very first thing that should be done is to come up with a basic skeleton of the code that you would like to write. This may impact many decisions down the line. Basically, a UGV and a UAS/UAV are the same from the code's perspective. The UAV/UAS use different actual algorithms for certain processes, but the data flow and data collected are not so different. Some data is read, a decision is made, a servo solution is calculated, servos are moved into position and then the system loops again.

One thing that I did, was to develop an object that was a sensor, ISensor. This will be the part that actually interact with any device. ISensorReading will also act as a fundamental contract for data. I would make sure that this object follows in general an observable pattern. That way it is easy to allow other objects to read its data, or to be notified when new data is available. This will make it easy for filtering algorithms to execute and work on the newest data as soon as it arrives. It will also make it easier to make the data collection to be asynchronously collected and processed.

Then I made an instrumentation manager, IM. The IM will have factories for each kind of sensor and observe instances of each of the instruments. This way if something happens the IM can close an instrument and try to reconnect with a new object. In turn, the IM presents data to other parts of the code as needed. No other parts of the code need to see the sensors or interact with them directly.

On top of the instrumentation system, should be a director layer. This will actually be the layer that does all of the work. It makes a nice break line between the device and the presentation, or intelligence. Separating the systems is an important object-oriented technique that is necessary for keeping the code healthy.

More about the director later... I will see if I can get some pictures in to make it easier to see.

Saturday, September 26, 2009

What I am Thinking At the Moment

At the moment, I am trying to decide what is the most interesting way to proceed with this blog. It is important to discuss some of the howto aspects of UAVs and autopilots. I think that it is also important to speak about some of the interesting applications and business difficulties of it as well.

At the moment, there are many stories in the news about blowing up bad guys with thunder bolts from the sky. However, I think that this is not the most interesting thing to be done with the technologies. We are investigating a number of small-scale recycled materials and techniques to apply energy reclamation systems so that the uavs harvest as much of their energy from the environment and recycle as much as they can.

For the record, the soybean epoxies available are just not as good as their petro-chemical equivalents. We are still trying to use them in our skin layups. If we can make use of them, they do come from a renewable resource stream. These adhesives are not recyclable though.

Another big idea, that Buzz Labs is working on is the heat pipe system to pull heat away from the motors and batteries and either use that to generate trickle charges or to be able to cool the batteries to a point that we can keep their chemistries from over heating down to the limit of their endurance. Lithium-polymer (LiPo) batteries do have some physical limitations that make exciting failures possible. Read about the exploding notebook batteries. Buzz's engineers are seeing some success with maintaining battery temperatures even above their rated currents. Battery performance increases are especially good news for the racers and autonomous vehicle systems

We will keep you posted here as we make significant breakthroughs or cool flaming rc parts.

Gyroscopes Are Fun!

Piezo-electric gyroscopes are fun. However, I certainly had to learn a lot of things to get a usable signal from them. Remember that  gyros report a rate of change not just an absolute value. This rate presents an interesting issue, that we have to integrate the signal at each step. You may want to use a more advanced curve fitting integration scheme than the one that I will present here.

Integration for those not in the know is just finding the area under a curve. The catch is that, you will never be given a curve by the gyroscope. Not having a curve means that we must discretize the signal, from these step-wise readings we can write a formula that will help us back out what the absolute angle is in that direction. However, since we are integrating these formulae will not take into account small changes that happen to the signal between samples.






The simplest form of integration is, just calculating a rectangle. Your software will have to remember the last reading from the gyroscope and the last calculated  position.

angle change =dAngle* step length

so the basic formula would be,

Angle i = Angle i-1+ angle change

A better technique would be simply approximating the changes in the curve as linear segments and then calculating the differences as triangles or trapezoids.






This is a relatively bad way to do this, but is easy to understand. I would suggest using a multi-order approach to try and take into account some of the variations in these signals. The nuts and bolts of it is, is that the equation only works if the change in angle is relatively small compared to the current angle. If you are executing maneuvers and sampling relatively slowly this formula will lead your software astray. I would use a gyroscope sampling rate that is at half of the gyroscope's sample acquisition rate. Halving the sampling rate should keep the software getting into too much trouble from landing between readings and getting garbage.

Remember to read your manufacturer's guidance on this. It will tell you how quickly it can measure changes. We use several of these:



They are 500 deg/s sampling rate at 2mV/deg. That is usually too small for our analog to digital coverter boards (A/D boards), so we lower that to 150 deg/s and get a better signal rate of 9mV/deg. This means that we can get a nice clean signal that is several bits wide from our A/D board. Remember that your I/O system will determine a lot of things about your code.

If you sample to fast, you can have lock issues, too slow and you do not get a representative sample. I would suggest that you shoot around 200Hz for samples, and then apply your filtering to bring it down to a rate to allow your other software to make decision on the filtered values as if they were the just read values.

There are better boards available, but the ones from Phidgets.com have a great API for almost any platform. Their 8/8/8 boards are great all-around boards, but do not have the highest sampling precision. For most things, it is plenty.




I really like the .NET support and the usb interface. Even I could figure it out from their examples in only a few minutes. Next time, I will show you how easy it is to connect to the A/D board and begin acquiring signals. The code samples from Phidgets are effective and describe most of the general functions that you will need to implement a system with their instruments.




Sunday, September 20, 2009

Basic Quantities and Some Trigonometry

So You Want to Build a DIY Autopilot

Accelerations

One of the most important quantities for you to measure are accelerations. If your two or more-axis accelerometer is mounted along the traditional axes of the aircraft it will be the easiest to code for. The three traditional axes are:
  • From the nose through the center of gravity on the line of symmetry, the Y-axis, roll
  • From the center of gravity out of the fuselage toward the tip of the right wing, the X-axis, pitch
  • From the center of gravity away from the earth, the Z-axis, yaw

       
Figure of Rigid Aircraft Axes

So, now for some basic Trigonometry, everyone remembers SOH CAH TOA.

In general, the following picture is true for a vehicle moving through space.


Figure of the Direction of the Force of Gravitation on a Body

As you can see from the image, the angle of pitch relative to the surface of the earth is the same angle offset of the weight vector relative to the z-axis in the body frame of reference. If we put our accelerometer so that one of its axes is parallel to the body's z-axis at its center of gravity we are measuring this offset vector. Which is really neat, because it means that we can express the angle of the body in level, non-accelerating motion as ratios of the accelerations

Pitch: 
The angle theta between the actual gravity vector and the measured gravity is related to the pitch of the aircraft (pitch = theta + 90°). If we know theta, we know our pitch! Since we know the magnitude of the earth’s gravity, simple calculus gives us our pitch angle:

accelerometer = cos (theta) * gravity
theta = acos (accelerometer / gravity)
And since pitch = theta + 90°
pitch = asin (accelerometer / gravity)


Woot, we calculated the pitch orientation of our airplane using an accelerometer. Pretty easy, huh?

The real formula that we need to use for the software looks like this:

pitch = atan2(accelerometer / gravity, z / gravity)


Common piezo-electric accelerometers return in units of, g, 32.17 ft/s^2 or 9.81 m/s^2. We also know some more things about the flight that let us calculate the angles relative to the ground. More on this later, it is a bit more than basic trigonometry to describe. These equations assume non-accelerating flight. You can use a magnetometer to get the relative plane in space with less math, but magnetometers generally take more interface programming in my experience.

Roll:

Roll needs a second accelerometer with an axis perpendicular to the first so that we can figure out the resultant vector between them and then the angle. Essentially the vector between the accelerometers becomes the "gravitational" acceleration and the relative readings lets us calculate the angle with an atan2 function. The second accelerometer will have some other things to manage such as the effects of the distance between them on the accelerations measured. Physics fun and none of the boring class.


Yaw:

Yaw is the hardest of the angles to measure. The only answer is to use a magnetometer or a compass. In many ways, yaw can be solved by dead reckoning. Dead reckoning is all that is important for most of the projects in the DIY garage. They will be covered later.






Next we will discuss gyroscopes and the beauty of rates and integral calculus

Friday, September 18, 2009

How I started writing a DIY Autopilot

My intention still is to write my own c# based autopilot. It is not trivial as I found out. Lots and lots of details are needed. The first thing that needs to be done is to determine the instruments that you will need to measure the quantities that you need to know to control flight. Even this seems to be a matter of opinion. For a reference, I found every group that I could that was writing their own version.

From my perspective the quantities that we need to know to control flight are:
  • air speed, ft/s or m/s
  • altitude, ft or m
  • orientation, roll, but pitch is good

These are intrinsic quantities that are really easy to do yourself. Air speed is the model's forward velocity. Altitude is the vehicle's position relative to the surface of the earth. Pitch and roll are the angles of the vehicle relative to the ground. Let me rephrase that, roll is the angle between the right wing and a plane parallel to the ground. Pitch is also known as angle of attack. Pitch is the angle between the plane at the center of the vehicle located on vectors from the center of gravity to the right wing tip and the center of gravity to the tip of the nose and the relative wind.

At the beginning you will need to measure the following quantities:
  • air pressure
  • acceleration in at least two directions

Pressure taps are the easiest ways to measure air pressure in a flying vehicle. Piezo-electric accelerometers are cheap these days and are really accurate. In the next post we will talk about issues with these instruments and the physical quantities that you are actually measuring and how to use those as a basis for a control system.

For all of those inch haters, a quick note about units. You can do this in any unit system. It is unimportant. I will write a quick post on the conversions between the US Customary System and the metric (mks) system. Remember metric is actually several unit systems in one and you have to keep them consistent. Oh, and for those trying to buy nuts and bolts, Japanese manufacturers use odd metric sizes, European use even metric sizes, and the US Customary System/SAE is in units of 1/64th of an inch. So SAE/SAME will have three bolt sizes for every bolt size in the two metric systems. Remember that the thread counts are different though.

In my opinion, if the units are managed consistently then the issue is one of presentation to the user. Part of the display system of my code will show you how to do this with a simple object oriented approach.

Wednesday, September 16, 2009

What do you think of this one?

Ok, I have been looking around, since pretty much no one is voting, I made another one. I have to get back to working on the landing gear for the two prototypes. However, let me know what you think. I have a hopefully interesting article coming up about installing some of the components and an idea of how to do repeatable assembly that on small scales.

woohoo we got the first search engine bounces on the blog.

Another updated historical badge, I like it. The turtle badge came out badly, so I will keep it to myself.

Monday, September 14, 2009

Second Prototype is Almost Ready

That is a bit of a lie. Maybe it is just marketing, can't sell something that does not exist. Well you can, but I am not as big as a fruit-shaped software company. So I am trying to upload some of the better pics to the blog. The wing frame came out really well, maybe even symmetric, but we all know that will never happen.

The first one is not doing poorly, we are waiting on some plexiglass hoops from the sign cutters to shore up the doors and part of the fuselage. As soon as I get those, we should be pretty close to getting the engines installed. I have to finish doing the soldering, but my little iron from radio shack takes a while to heat up the fat connections for the motors. Should try to do it again.

At the moment, it is all looking good. Just need to get the last bits finished so that I can get some more pics together for the main site. Please don't forget to visit the main website, http://www.buzzlabs.us. A lot more information about everything there.

Saturday, September 12, 2009

Squadron Badge Ideas

Every squadron needs a symbol. Some research into the oldest American squadrons lead me through some interesting history. More filler for my head, I must admit. From two of these, I drew up some low color variants. Let me know which looks best out of each group.

US UAV Squadron



Jolly Roger


Jolly Roger with Triangles

Jolly Roger Round

EU UAV Squadron


Felix Beer

Felix Camera


Felix Bomb



Let me know which you guys like best. email

Tiny 2.11

I need another u.fl connector-based antenna for the ground station XBee Pro modem. I found some at Sparkfun. Per advice, the best plan is to go for the cable and duck route. All of the electronics will be boxed to make them easier to shield from the high current wiring from the batteries to the ESC to the motors.

My current plan is to use:


SMA duck antenna

u.fl to SMA cable

Friday, September 11, 2009

Cheap RC and carbon fiber

Ok, this will be quick. Do not buy cheap RC electrical connectors. Get good gold plated, high current connectors for your EDF project. Make sure that you shrink wrap them so that they do not spark across each other. Remember, 6s and 50A is welding current level. Just be careful, better to fly next month than to miss it because you grounded out your ESC and motor.

Also, put paper down where ever you are working with carbon fiber materials. If you cut on them or somehow scratch them, you will get broken fibers and that means that you will have hundreds or thousands of terribly painful little daggers waiting to find your skin. Don't sit on your work area, just let us agree to this. It will teach you not to do it twice. Just say no.

Thursday, September 10, 2009

Tiny 2.11 Out of the Box

For those of you following these projects, I have tried to wing an autopilot myself. It actually is getting there, but I thought. Better to get to market with a product before we spend five years debugging stuff that was just a dead end to begin with. I was reading around about each of the other projects on DIY drones. I was considering the Ardurino autopilot, but was a bit concerned of writing ANSI C at a register level. So I went with the Paparazzi autopilot which is well received and more finished to a level where I was willing to get my feet wet.

I got my Tiny 2.11 from Chebuzz in California/UK.

"unpaid recommendation" The guys at Chebuzz are great, I do suggest buying from them. They are better priced for the American market than the other assemblers, have great service and are willing to answer even my bone-headed questions. "unpaid recommendation"

Out of the box, well it came in a normal padded envelope. I was eagerly trying to figure out what each board did. Having returned from vacation, I had forgotten what I had learned. So, here are the parts I received from the "Everything You Need" kit from Chebuzz.

XBee Pro modems
modem0modem1modem2modem3modem4

Main Tiny 2.11 board with pico blade connectors
top
bottom

ESC throttle wire
black and white two pin

The "Fat Man" Is Still Grounded, He Is At the Pub So We Won't Worry Just Yet

Yeah, this kind of sucks. After a year of construction and planning, we find out that there is an international weapons treaty that says that you cannot sell certain weight vehicles internationally that have autonomous guidance systems capable of free flight beyond a certain range. Ok, I get it. Who wants Tom, Dick or Harry building a 150lb (70kg) pop rocket and flying it half way across the planet to make a real mess.

When you think about it, they are just setting rules to make it hard for the forces of evil. I have no interest in being one of the "dark side." My master tells me so. Ok, no more Star Wars references, but I make no promises. If anyone knows more about the "". Or what the real rules are about any of this, please let me know. There is no interest in using this device for any government purpose. I want to pull banners at the beach or to do small scale spraying of crops.

Another question that would be great to hear some explanation of and/or some reasonable listing of what can be discussed between international unmanned vehicle (UAV/UAS/UGV) colleagues. I would hate to blip someone's radar because I was talking about a simple guidance system idea at the pub. Yeah, yeah this is a real problem, I am more likely to be drinking a pint than trying to sink a 40' put on the back nine of Pebble Beach.

I am pretty sure that this is a messy topic and probably best left well-enough alone. However, if there is a chance to get this sorted and get the Fat Man to fly as more than a giant-scale RC plane that would be freaking awesome. Any qualified help is appreciated, I know that the FAA has been pretty draconian in their official guidelines.

Tuesday, September 8, 2009

Viral marketing Ideas

Marketing a small company is tough for anyone. So I am looking for cute ways to drive traffic through the site. Hopefully, traffic that wants to buy a plane. One idea is to try the viral video route. A colleague of mine from work came up with a great title. Let me know what you guys think of, "Fat Man Flying presents A School Girl Plane White Panties First Flight". That should get us some of the other search hits from YouTube and on the blog.

Pity, I do not live in Czech anymore, it always seemed a lot easier to talk a girl into letting me see her panties for a hare-brained video. Got to love it. I have some other ideas, but the viral video has the best chance to bring traffic to the site. We have started spamming business cards at UAV and fly-ins. Anyone have any other ideas? At least try to be professional, I am trying to run a legitimate business.

Monday, September 7, 2009

Chebuzz Paparazzi Tiny 2.11 Autopilot Setup

I will start posting my adventures in setting up a Chebuzz Paparazzi Autopilot. It does not seem to hard, but there are always hitches to these things. I have the equipment, I will post some pictures tonight or tomorrow.

I bought an "everything you need" kit witht he Xbee Pro 2.4GHz modems. I had some questions from the Chebuzz guys, and I will gladly post their responses to the blog as they come in.

One of the things that I would like to cover here is the construction of some airlock boxes for the Tiny 2.11. That way there is no cable tension on the devices themselves and we will have some nice boxes to mount inside the fuselage. It is not very professional to just stick boards into fuselage, there can be all kinds of issues if they are not properly secured.

What the Heck Are the Real Rules?

I have been canvasing anything that says UAV and not Boeing, Lockheed or General Atomics for several years now. One thing that I have noticed is that few if any sites even mention much less brag about Special Airworthiness Certificates or even Experimental Flight Airworthiness qualifications for their UAS. Knowing that they seem pretty tough to get still, I would think that they would happily brag about the fact theirs received one.

So how are they making money? Is this some sort of strange smoke and mirrors game? If you do not have a certification you are not allowed to fly in the United States' airspace. So how are they doing it? I know way back when in 1998 they flew from New Foundland to Ireland, major props for that. Back then noone really cared or probably knew to care. What about now? As I read it on DIY drones and other places the rules are pretty clear, no commercial and LOS. I get it, it seems like a good idea to film the kids' soccer game with your UAV. It does right up to the part when the LiPo packs overdraw and now you have a really cool shot on goal.

As a matter of fact, it took me a few minutes to come up with that example. Most of mine were far more brutal, but that seemed to be a happy medium. Little Jimmy running away as dad's new rc plane which was an ARF and still took him two weeks to build catches on fire. Mom's new HD camcorder and all comes down in a ball of wicked fire streaking toward the goal. Oh no, Gahd'zee'ra. Always have to have the monster movie reference when a flaming anything streaks across the sky. Mothra could not shoot flames.

Does anyone have any ideas how these companies stay afloat? Is it just a better marketing face than balance sheet? I can say that I am intrigued how you can be much bigger than a room in the garage sized company under the current regime. I guess maybe there is a private property application here, maybe that is enough to keep you afloat. At least in the , what they do not know, will not hurt them ballpark.

Sunday, September 6, 2009

Wicked Hard

Having never scratch-built an rc plane with mixed-materials it is pretty tough to get it right. Yeah, I suck, but this is more than that. Over the last two years my co-conspirators and I have tried about every technique to repeatably build airframes. We have come full-circle now and say that a normal composite construction system is probably our best chance to make a good quality product with the least effort.

Try to epoxy carbon fiber and Aluminum together, you will get sticky fingers and big globs of epoxy everywhere. It will eventually fix the pieces, however we find that we cannot get a great bond this way. You can scuff and sand all you want. The epoxy does not do more than touch the surface of either part. Meh. It works and you can do it, do not get me wrong. The difficulty involved is a bit more than I think is necessary. We are running some experiments now with some almost ready to fly (ARF) models. Sacrificing a few models to the Gods seems a good start, and par for the course.

At least they already have all of the places for servos, spars and wire harnesses precut and in a reasonable place. Why reinvent the wheel, we have our own wheels but need to practice a construction technique. It is a well-documented idea in the composites industry. Essentially we make negative molds that allow us to control composite gauge in the best places and create bumpy sheets of composite. These sheets are bonded and reinforced as needed. Finally, they are covered with a material so that they may be painted or have decals applied.

I will include some pictures a bit later when we get closer to a final product. We noticed that alignments are still an issue. Aligning six pieces is really easy compared to aligning and balancing forty pieces. That is really silly in my opinion. We tried a bunch of techniques to make airframes consistently. Maybe next time I will talk about some of our creative failures. None were failures, but some took a lot more work than others or cost a small fortune.

We are trying to be Orville and Wilbur-like not like that other guy. The Wright brothers got off the ground for less than $2000 and their main competitor was funded by the Army and had something like 50x their budget. He even built a special barge to take off from and that never worked either. It is time to get a good rugged system in place so we can go into nearly serial production of the airframes.

Saturday, September 5, 2009

Welcome to Buzz Labs' Unofficial Development Blog

Yeah, yeah first posts always are tough. Here is a good college try. Don't forget to visit us at http://www.buzzlabs.us or at Facebook Buzz Labs User Group or friend us.