This is the payoff video showing the hybrid autopilot system in action in the Resolution 3 airframe. (By the way, this is HD video so watch it full screen if you can!)
I am skipping many details between integrating the hardware and flying, but just as a quick overview:
We first integrated the system into a Senior Telemaster. After 4 trips to the field over the span of 2 days, numerous flights, and a bunch of work in the evenings, we felt like the system was coming together and working every bit as well as it was supposed to. There are always more things we could do with the telemaster airframe, but now that we were fairly confident that the system was working end-to-end as designed, we dropped it into our Resolution 3 (blended body, composite flying wing airframe.) The new hybrid autopilot system needed some gain adjustments versus the old prototype autopilot so we guessed at those based on what changes were needed with the Telemaster configuration.
We enjoyed a flawless bungee launch of the wing, climbed to altitude, flipped over to AP mode, and the aircraft flew off flawlessly and ran through it’s demo routine without a hitch. The clouds were dramatic and we noticed a rain squall moving in, so we landed and packed up just as the rain set in.
Here are some high points of the new system:
800Mhz ARM processor (with hardware floating point) running a 15 state kalman filter and all the autopilot and navigation code.
WGS-84 math used for heading and route following.
Accurate yaw estimation when the filter converges.
Accurate wind estimation
100hz sensor sampling, 100hz filter updates, 100hz autopilot and navigation updates, 100hz actuator updates with up to 400hz PWM signal generation rate for digital servos.
Tablet/smart phone/laptop ground station interface.
If you just like airplanes, here’s some nice footage of our Telemaster landing. This video was taken during our 2 days of Telemaster integration effort …
This is a project that was sponsored by NOAA to develop a fully marinized small UAS that could be deployed from a variety of small vessels, recovered in the water, and used for marine debris detection or wild life surveys.
The “Resolution 3” purpose built UAS airframe is just one of the really cool products to evolve out of this project.
(If it was me, I’d click on the “watch on youtube” icon in the lower right corner and select 480p and go full screen — but that’s just me.)
Flying a continuous tight circle pattern around a fixed ground reference point is about the closest thing we can get to parking an airplane in flight. It isn’t too hard to do a lazy orbit around the point, but we want to keep the radius fixed, even if there is a wind. This means that as we fly around the perimeter of the circle we have to continually vary our bank angle and turn at different rates relative to the wind so that our ground track maintains a perfect circle of the desired radius.
Here are some things to look for in the movie:
I’ve turned up the turbulence to moderate levels so the small aircraft gets bounced around quite a bit. Still in the last shot you can see that the flight controller has maintained a pretty tight circle the whole time.
This is a 3d model of the new ATI Resolution 3 (a small marinized UAS.) Stay tuned for more details if you are interested in that sort of thing.
FlightGear offers a variety of interesting view points and visualization tools, including smoke and trajectory markers, HUD overlay, animated control surfaces, realistic environments, wind and turbulence.
If you look carefully, you can see how the smoke drifts relative to the red/blue trajectory markers.
This is all part of a demo package I am putting together that shows things like autonomous-takeoff and landings, a gyro stabilized camera simulation, circle holds around a point, route following, a cool new UAS airframe under development — all mixed in with FlightGear’s wonderful prototyping and visualization features.
In previous posts I’ve described the process of carefully modelling the basic geometry and mass properties of a UAS in YASim to provide a real time flight dynamics simulation of the aircraft in FlightGear. I also described how we carefully modelled the blended body shape of our UAS using airfoil plots and spline curves. These curves were then imported into MoI and used as the basis to generate a smooth, flowing, organic surface shape. MoI is able to export the model as a 3d triangle mesh in a variety of formats including 3ds.
FlightGear can directly import 3ds models and render them in the simulator. However, I found that my model needed be cleaned up in several respects. All of this discussion relates to Blender – a very capable open-source 3d modeling tool. This isn’t intended to be a blender tutorial, but a brief overview of the steps involved in preparing a model for use within FlightGear
Surface smoothing: If you click on the above thumbnail you will see that the basic model imported from MoI is “faceted” or in other words, the triangle surfaces are flat and you don’t see the intended smooth curved surface. One of the first steps required is to select each “Object” and select “Set Smooth” in the “Buttons Window”. Repeat for each object in the model.
Inside-out surfaces: I decided for simplicity, I would export the model in the .ac3d format (a text based format) for final use in FlightGear. When I did the export I discovered many of the surfaces where inside out — the face normals were pointing in rather than out. This causes the surface to be displayed inside out and shaded wrong in FlightGear. So the next step required is to turn on the display of face normals, select each object individual (right mouse click), enter “Edit Mode” <tab> key, and flip the face normals if needed.
Orientation: FlightGear allows you to add an xml wrapper around your model to adjust the orientation of your model (flip it by 90 degrees for example) in case the model was developed for a different coordinate frame layout. However, since I was doing all the prep work anyway, I rotated the heading of my model by 90 degrees in blender so I didn’t need any extra transforms when drawing the model inside FlightGear.
Scaling: For convenience and due to the scale of this design, all the original work was done in inches. This transfered to the MoI model and thus to the blender and flightgear models as well. However, FlightGear requires units of meters so the model was grossly oversized when imported into the simulator. Blender has a scale function, so I selected the entire model and scaled it by a factor of 0.0254 to convert from inches to meters.
Control Surfaces: this aircraft is a flying wing and has as very simple control system. Each wing has a strip elevon that runs the length of the wing. Aileron and elevator inputs are mixed (summed) to produce the actual control surface deflection. In the real UAV, this mixing is accomplished in the flight control software. On an RC airplane this mixing would be done inside the pilot’s transmitter on the ground. In FlightGear, the mixing is done through the YAsim xml config file. Blender has a cut function accessed by typing “Shift-K”. I went into top view mode, drew lines for the control surface cuts and cut the mesh to create the elevons.
Textures and Painting and UV Unwrapping
This could be the subject of a book just by itself, but let me give a really quick summary.
Blender has a cool feature called “UV Unwrap” which is found in the “Mesh” menu when you are in “Edit Mode”. There are several unwrap options, but I found “Unwrap (Smart mode)” worked the best for my purposes. The following image shows how blender unwraps the mesh (in this case the wings and elevons.) In the bottom panel I selected “UV/Image Editor” and it shows the unwrapped mesh image.
Now here’s the cool thing. You can save this image out to a file and then import it back in. Blender will use the imported image to texture the file exactly as it has been unwrapped. So with this template image you would see a model that looks like a wireframe. I then loaded up the images in blender and labeled each panel with a big number. Inside FlightGear (or osgviewer) I could then identify which number corresponded to which panel (top left, bottom right, etc.) I further edited the template file to include this extra information. The result when drawn in FlightGear looks like this:
Now I have my “paint kit”. I can load up the templates in gimp (or photoshop), create a new layer, and draw my color schemes and markings over the top. For the wing panels, I did a quick hack of a coast guard-ish color scheme which looks like this:
I then export just the marking/paint layer back out to my texture files that the model references and the “finished” result looks like this:
This is still a work in progress. I have yet to animate the control surfaces. I also need to add a spinning propeller. The paint scheme is just a quick example and could use many many improvements.
With the paint kit established, a variety of paint schemes can be developed. Here are two more examples:
Official ATI scheme:
A gray camouflage scheme:
There are many steps required to model a new aircraft design in FlightGear. Primarily this involves creating a flight dynamics (physics) model and a 3d model of the design. Each step requires several sub-steps and there is always room for improvements and refinements. This is an example of an R/C scale UAV. Full scale aircraft are much more complicated involve detailed cockpits, many more animations, much more complicated 3d meshes, and much more work texturing and painting. Hopefully I have provided a taste of what’s involved. With a little effort any one can jump in and learn the tools to build simulated aircraft. But it does take time and patience.
Finally, here is a (sorry, kind of crude) youtube video showing the model flying inside FlightGear:
MoI (Moment of Inspiration) is a really interesting 3d modelling tool. There are two things that separate it from other tools in my view.
1. It has a very simple and intuitive interface.
2. It has powerful and intuitive primatives for drawing and manipulating curves and 3d surfaces. For example MoI allows you to define 2d (or even 3d) curves and then stretch a 3d curved surface between your curved lines–possibly with additional guide curves to control the shape. Like with any tool, it takes a little thought, practice, and planning to break down the structure and represent it using primatives, but MoI allows you to quickly create and edit some very complex and almost “organic” shapes.
You may refer to my previous post related to modeling with perl. I used a perl script (math + airfoil data + spline curves) to carefully define exact lengthwise slices along the fuselage. I then imported these curves into MoI and stretched a “network” surface over them. It’s about a 10 minute job in MoI and I have a beautifully smooth curved fuselage.
I adjusted my perl script to also generate the exact airfoil profile at the wingtip and imported that curve in the correct 3d location. This allowed me to quickly built an entire wing using the “sweep” function. I then added a motor tube (which is just an extruded circle to make a cylinder.)
I used a similar approach to create a nice curvy winglet. from the picture you can see I designed two different styles of winglets. I think I like the looks of the drooping winglets better. I don’t know yet what we’ll end up with on the real aircraft. We’ll probably design the wing tip so we can mount any winglet design that we’d like. You can also see in the background that I was playing around with designing a shaped vertical stab. These will mount inboard and be the primary yaw stabilizer. It took me no more than 10 minutes to create each winglet shape in MoI.
The ultimate goal is to create an accurate 3d mesh of the aircraft. This will be combined with the dynamics model to produce a realistic and visually compelling real time simulation of the design in FlightGear. MoI has several mesh export options and allows you to tune the mesh density so it is a perfect front end design tool for really nice 3d models.
MoI is a really awesome 3d design tool. I can’t speak highly enough about it. I am merely a novice at 3d modeling, you can browse the MoI forum and find many incredibly brilliant designs that the experts are creating. MoI is a commercial application, but if you are building “organic” shapes with curved surfaces, it is worth every penny.
Dynamics (Physics) Modelling and Flight Simulation
There are many great tools available to help engineers design and develop new aircraft and flight control systems. One such tool is the flight simulator. More specifically: an open source flight simulation such as FlightGear. Being open-source FlightGear is flexible and adaptable and can be used to solve or explore new scenarios that a proprietary software applications may never have anticipated.
FlightGear + YASim
Here I describe the process of modelling a flying wing in FlightGear using the built in “YASim” physics engine.
A brief word on yasim (wiki documentation): YASim is a physics engine that inputs a physical description of the airframe, the wing and tail surfaces, engines, landing gear, weight and balance, etc. In addition you input cruise performance numbers and approach performance numbers. YASim has a built in solver that computes approximate lift/drag curves for your model and then physically models the individual components in real time to produce the overall dynamic behavior of the vehicle.
For this example we are modelling a flying wing. To do this in yasim, I defined the inboard 3/4 of the flying wing as the main wings, and the outboard 1/4″ of the flying wing as the tail. Yasim allows you to define any number of surfaces in any arrangement, but this approach works out pretty well.
Notice that yasim “mirrors” the wing and hstab automatically so you only define one side in the configuration file. Visualizing your yasim configuration can be very helpful and can help eliminate math mistakes and typos. Here is a link to a Blender YASim import plugin. The image above shows the result of importing the flying wing configuration into blender.
Once the basic model has been crafted, it can be flown inside FlightGear. If you have provided correct geometry, correct weight and balance information, correct propulsion information, and correct cruise and approach performance values, YASim will create a model that flies very much like the real thing. However, YASim makes many internal assumptions and isn’t perfect, and most of the time we don’t have perfect data for our aircraft. So once the initial model is created it is worth flight testing and adjusting various parameters to tune the model towards real world performance.
For instance, control surface effectiveness can be tuned to get the correct rotational rates. Engine power can be tuned to get the correct rate of climb. Because YASim is designed around a solver that computes lift and drag for your design, if you increase the power of your engine, yasim will reduce lift and increase drag so that your specified cruise speed will still be met. Essentially this gives you an aircraft that is draggier but has better climb performance. In my case, our wing has an incredibly efficient glide ratio, so I ended up reducing power substantially from my initial guess. This created a wing with much less drag and much more lift. Climb performance was reduced, acceleration is slowed, but now it will glide forever just like in real life.
Because YASim uses the physical geometry of the design to compute forces and moments at each surface and then sums all of these up to produce the overall flight dynamics of the aircraft, it is possible to make changes to the airframe in simulation and observe the effects in the simulator. For instance, the flying wing design in this example has twin vertical stabilizers. If I want to test the effect on lateral (yaw) stability of moving these surfaces fore or aft, I can do that in YASim. A quick tweak to the config file is all that it takes to adjust the location of a surface. I leveraged the FlightGear autopilot + a simple nasal script to fly a scripted flight pattern. Basically I stabilize in straight and level flight. Then I input 1 second of full right aileron deflection, followed by 2 seconds of full left aileron deflection, followed by leveling the wings. Through this maneuver I plot the “side slip” angle (beta). This gives me an indication how straight the aircraft tracks through the maneuver with different vertical stab locations.
In the above graph the line number (0.48, 0.58, etc.) corresponds to the distance of the vstab behind the nose in meters (this design has a wing span of about 2.3m.) As you can see the further rearward the vstabs are placed, the more stable the design becomes (the straighter it tracks and the more quickly it recovers.) You may also see that as the vstabs are pushed towards the CG (about 0.37m behind the nose) the stability starts to diverge rapidly. But as the vstabs are pushed back to about 0.68m behind the nose, the stability increases, but we are starting to hit diminishing returns. According to yasim, we could push the vstab further back and get more stability, but perhaps not a lot more.
Other Uses for Simulation Modelling
Besides basic flight dynamics modelling and validation, a simulator can be very useful in many other areas of aircraft development. Flight control systems can be prototyped and tested. Higher level flight control systems (route following, circle holds, autonomous landings, etc.) can be effectively prototyped and developed within a simulator. Even payload systems can be modeled and prototyped inside a simulator. Any work that can be done at an engineer’s desk in the comfort of their office will be far more productive than in the field under harsh conditions when the pressure is on. And when something developed in simulation works exactly right in the real world on the first try it is just very very cool!
This is just a simple example, but it shows some of the power that a flight simulator can bring to the arena of aircraft design. Simulators are never perfect so you have to keep in mind how far you can push them and what data you can trust to pull out of them. As a design evolves and as you gain real world flight experience with the actual design, you can validate the simulator against real flight data and adjust and improve the simulation model. This design cycle leads to a positive feedback loop which creates a more and more realistic simulation model that yields more and more useful simulation results.
Are you insane? Yes, but in a nice sort of way (I hope!) 🙂
Since I’ve already admitted to being insane, you won’t mind if I explain the back story that let up to my evil plot. I work with a small high tech company (ATI out of Wasilla Alaska … and yes if you were wondering, but no I haven’t met her myself.) Some of the things we do is develop a variety of UAS related technologies. One project involves developing a marinized (water proof) UAS that can be launched from a small vessel and recovered in the water and generally operated with minimal infrastructure.
One of the guys on the project has wonderful artist talent and he hand carved the center section of our blended body flying wing design. It really looks sweet once it’s all together and in the air, but here is a close up of just the center section.
Well one thing leads to another and we decided we wanted to draw this up on the computer so we could cut molds, visualize and test design changes, etc.
But how the heck do you draw something like this. The only straight edges on it is where the wings plug in. The rest of it is totally free form and all blendy and curvy. I don’t see any cubes or spheres or cones jumping out at me. You are probably thinking of a few obvious approaches … make a mold from the prototype, laser scan it, etc. and sure those work for what they do, but they have draw backs … and we want the entire design on the computer and in a way we can play with it virtually.
As I started staring at the design and trying to analyze it’s structure and look at the outlines it occurred to me that the 3-view edges could be modeled pretty nicely with spline curves. I thought that if I could represent the outlines correctly, then I could create slices and march down the length (or width) sizing and blending my slices based on the 3-view outlines. At the end if I could only find a way to stitch the slices together, I would have a 3d model. That was the insane plan!
Here is a very simple spline curve. I could have used as many intermediate points as I wanted, but here I just have a start point, an end point, and one intermediate point. The curve will pass through all three points. In addition I can “clamp” the slope at each end. The following is a plot of a sample spline curve. With just a simple system like this I was able to model all the curves on our fuselage!
The following plot shows the right half of the fuselage from a top view (the front is to the left in this plot.) The leading edge is modeled with one curve, the straight edge at the top is where the wing plugs in, and the trailing edge is modeled with it’s own curve. Simple, and it’s already starting to look like something!
I don’t have a picture, but I did something very similar for the front view … one lazy curve from the top of the wing to the center, and a more aggressive curve from the bottom of the wing sloping quickly down and then flattening out along the bottom to maximize the volume inside.
Next I’ll walk you through the process of creating slices. One thing I haven’t mentioned yet is I have the outline of the wing’s airfoil as a set of coordinates normalized from 0.0 to 1.0. This way I can easily scale the airfoil to any size I want. The way the model is setup, the slice that butts up against the wing has to be an exact match to the airfoil, but as I step towards the center, I need the slices to more and more take on the side view shape.
So lets start simple. At each slice point I lookup up the leading and trailing edge positions from the top view curves. I use these points to simply size and scale the airfoil. I’m not worried about height or blending into the fuselage shape yet. When I plot out my different size airfoils they look like this … cool. But notice that the the leading edge of each airfoil size is horizontally the same as each other which doesn’t represent our model and makes the center of the shape much taller than at the wings.
The next step is to raise or lower each slice (and size it vertically) so that in addition to following the correct leading and trailing edge profiles, the slices also follow the correct top and bottom profiles. Here is what it looks like: Ignore the lines in the center, those are just an artifact of dumping all the slices into a single line plot. This is improving but there are still some things to notice. Obviously there is a problem at the trailing edge and also the thickest part of the airfoil is moving forward. We want the thickest part of the airfoil to stay in the same place as we move inboard with our slices.
In this next plot we divide the airfoil shape at it’s thickest point so we have a front and a back. As we march inwards (longer airfoils) we keep the center point fixed and streeeech out the front portion. (again ignore the horizontal line garbage.) The front of our model is starting to look really good! The trailing edge needs work.
In the next plot I simply align the trailing edge height of every slice to match the trailing edge of the wing. This cleans up the model even more and it’s really starting to look like something. However, we are still using the airfoil shape in the back half and we need to blend that into the center line shape so we have more volume in our center section.
The next plot shows the correct center section outline in the bottom rear (the top rear still needs work.) It’s hard to see from this plot but the bottom rear portion of the slices close to the wing match the wing airfoil shape and as we march inwards, they slowly blend into the correct fuselage shape. We need to do the same thing with the top rear of the slices.
The following plot is almost identical to the previous one except the top rear (left) has been curved outwards to make more internal volume. Again we match the airfoil shape near the wing and blend to the fuselage shape as we move inboard. This is the final plot. All our slices are looking really good!
The next task is to figure out how to stitch all the slices together to make a 3d surface mesh. Here are a couple technical details. I output the AC3D format because it’s a well supported (in the open-source world at least) and has an easy and well documented ascii format and structure. I won’t say too much about it. Basically I walk through each slice and create triangles that connect the points up with the neighbor slice. You can see the resulting structure from the following 3d pictures.
Because the model and the slices are all script generated, I can easily set how many slices to create and for each slice how many “chops” front to back I create. With a tap of the keyboard I can generate an incredibly finely detailed model to send to a CNC machine, or a more coarse model for real time visualization or simulation.
All the curves and dimensions are paramaterirzed, so if I want to change the length of the nose or the tail, adjust the overall depth, fiddle with the shape of the curves … it is all very easy and quick to do.
Here is the final 3d shape that is beautiful, sexy, and blendy and very closely matches the artist’s original hand carved prototype. (I just show the left half, because you know, mirroring the other side is just a bunch of busy work.)
Feel free to click on any of the plots or pictures in this post to get the full size version.
So there you go, a slick little 3d model generated by a perl script that lovingly captures the artists original concept and in a few areas goes a step further with curving and blending the shapes together.