Coding and Complexity

Norris Numbers

I recently stumbled on the following article about “Norris numbers”

http://www.teamten.com/lawrence/writings/norris-numbers.html

The quick summary is that for an untrained programmer, 1500 lines of code is about where they hit the wall before they succumb to complexity and organizational issues.  The next big barrier is 20,000 lines of code for those that have some training and a bit of experience.  The next big barriers are at 200,000 lines, 2 million lines, etc.  At each level, a programmer or team has to develop new techniques and strategies to overcome the inherent cognitive limits of our human brains.

SLOCCOUNT

Linux offers a neat little tool called “sloccount”.  You can run it on just about any source tree, and it will count up the lines of actual code and then estimate how long it might have taken to develop that code and what the expected costs might be.

For example, my core UAS autopilot project is about 41,000 lines of code currently.  Sloccount estimates this represents nearly 10 years of effort (I started the work in 1995) and at a modest yearly salary estimates the cost to develop this code at about $1.3 million dollars.

My first reaction is this is crazy talk, sloccount is just pulling numbers out of it’s rear aperture.  But after thinking about it, maybe these numbers aren’t so far off.  If you also consider the need for a project to mature over a period of time and consider bugs, testing, etc. then it’s not so much about how many lines of code can you crank out per hour, but more about how much effort is required to create a body of code that is functional, robust, and mature.  If you take a mature software package and work backwards, I suspect sloccount’s numbers would start to look much more reasonable.

Workload and Expectations?

I’ve spent my career in the trenches.  I never really was interested in the management track.  This clearly colors my perspective.  When I read generalized comments (like the article linked above) my first thought is to apply them to myself.

After reading the article about code complexity barriers, I immediately went out and evaluated several of my projects.  FlightGear = 264,000 lines of code.  My UAS autopilot is 41,000 lines of code.  My little summer side project is 6,000 lines of code (sloccount estimates that is 15.76 months worth of effort packed into about 2 months of time.)  My model airplane designer project that I’ve worked on during Christmas break the past 2 years is 5,600 lines of code.

I still don’t think we can put too much faith in sloccount’s exact numbers, but when I wonder about why I’m so overwhelmed and feel buried in complexity and deadlines and pressure, maybe this offers a little perspective, and maybe I’m doing ok, even if I feel like I’m coming up short of everyone’s expectations.  For the managers and entrepreneurs out there, maybe this can guide your expectations a bit more accurately.

Cutting the Cord

Update: 10/01/2014

Things just aren’t quite falling into place perfectly for this cord cutter.  Since cancelling our satellite, I’ve been monitoring 4 possible antenna DVR options.

  1. Tivo Roamio OTA.  This seems like exactly what I’m hoping for.  Maybe a little expensive on the monthly subscription, but I’m willing to give it a try.  The downside: not available anywhere, any target date has been scrubbed.  Rumors suggest best buy is removing all tivo products from their stores.  Oof dah.
  2. Tivo Roamio.  This is $110 more than the Tivo Roamio OTA for the initial purchase with the same monthly subscription.   On the plus side it is available and shipping now.
  3. Tablo DVR.  This one looks really interesting.  However, I don’t own an ipad and I want to watch TV on my TV, not on my tablet.  They say they have newly added Chromecast support, but everything I’ve seen suggests their android support (needed for chromecast) sucks, and it’s unclear if watching live TV would work through the chromecast and how sports type shows would look.  It’s fairly pricey on top of everything else.
  4. Smart TV.  I looked at this for the first time yesterday.  It seems plausible, but some of the basic features I would expect were in their premier package and not their “basic” package.  This one just didn’t quite have me jumping up and down either.

So what is my plan?  For now I guess I wait for the Tivo Roamio OTA which could be a month or two or more away from being available to me.  In the mean time maybe I give up trying to save $110 and just buy the original Tivo Roamio.  But for now I keep watching.

Dear Tablo: you almost had me, but you lost me on your poor android support.  Give me a reasonable chromecast experience on par with netflix so that I can use my phone or tablet as a remote control and I think you probably would have my money.

Update: 9/23/2014

As of today, the 9/14/2014 release date of the Tivo Roamio OTA has come and gone.  The latest availability estimates are late October or early November.  Will I even want a tivo by then?  I guess we’ll have to wait and see.  Are there other potential options?  Does anyone have any opinions on the “Tablo”?

The cost of having all the channels you are told you should want

$110 per month.  I’m almost embarrassed to admit that is how much we were paying our satellite company each and every month for HD + DVR service.  $1320 per year.  That didn’t include any of the extra pay channels we didn’t get — like HBO, Cinemax, Stars, pay per view, etc. etc . etc.  I can’t imagine what some people must pay every month.

Was it great?  Was it awesome?  Was it worth every penny?  Did I eagerly watch each and every second of every NFL game every week?  Did I suck up endless 24 hours cable news shows?  Was I current with all the reality shows?  Did I see all the movies?  Did my kids ever run out of Disney and Nickelodeon shows to watch?  What ever happened to Hannah Montana?  Are they still making new Spongebob episodes?  I’m sure I would know the answers to all these important questions if I actually watched $110 worth of TV each and every month.

Maybe I was getting my money’s worth at some point along the way?  Somewhere, somehow, I accepted all of this.  But then we signed up for netflix and discovered so many of the shows and movies we do or did watch are available at 1/10th the cost.

Cancelled!

So we did it, we called up our satellite company and cancelled.  They gave me several chances to reconsider and even found a way to get my bill down to $68 a month.  But we held firm, they accepted our decision and we parted ways.  It was a much more pleasant breakup than others have reported with certain cable companies.

What Next?

Rabbit ears?  Running to the refrigerator or bathroom during commercials?  Making sure you are home at specific times to watch your show?  Missing your show and never getting a chance to see it?  Programming your vcr and juggling vhs tapes?   Getting up to turn the dial and adjust the antenna to switch stations?  Is this my new life?  Not exactly.

Digital Antennas

It suddenly occurred to me I had never tested the tuner on my TV.  I didn’t even know if it had a digital tuner.  So I went to the store and spent $25 on a digital antenna.  It took some fiddling around to find a place that worked, but it worked!  For me, closer to the window helped.  It was also sensitive to height and direction — table top level didn’t work work, but eye level or higher worked much better.

I discovered some interesting things when I plugged into the local broadcast world.

  • The resolution and detail was so much sharper.  Even though I got all the major broadcast stations over satellite, it turns out they heavily compress the signal, even the HD signal.  The local broadcast signal is way sharper!  If you are a sports fanatic, you should check out your game on the local broadcast station and compare to your satellite or cable feed.
  • I found a myriad of stations I didn’t know existed.  If you are into classic TV shows or classic movies, there are stations out there that feed an endless supply over the airwaves.
  • Soccer is my sport and the local mini-professional team broadcasts their games.  Cool!  I played one summer with the guy who is now the head coach, and his dad (who was the coach of that team) is now one of the broadcast announcers.  Crazy!  (I was never close to good enough to play at higher levels, but one summer I played on a team where everyone was a lot better than me, and it was a good experience.) ;-)
  • I do miss my DVR.  I miss being able to set and collect shows and watch them when I want.  I miss being able to pause, skip commercials, rewind to catch something I missed.

Tivo to the Rescue?

According to the Tivo web site, they released a new version of their tivo designed especially for me.  For $50 (plus a modest monthly fee) they offer their basic DVR for recording over the air channels.  It has no cable card slot which I don’t need or want.  It is to be sold exclusively at Best Buy, but none in my area seem to have it yet … I am impatiently tapping my foot right now Mr. Best Buy.  Please take my money!

Netflix

Of course Netflix, and other streaming services such as Hulu, Amazon, and Youtube are what make this endeavor possible.

Big media companies, big content providers, and big cable/satellite companies are working hard to lock up exclusive deals and shut out those that don’t buy in.  These companies have tremendous power.  It’s why so many people stick with their current expensive providers.  But I feel the tide is shifting.  They won’t be able to lock things down forever, and eventually will have to relent to the online streaming world.  Kids these days (I’m told) watch much less traditional TV that we did as kids, and instead are watching their shows online, on their phones and tablets.

I’m not the first nut case to cut the cord, but I still feel like a pretty early adopter.   Maybe?   Maybe not?  Is this a powerful movement that is starting?  The first one to do something is the crazy nut job, especially if no one joins in.  It is the first followers though that form the bridge, that show the crowd how to follow, that make it less scary, more normal, more fun.  Before too many years go by, the non-cord cutters will be on the outside.  That is my prediction.  On line, on demand streaming and the various evolution of this new form of entertainment will soon rule the entertainment industry and our lives.

What about the internet connection

Yeah, that’s a small detail.  You can’t really stream your content without a high speed internet connection.  So maybe as time goes on, our money will shift more to the bandwidth providers, and away from the content aggregators?  Don’t ask me how much I pay per month on my internet bill!  That’s one cord I can’t see myself cutting for a long time.

Somehow I imagine that the total cost for our entertainment and communication needs won’t change all that much in the long run, but hopefully we small consumers will have more choice and control to direct our spending on exactly what we need and want.

Adventures in Aerial Image Stitching

A small UAV + a camera = aerial pictures.

SAM_0079

SAM_0057

SAM_0053

This is pretty cool just by itself.  The above images are downsampled, but at full resolution you can pick out some pretty nice details.  (Click on the following image to see the full/raw pixel resolution of the area.)

SAM_0057-detail

The next logical step of course is to stitch all these individual images together into a larger map.  The questions are: What software is available to do image stitching?  How well does it work?  Are there free options?  Do I need to explore developing my own software tool set?

Expectations

Various aerial imaging sites have set the bar at near visual perfection.  When we look at google maps (for example), the edges of runways and roads are exactly straight, and it is almost impossible to find any visible seam or anomaly in their data set.  However, it is well known that google imagery can be several meters off from it’s true position, especially away from well travelled areas.  Also, their imagery can be a bit dated and is lower resolution than we can achieve with our own cameras … these are the reasons we might want to fly a camera and get more detailed, more current , and perhaps more accurately placed imagery.

Goals

Of course the first goal is to meet our expectations. :-)  I am very adverse to grueling manual stitching processes, so the second goal is to develop a highly automated process with minimal manual intervention needed.  A third goal is to be able to present the data in a way that is useful and manageable to the end user.

Attempt #1: Hugin

Hugin is a free/open-source image stitching tool.  It appears to be well developed, very capable, and supports a wide variety of stitching and projection modes.  At it’s core it uses SIFT to identify features and create a set of keypoints.  It then builds a KD tree and uses fastest nearest neighbor to find matching features between image pairs.  This is pretty state of the art stuff as far as my investigation into this field has shown.

Unfortunately I could not find a way to make hugin deal with a set of pictures taken mostly straight down and from a moving camera position.  Hugin seems to be optimized for personal panormas … the sort of pictures you would take from the top of a mountain when just one shot can’t capture the full vista.  Stitching aerial images together involves a moving camera vantage point and this seems to confuse all of hugin’s built in assumptions.

I couldn’t find a way to coax hugin into doing the task.  If you know how to make this work with hugin, please let me know!  Send me an email or comment at the bottom of this post!

Attempt #2: flightriot.com + Visual SFM + CMPMVS

Someone suggested I checkout flightriot.com.  This looks like a great resource and they have outlined a processing path using a number of free or open-source tools.

Unfortunately I came up short with this tool path as well.  From the pictures and docs I could find on these software packages, it appears that the primary goal of this site (and referenced software packages) is to create a 3d surface model from the aerial pictures.  This is a really cool thing to see when it works, but it’s not the direction I am going with my work.   I’m more interested in building top down maps.

Am I missing something here?  Can this software be used to stitch photos together into larger seamless aerial maps?  Please let me know!

Attempt #3: Microsoft ICE (Image Composite Editor)

Ok, now we are getting somewhere.  MS ICE is a slick program.  It’s highly automated to the point of not even offering much ability for user intervention.  You simply throw a pile of pictures at it, and it finds keypoint matches, and tries to stitch a panorama together for you.  It’s easy to use, and does some nice work.  However, it does not take any geo information into consideration.  As it fits images together you can see evidence of progressively increased scale and orientation distortion.  It has trouble getting all the edges to line up just right, and occasionally it fits an image into a completely wrong spot.  But it does feather the edges of the seams so the final result has a nice look to it.  Here is an example.  (Click the image for a larger version.)

SAM_0125_stitch

The result is rotated about 180 degrees off, and the scale at the top is grossly exaggerated compared to the scale at the bottom of the image.  If you look closely, it has a lot of trouble matching up the straight line edges in the image.  So ICE does a commendable job for what I’ve given it, but I’m still way short of my goal.

Here is another image set stitched with ICE.  You can see it does a better job avoiding progressive scaling errors on this set.  However, linear features still are crooked, there are many visual discontinuities, and it one spot it has completely bungled the fit and inserted a fragment completely wrong.  So it still falls pretty short of my goal of making a perfectly scaled, positioned, and seamless map that would be useful for science.

SAM_0372_stitch-reduced

Attempt #4: Write my own stitching software

How hard could it be … ? ;-)

  1. Find the features/keypoints in all the images.
  2. Compute a descriptor for each keypoint.
  3. Match keypoint descriptors between all possible pairs of images.
  4. Filter out bad matches.
  5. Transform each image so that it’s keypoint position matches exactly (maybe closely? maybe roughly on the same planet as ….?) that same keypoint as it is found in all other matching images.

I do have an advantage I haven’t mentioned until now:  I have pretty accurate knowledge of where the camera was when the image was taken, including the roll, pitch, and yaw (“true” heading).  I am running a 15-state kalman filter that estimates attitude from the gps + inertials.  Thus it converges to “true” heading, not magnetic heading, not ground track, but true orientation.  Knowing true heading is critically important for accurately projecting images into map space.

The following image shows the OpenCV “ORB” feature detector in action along with the feature matching between two images.

feature-pairs

Compare the following fit to the first ICE fit above.  You can see a myriad of tiny discrepancies.  I’ve made no attempt to feather the edges of the seams, and in fact I’m drawing every image in the data set using partial translucency.   But this fit does a pretty good job at preserving overall all geographically correct scale, position, and orientation of all the individual images.

fit1

Here is a second data set taken of the same area.  This corresponds to the second ICE picture above.  Hopefully you can see that straight line edges, orientations, and scaling is better preserved.

fit2

Perhaps you might also notice that because my own software tool set understands the camera location when the image is taken, the projection of the image into map space is more accurately warped (none of the images have straight edge lines.)

Do you have any thoughts, ideas, or suggestions?

This is my first adventure with image stitching and feature matching.  I am not pretending to be an expert here.  The purpose of this post is to hopefully get some feedback from people who have been down this road before and perhaps found a better or different path through.  I’m sure I’ve missed some good tools, and good ideas that would improve the final result.  I would love to hear your comments and suggestions and experiences.  Can I make one of these data sets available to experiment with?

To be continued….

Expect updates, edits, and additions to this posting as I continue to chew on this subject matter.

Smart Trainer Photo Shoot

Design Observations

I really like the looks of this aircraft.  It is a unique combination of design choices that I think should provide a nice balance of good flying qualities and lots of aerobatic capability.

It calls itself a trainer, but it is not a “learn to fly” trainer.  Instead it positions itself as an entry level pattern ship.  It is light weight which means it should maneuver effortlessly and not have bad habits.  It has long lines so it should fly like it is on rails.  It has thickened wing tips so it should have excellent slow speed characteristics and be adverse to tip stalling.  Oh, and it also has all the design elements you’d want for effortless knife edge and inverted flight.  The aircraft has a semi-symmetrical airfoil.  Most aerobatic planes pick a fully symmetrical airfoil, but in my opinion, across the flight regime that this aircraft covers, the choice of airfoil shouldn’t make much difference.

While I am grounded and waiting for the snow to melt around here I took a couple pictures:

IMG_20140312_142930 IMG_20140312_142902 IMG_20140312_142834 IMG_20140312_142844

I am hoping this will be a fun airplane to go out and cut up the sky with classic pattern style aerobatics.

 

Aerosky 185 Photo Shoot

 

Photo Shoot

Don’t look too closely, but take a few steps back and I think she looks pretty nice.  I love the older style 185 tail and the tail dragger configuration.  The relatively large wheels help me imaging this is a bush plane intended to get in an out of rough strips.

IMG_20140312_181204

It is still winter here in MN and our ground is still covered in a foot of snow at least.  I’m hoping the snow melts quickly so I can get out and maiden this airplane soon!

IMG_20140312_181233

Yup, she looks pretty sweet I’d say!

IMG_20140312_181146

Aerosky 185 Build Notes

I was interested in the Aerosky Sky Trainer 185 because it looks a lot like a Cessna 185.  It has the 185 tail and is setup as a taildragger.  Technically the rear window is not correct for a 185, but there are a lot of things you could nitpick if you really wanted to go there.   The other interesting aspect of this kit is that it includes a full set of float for water operations.  I live near a little lake so I am hoping this will fly well off water on a nice calm summer evening.

IMG_20140310_193715

In this post I simply want to hit the questions/issues I ran into with this aircraft.

Rear Fuselage Extension and Tail Surfaces

First off, the instructions say “glue” on the rear fuselage extension piece.  I don’t hae a tip for getting this exactly lined up.  I lined up the stickers exactly, but that put the horizontal stab out of alignment with the wing.  Use a bit of caution and planning and measurement here.  Maybe consider installing the wing first so you can align the tail with it.

The instructions do not say glue on the horizontal & vertical stabs, but they provide no bolts/washer so I assumed the only way to install them was with glue.   That is fine, but the instructions seemed to imply something else.  Again, I recommend bolting the wing on before gluing the tail surfaces so you can try as much as possible to align the horizontal stabilizer with the wing.

Now my biggest frustration so far is with the wing hold down bolts. Only one actually lines up well enough to get it threaded easily. I messed around quite a bit and I think I can get 2 more lined up, but the fourth is just really off kilter or something.  The bolt tries to cross thread on the blind nut whenever I start it … frustrating!!!
IMG_20140311_103721

 Wing Mounting

I did manage to get the wing bolted on ok. The factory installed blind nuts did not line up well which made this a huge pain.  I just had to fiddle with it long enough I guess. I managed to push out one blind nut in the process of try to get the bolt started which was a setback to the process.  It took quite a while to get the bolt reseated, but I managed to get it all together in the end.

Power System

I’m not impressed with the quality of the 3-bladed prop … looks like cheap molded plastic. Anyone know the pitch on this so I can replace it with something decent?

I’m also not impressed with the glue on foam spinner.  The instructions have you glue it on, and it takes quite a bit of fiddling to get it centered so it doesn’t wobble terribly when it spins. That’s another thing I’d love to replace eventually if I keep and fly this airplane regularly.

Pro-tip: Don’t glue on the spinner until after you’ve hooked up the ESC to the motor and have all your wiring tested and tucked away.

IMG_20140311_124211

Landing Gear

The landing gear and control linkage installation has been straightforward … no major gripes there.   In the online videos I didn’t like how nose down the aircraft sits on it’s floats.  I noticed the extra gear provided with the floats is a bit taller than the main gear to account for the fuselage being a bit more slender as you go rearward.  I swapped these and used the bigger part for the front in hopes that this will help the aircraft sit a bit more nose up (scale-like) on the floats when I finally attach them.

I think this airplane will be ok. It’s not high on the quality or fit & finish scale, but it was relatively cheap and on clearance.  I think it will look good in the air and from a few feet away. Just don’t get out the microscope or start nitpicking too much.

Build Your Own PC (2014 Edition)

The World is Constantly Changing

The last time I built up my own PC was March, 2011 – going on 3 years ago.  The basic idea of building your PC and the basic skill set required are still pretty much the same, but a couple new things caught me off guard.  Because I only do this every 2-3 years, I don’t keep track of trends and buzzwords and product nicknames, so plowing my way through this is a bit of a (fun) adventure each time!

Basic Skills Required

S2-Shank-Screwdriver

  • For me, the most important requirement is necessity.  I typically am interested in specific things.  I’ve wasted too much of my life struggling to make cheap PC junk work reliably.  Just about every time I’ve bought off the shelf systems, they’ve been a disappointment and a struggle.  But on the flip side, I don’t want to spend too much to get the features I need.
  • You need to be able to operate a phillips screw driver.
  • You need to be able to match up cables and get them plugged in correctly.  Almost always they are keyed and labelled so there is only one possible way to connect them. This amounts to plugging the round peg into the round hole, and the square peg into the square hole, and not mixing those up (at least not very often.)  You don’t need a sledgehammer if something isn’t going together. Backup and take another look at what you are doing. :-)

Mini-ITX Motherboard

msi-a75ia-e53

One thing I discovered this time around is the mini-ITX motherboard.  This is smaller than a traditional motherboard, but has a ton of stuff packed into a small area.  I was planning to build a simple file server and was hoping for a smaller footprint in my office, so I rolled the dice and chose this style motherboard.  Here are a few comments:

  • I bought the AMD FM2 socket version, and as far as I can tell it accepts any FM2 processor.  What’s FM2?  I have no idea, but typically you want the motherboard socket and the CPU socket to match.  That’s something important to keep in mind when shopping for parts.
  • The MSI A75IA-E53 motherboard I chose only offers 2 memory slots and 1 PCI expansion slot.  But what it does include onboard is most everything you’d want already: gigabit ethernet, wifi (surprise!), bluetooth (surprise!), usb-3.0, analog and hdmi video out, plus several other plugin ports that I don’t immediately recognize.  So far so good.
  • Installing the CPU and RAM is the same as it’s always been done, no surprises there.
  • Installing the Motherboard in the case is also pretty much the same: screw it down, find where all the power/connectors plug in and plug them in, and you are good to go (hopefully!)

AMD CPU/Motherboard Integrated Graphics

amd-cpu

Here is the one thing that did catch me off guard.  The motherboard I chose has analog and hdmi video output.  However, I eventually discovered that this only works if you install an AMD CPU that has integrated video support.  I have never seen this before, and it seems to be something relatively new, or at least introduced since I built my last PC a couple years ago.

I chose a CPU without integrated graphics and spent half a day trying to figure out why my new system seemed dead on arrival.  Eventually I dug up an old PCI video card out of the bottom of a box of spare parts, installed that in the one available expansion slot, and “ta da!” I could see the motherboard booting up and running its power on stuff.  (This motherboard doesn’t beep on boot, I was expecting beeps and not getting them, but it turned out to be normal, not an indication of a problem)  So, excellent, everything is working as it is designed!

I am planning to use this machine as a simple server (backup server, nfs server, disc burning server.)  I don’t plan to play games on it, so graphics is not a big issue, and I was very relieved to have my system up and running correctly — running with a “discrete graphics card” installed which is the new terminology apparently.

The Case

pc-q08r

Along with a new (new to me) motherboard form factor comes a new case style designed to fit the mini-ITX motherboards.  When you shop online and don’t know exactly what you are doing, occasionally you get stuck making guesses and hope that it will work out!  I was hoping for something smaller than a mid-tower case, which was my whole intent when I selected the mini-itx MB.  I chose a case listed as a “mini-tower” and designed specifically for mini-itx MB’s.  I also wanted one external 5 1/4″ bay so I could install a dvd/blu-ray burner.

What I received was much bigger than I was expecting.  It is still shorter than a mid-tower case, but actually a bit wider, and uses a standard ATX power supply.  So the downside is that the case isn’t as small as I was hoping, but the upside is that I get a system that is flexible, expandable, and upgradeable.  That said, after stuffing in all the stuff, it is still a pretty cozy fit.  There is still lots of space for add on hard drives, but everything in between is quickly packed full of cables.

Two additional things about this case I think are cool:

  • The power button and the power LED are integrated, so the button you press to turn on the computer also lights up.  That’s pretty fancy for this guy.
  • The reset button also doubles as the hard drive activity LED.  It’s a nice, clean, sharp looking case!

To Bling or Not to Bling

I have never been interested in case bling.  I don’t need to be blinded by my case.  I don’t want my case to be visible from outer space.  Give me a small power led and a small hard drive activity light and I’m happy.  Oh, and I don’t need my case to look like a Star Trek prop, basic rectangles are fine.

The case I chose came with a 12″ front fan that is illuminated with blue LED’s.  Normally it wouldn’t be something I’d pick, but I ended up with it and I think it’s pretty cool … at least it doesn’t blink or flash or change colors.

Peace and Quiet!

Another big consideration when spec’ing and building a system is fan noise.  In the past, I have put together systems that literally sounded like jet engines on an aircraft carrier deck.  Often PC fans adapt and speed up/slow down as the CPU heats up or cools down.  But combine this with a noisy fan and the end result can quickly drive a person insane.  How do you avoid noise?

  • One thing that people use is water cooling.  This can create a system that is virtually silent.  I’ve never setup a water cooled system before … it looks complex, and some of the parts get a bit pricey.
  • Use bigger fans that spin more slowly.  This is really the key point.  The case I chose has a 12″ front fan.  Bigger fans move the same amount of air at a slower RPM and are generally quieter.  Often the cheap/stock fans are small and have to spin at a high RPM.
  • After market CPU coolers.  The same bigger-fan-size principle can work for CPU cooling as well.  In this system that I just built, the stock CPU fan seems to be pretty quiet, so I’ll most likely just stick with it.  But if you find your CPU fan sounds more like a hyperactive F-16, there are a number of aftermarket cooling systems that have much larger heat syncs, and bigger/slower fans.  Just make sure you have enough case clearance for the cooler you pick.  Some of the bigger/nicer heat sync/fan coolers won’t fit in a smaller case.

Loading an Operating System

When you build a system from scratch, typically it doesn’t come with a pre-installed operating system.  That is left up to you.

I’m a long time Linux enthusiast so I loaded Fedora 20 (the current release) on this system.  Linux offers packages like “BackupPC” which can backup all my  other systems on a regular schedule.   I can also easily do NFS file sharing, blu-ray/dvd burning, web serving, and a host of other useful tasks with this system.

For everyday uses, Linux offers Chrome and Firefox, so as our lives increasingly exist “in the cloud”, and more and more our interface is through our phone, tablet, or web browser; I think Linux is becoming more and more of a good option for ordinary computer users.

  1. It is free (no microsoft tax on your new computer.)
  2. It is every bit as easy to install as windows or osx
  3. It offers many of the same capabilities as other systems for most things people want to do.  We all have our preferences, but these days it’s becoming more and more difficult to practice “OS advocacy” on the basis of capability or available software.
  4. These days with Windows 8 still being so new,  Linux often supports more hardware and devices out of the box than your other options.

Wisconsin Dells

dellsriver

A popular tourist destination going back to at least 1856.  From Wikipedia: the Dells of the Wisconsin River, a scenic, glacially formed gorge that features striking sandstone formations along the banks of the Wisconsin River.

Today the Wisconsin Dells is a regional summer hotspot for water parks and other attractions, not to mention timeshare salespersons.

We just spent 4 days in the dells and never having been there before, stumbled on some things that were wonderful and a few things that were real stinkers.

Recommended:

Restaurant: Carvelli’s Pizza and Pasta House

carvellissalad

We went to Carvelli’s on our last night and were blown away.  We had a late lunch and were trying to do a quick dinner before the magic show in town, so Carvelli’s was an afterthought for us.  Big mistake!  Both my wife and my daughter thought it was the best italian food they’d ever tasted!  I ordered a simple spaghetti and meatballs, and have to say that was the fanciest and tastiest spaghetti I’d ever had.  I’m an applebees and olive garden regular, so I just wasn’t used to seeing green bits with extra flavor mixed in with my noodles.  There was just something about the food and you could tell the chef had poured his heart and soul into it.  There was some extra love, extra attention to detail, extra energy that showed through in the result.  The desert was somewhere on the continuum between heaven and perfection.

 

carvellis

My wife was so enamored with her dish that she asked our server if we could meet the chef and if not to at least pass on our highest compliments.  Sure enough, right at the end of our meal the chef came out to say greet us, and he was just a young kid!  It turns out he was not italian but was from Peru and had studied culinary arts in Lima.  Even though I’m a white guy, I was born in Peru myself so that was kind of a cool connection.  All I can say is Roberto, you rock, your italian speaks for itself!  I hope you are there next time we visit, and if not I know you’ll be a tremendous success anywhere you choose to go!

Restaurant: San Antonio

sanantonio

San Antonio’s is traditional Mexican restaurante located towards the far western end of the main broadway strip in the Dells.  Honestly, we just stumbled in on a whim.  We were walking the broadway strip, half thinking we should get something to eat, and half thinking maybe we’d just get french fries or ice cream or fudge or something, half thinking we were too tired to decide on anything and might just hit the McDonalds drive through on the way back to the hotel.  But we got all the way to the end of the broadway strip and really didn’t see anything that captured all four of us, so there was this Mexican restaraunte 2 doors up the side street next to the ‘torture museum’ and we figured for lack of anything better we’d at least look at their menu.

We really were pleasantly surprised.  Their prices were extremely reasonable and not seasonally adjusted like so many places in the summer time at the dells.  The service was very good.  And the food was way above average.  The restaurante was also very open and clean and looked like it was recently remodeled.  Next time we are at the dells, we’ll definitely make time to visit San Antonio again.

Restaurant: Cheesecake Heaven

Ok, they do sell cheesecake, and it does look wonderful, but we didn’t try any of that.  Instead we went for the ice cream.  It had to have been made in house because I’ve never seen those exact collections before any other place.  This is probably the best, or at least on par with the best ice cream I’ve ever had.  I’m not exactly an ice cream expert, but I have eaten a lot of ice cream over the years.  If there is some concept of ‘balance’ in ice cream in terms of heaviness/lightness, consistency, flavor combinations, quality ingredients, etc. they just nailed every specific criteria you could come up with.  If you just close your eyes and take the whole thing in, they nailed it.  Boom!  If you like ice cream, go here.  If you skip this place, then you deserve your own dismal fate.  What else can I say, it’s that good!

Restaurant: Moose Jaw

This was a fun place with good atmosphere and good food.  It had a polished, chain sort of feel, but I think it was just a really well run establishment.  A good solid choice.

Entertainment: Rick Wilcox Magic Show

rickwilcox

Wow, fun, real top notch magic and illusion like you might get from David Copperfield, or Pen & Teller, or Lance Burton in Vegas.  Rick and his wife put on a really great show.  Our kids had never seen anything remotely like this and were blown away.  Along with being a really great magic show, it was a rated “G” for the kids.  They had lots of variety, lots of humor, lots of classic styles of illusions, and all really well performed.  I’m really glad we went, even though it was our last night and we were tired and pressed for time.  It ended up being one of the top highlights of our trip.

Entertainment: The Original Ducks

ducks

This was our first time at the dells, but the one thing we knew going into this trip is we had to do the ducks.  A duck is a vintage WW-II amphibious vehicle.  It has a noisy diesel engine, 6 wheels, and a propellor and rudder.  They can drive right in and out of open water.  In the water they are a boat, on land they are a bus.  They can do maybe 50 mph on land and maybe 10 mph in the water.  The ducks ride was probably about an hour with a college age driver guide who gave some history of the area, told some outright bologna, and cracked more than a few jokes and cheesy puns along the way.  It was actually a pretty fun time and worth doing if you are ever in the dells.  They take you through the woods and out onto the wisconsin river.  Then up a stream, back through some woods, out on a lake, etc.  This might be one attraction that would be especially pretty during the fall when the leaves are turning colors.

Entertainment: Mount Olympus Theme and Water Park

mountolympus

It turns out this is the world head quarters for wood roller coasters and go carts.  That’s about all the non-water stuff they have, but they have at least 4 high intensity roller coasters (Pegasus, Cyclops, Zeus, and Hades 360 which goes underground and loops and was too crazy for my girls to want to attempt) and at least 4 crazy go-cart tracks.  They also have a huge area of indoor and outdoor waterpark type attractions.  The one my girls really liked was the wave pool which was crazy.  After I got kicked in the head and my suit kept coming off with each wave, I decided I was done, but my girls wanted to stay in there the whole day.  The downside to Mt. Olympus was it was big and crazy and a ton of people.  You get unlimited ride wristbands which means there was 30-60 minute waits for anything interesting.

Entertainment: Chula Vista Water Park

Much smaller and more low key than Mt. Olympus, they still had 4 pretty intense water slides.  You could spend a day here easily and the lines are nothing compared to Mt. Olympus.  The downside: their snack shop was horrible.  Gas station hot dogs are a big step up from what they were offering.   Chicken strip baskets just sitting out and attracting flies all day?  $6 for an 8 oz plastic cup of warm bud light?  No thanks!  What little nourishment I do have in my stomach I would like to keep there!

Take Your Chances:

Restaurant: House of Embers

I hate being negative. :-(  They did have a lovely out door seating area with tons of flowers and hanging baskets and we went on the perfect evening for sitting outside.  But the first thing they brought us was a basket of wrapped up butter cubes (I’m not sure what for since they didn’t bring us any bread) and one of the butter cubes had a used piece of chewing gum stuck to it.  Gross!  We were willing to forgive one innocent error, but then the food came and my chicken sandwich was poor at best and my daughter’s hamburger was not cooked through properly and honestly, the food was just gross.  And this is a place that charges ‘fine dining’ prices.  The prices seem fairly arrogant after you see the food.  Maybe they had a bad night?  Maybe the pilots ate the fish and the flight attendants were trying to land the plane?  I don’t know.  There’s an applebees in town which is twice the food for half the price so surely House of Embers will never see us again. (Stop calling me Shirly.)

Timeshare: Bluegreen

Think you are getting an awesome free vacation in return for sitting through a 90 minute presentation and a quick tour of a couple timeshare properties?  Well … (1) I’ll never get those 4 hours of my life back and neither will our sales guy, (2) the hotel we got for ‘free’ was “meh” at best, (3) you still have to pay your transportation, food, entertainment, etc. and all that adds up really quick.  Oh, and the timeshare sales guys are really good at what they do.  In the heat of the moment it sure seems like a great deal and the longer you hold out, the more they sweeten the deal.  But search for timeshares on craigslist for example.  There is more than one big company offering these plans and there are people willing to all but give theirs away just to get out of the monthly/yearly maintenance fees and dues.  Does that tell you something?  My take: maybe if you are an avid ‘pure’ vacationer and are really good at structuring your life around your timeshare plan and disciplined to get just the good deals and only the good deals a timeshare can work for you.  But if you are that structured and disciplined, why are you signing up for a $10,000 plan at 17% interest over 10 years on a 90 minute whim because you can’t tell a slick sales dude a simple “no”?  If it’s a good deal, shouldn’t you be able to go away and think about it and confirm to yourself that it’s a good deal?  Why do you need to sign right now today or lose all your ‘incentives’?  Do it!  Sign it! Now! Now! Now!

Meh…

Hotel: Skyline Hotel & Suites

drapes

I don’t really have too much negative to say.  I don’t have a lot positive to say either.  The hotel is what it is I guess.  I’ve stayed in a lot nicer for a lot less money, but this is the Dells in their prime summer months so probably the price was fair enough for what they offered.  The best thing I can say about the hotel is that it was right in the middle of the action: next door to the ‘Original Ducks’, right across the street (walking distance) from Mount Olympus (wood roller coaster & go-cart & waterpark heaven.)  Everything else about the hotel was just a bit underwhelming, not quite making average marks.  The wifi was slow and often sketchy, the breakfast was meh at best (other than the waffles you cook yourself), the coffee was actually undrinkable.  But hey, you don’t go to the Dells to hang out in your hotel room, and there’s a starbucks if you drive into town so no worries!

Todo Next Visit:

Entertainment: Top Secret

topsecret

So you come up the hill and at the top is this crazy structure that doesn’t make any sense.  As you look closer it looks kind of familiar, but you can’t quite place it.  Then it hits you … it’s the White House, but ripped off it’s foundation and dropped upside down … full size … with a crushed presidential limo at one corner and a dinosaur head breaking out one wall.  It’s one of those things where you ask yourself if it might just be worth checking out?

As with just about any place, there is far too much to do in one visit.  Next time we’ll definitely try to find a hotel that’s a step above what we had this time.  Mount Olympus is an impressive park, but next time we’ll probably try out one of the other water/theme parks.  Next time maybe we’ll try going back in one of the winter months and focus on indoor stuff … hopefully to find saner hotel/food prices and maybe a slower pace than you get during the crazy busy summer months.

If you have some ideas to suggest for the Dells; something we missed or didn’t notice; please let me know!

BackupPC, LVM, Cloning and Resizing Drives

I recently went through the process of trying to move my entire 1.5 Tb BackupPC tree to a new drive.  Here are some thoughts and comments from that experience.

  • I spent 40 days (literally) attempting to get various combinations of rsync, tar, cp, etc. to clone the contents of the drives to a new larger drive.  However, the bazillion of small little files hard-linked to a pool of randomly named actual files made this practically impossible to do in a finite amount of time.
  • In the end I used the unix utility ‘dd’ for the fastest possible copying.
  • In order to clone to a larger drive I first ran resize2fs to make the target file system match the size of the source file system.  Then I could do a direct dd copy of the source disk, and finally I resized the file system up to consume the full physical space after the clone was complete.
  • Make sure to add “conv=noerror,sync” to your “dd” options to avoid your transfer dying if it hits a bad-block on the source disk (perhaps a dying drive is among the reasons you are transferring to a new drive?)

Reasons to clone your backuppc drive (or any drive)

  • Your data is beginning to outgrow your available space.
  • The drive is starting to fail (showing smart sector errors, read errors, etc.)
  • Backup/redundancy
  • Prepare a copy of your data for offsite storage (extra safety for your important data, like your life long collection of digital photos …)

Cloning a BackupPC storage tree (or any other file system structure that is too big/complex for rsync/tar/cp to handle efficiently)

  1. Physically attach the destination drive and create physical and logical volumes. “system-config-lvm” is a gui tool that can help do this, otherwise there is the myriad of “pv…” and “lv…” command line tools if you wish to go that route.
  2. Make (or resize) the destination logical volume so its size matches as closely as possible the size of the source volume. I wasn’t able to get it exact, but I forged ahead anyway and it appears that e2fsck and resize2fs were able to get it all sorted out properly after the fact.  Perhaps making your target volume just slightly larger would be safer than making it slightly smaller.
  3. Make sure the dest volume is not mounted! If you have the option, also unmount the source volume. This isn’t absolutely required, but will avoid the risk of copying a drive in an inconsistent state which could lead to some loss of files or data that are being written at the time of the dd.
  4. Run “dd if=/dev/mapper/source_lv of=/dev/mapper/dest_lv bs=100M conv=noerror,sync”  I can’t say what the optimal block size (bs=xxx) value is. Make that too small and you waste time making endless trips back and forth from one drive to the other. Make it too big and you might get into swap. There may be a specific value that runs faster with your hardware than some other value and that might be non-intuitive?
  5. “dd” has no output unless there is an error and on a 1 TB drive or larger this can literally run for many hours. You can find the pid of the dd process and run “kill -USR1 <pid>” and that will signal dd to dump out a status message of how much it has copied so far. With a few brain cells you can figure out how many total blocks there are to copy (at your specified block size) and get an rough estimate of when the copy will finish.
  6. After the “dd” command completes, run “e2fsck -f -y /dev/mapper/dest_lv”. If you were dd’ing a live drive, or if the source drive had some bad/unreadable blocks, or you couldn’t make a destination volume of the exact size of the original, or … This will (or should) bring the destination volume into full consistency with itself.  The end result is pretty much the best possible copy you can get from your source drive.
  7. Now the beautiful part: either by system-config-lvm or with a cli tool like “lvextend” you can now resize your logical volume to fill up the entire available physical space. system-config-lvm will run e2fsck (again) and resize2fs in the background so it may take some time.
  8. The gui tools makes things a bit ‘easier’ but they are silent in their output so you don’t know what’s going on or how long your operation may take (seconds? hours? days?) The command line tools output useful information and can run in ‘verbose’ mode so it may be worth it to pull up the man pages on them and run them directly depending on your level of interest and time available.

BackupPC specifics

  • I mount /dev/mapper/logical_volume someplace like /backuppc03 and then I make /var/lib/BackupPC a symbolic link to “/backuppc03/BackupPC”.  So update this link to point to the dest drive, restart BackupPC and you should be fully up and running on the dest drive … now hopefully with more space and a new error free drive.
  • Hopefully if there were some drive read errors, they are few and come at non-critical locations … hopefully only corrupting some random unimportant file in some random unimportant backup that you will never need to restore.
  • If the drive is too shot and your previous backups too corrupted after the copy process, you may be better off just starting from scratch with a brand new backuppc installation and begin accumulating your backup history from this point forward.
  • One more tip. Gnome (and probably other desktops) have software that can show you your hard drive’s ‘smart’ status. In gnome this tool is called “Disks”. If the drive isn’t showing any smart status, you may wish to double check your bios settings (it’s possible to turn off smart in bios.) It’s good to look at your drive status once in a while to make sure it’s not starting to accumulate bad sectors.
  • The drive I just cloned and replaced was up to 283 bad sectors with about 6 bad block unrecoverable read errors. It was running at about 45C which is pretty hot.

Spiraling Under Control

One of the staples of fixed wing autopilots is the circle hold.  A circle hold is the closest thing you can get to a pause button with a vehicle that must be in constant forward motion to stay aloft.  There are a few hidden challenges in the task, including wind compensation and some unexpected coupling that can lead to weird looking oscillations if not handled well.  People have been doing circle holds with UAV’s for a long long time, so I don’t bring anything new to the table, but it is always fun to play, err I mean experiment.

Circles

What happens if you periodically move the center of your circle (maybe every 5 mintues) to a new location, hold for a while, move the circle center again, circle for a while, and repeat?  Well short answer is you end up with a bunch of circles, but if you are strategic in the placement of the circle center, some pretty patterns can begin to emerge.  To add visual interest we can also change the circle speed when we move the center of the circle.  Increasing the circling speed, increases the circle radius.

fgfs-screen-001

What if each time we move the circle center point, we move it by a fixed angle (let’s try 30 degrees), and increase the offset distance by a little bit, and also in crease the airspeed by a 1 kt?  An interesting spiral pattern begins to emerge.  From the original starting point, each circle is a bit bigger than the one before, and also a bit further away.  A spiral pattern begins to emerge.

fgfs-screen-002

A flight simulator isn’t encumbered by battery or fuel limitations, so what happens if we let this run for a long time?  The spiral pattern continues to develop and grow.fgfs-screen-003

Spirals aren’t that big of a deal of course.  20 minutes of python coding could produce some far fancier spirals.  What interests me is how the patterns are produced … this is the flight track of a simulated UAV and that makes it a bit more challenging and fun.

Continuous Spirals

What happens if we fly a basic circle hold, but instead of changing the circle center point every 5 minutes, we continually move the center target of the circle in sweeping spiral pattern?  We would get something that looks a bit like a stretched spring viewed from a bit of an angle.

At the beginning of the pattern, the airspeed is set to 25 kts.  The radius (not of the circle hold but of the spiral) is set to 0.1 nm.   Each second the position is swept forward 0.125 degrees.  This means the spiral pattern sweeps forward 7.5 degrees per minute, or 450 degrees per hour.  The airspeed and spiral radius are also increased by a tiny bit each second.  The next picture shows the pattern after a bit more than an hour of flight.

fgfs-screen-004

After about 5 hours of flight we get the next picture:

fgfs-screen-006

And if we let the simulation run over night and zoom out the map a couple steps, we get:

fgfs-screen-007

A Few More Details

All these patterns were produced by the flight track of a UAV.  That means we aren’t just plotting mathematical functions, but instead are combatting wind and physics to produce these patterns.  A complex system of sensors, attitude estimation, control theory, navigation and planning blends together to produce the end result.

Simulation vs. Reality

All of this was flown in the FlightGear.org flight simulator.  However, there is a much stronger tie to reality than might first appear.  FlightGear is the ‘stand in’ for reality.  However all the sensor data is sent externally to the “avior” autopilot running in “software in the loop” testing mode.  The avior autopilot code sends all the raw sensor information (simulated IMU and simulated GPS) into a 15 state kalman filter to estimate the actual roll, pitch, and yaw.  It would be possible to cheat and use the simulators exact roll, pitch, and yaw, but the “avior” can’t cheat in real life (because this information isn’t directly available) so it faithfully estimates these values in simulation just like it must in the real aircraft.

The roll, pitch, & yaw estimates are then passed to flight control system and compared with target values for basic flight control and navigation.  The “avior” autopilot computes control surface deflections to eliminate the error between target speed, and attitude vs. actual speed and attitude.

Finally, these control surface positions are sent back to FlightGear which then computes the flight physics based on where the avior moves the control surfaces and throttle.  FlightGear computes new gyro, accelerometer, and gps sensor values, sends them to the avior autopilot, and the process repeats.

In this way we can test the “avior” autopilot quite thoroughly using the simulation.  The avior thinks it’s really flying, it receives realistic sensor data, drives control surfaces as if they were real servos, and the simulator responds realistically.  Really the only part of the avior not being thoroughly exercised is the specific code that reads the real world sensors and the specific code that drives the real world servos.

Wind

At first glance, the job of flying a circle hold around a fixed center point amounts to holding a fixed bank angle.  There is a relationship between airspeed, bank angle, and turning radius, so we just need to work out these numbers and we can fly any circle of any radius at any speed, simply by computing the required bank angle.

But things get a bit more complicated than this because we need to adjust our actual heading and bank angle to compensate for drifting inside or outside the target circle radius.  And there is this whole business of figuring out how to smoothly enter the circle pattern from any starting position and heading inside or outside the circle.

I’ll skip over the boring details (ask if you are curious) but along with all the other things that must be accounted for, the real world almost always has a little (or a lot) of wind.  Flying up wind, small heading changes of the aircraft can yield large changes in your ground track heading.  Imagine a worst case scenario where you are flying at 30 kts, exactly into a 30 kt head wind.  You are hoving relative to the ground.  But even the tiniest heading change (or wind change) will slide you 90 degrees left or right.  The opposite happens when you are flying downwind.  Aircraft heading changes produce proportionally smaller ground track heading changes.

Wind adds some unique challenges to flying circle holds that are actual circles from a ground perspective.

Coupling

I also wanted to say some brief words about coupling between axis, because it can be a bigger issue in circle holds than might first be expected.  Imagine you are flying a perfect circle hold in zero wind.  You are at a 30 degree bank, at your target airspeed, and at your target radius.  Now imagine you are a bit outside of the target radius.  You need to bank a bit more to tighten your turning radius.  But this tighter bank could cause a loss of altitude (basic airplane physics).  If the aircraft responds to the lost altitude with increased elevator, this will tighten your turn even more because you are banked.  It is easy to over shoot and end up inside the circle, which means the flight controller will command the aircraft to fly less of a bank, increasing the circle radius, but that creates more lift, more climb, etc.  Roll, pitch, and throttle can combine in some very awkward ways during a circle hold and that, along with wind and all the other aspects of basic aerodynamics and physics can make flying an accurate and stable circle hold a bit more of a challenge than you might first expect.

External Scripting

Hah, if you are still reading all the way down here, you are really a UAV geek (or you are following good skimming rules of reading the first paragraph, the last paragraph, and looking at the pictures.)

One of the fun things about the avior autopilot is that all the sensor data, attitude estimations, control surface positions, navigation state, and just about every other interesting variable is published in a giant hierarchical tree of name/value pairs.  If you’ve poked inside the windows registery, it’s kind of the same basic idea, except all in memory and very fast to access or update.

The cool thing about this is that we can expose external interfaces to this giant data structure and completely command or monitor the autopilot externally.  This enables a developer to write a perl or python script to monitor and command the autopilot.  What sorts of things could such a script do?

  • Command the autopilot to do a circle hold, then smoothly adjust the center point of the circle hold to produce interesting patterns in the UAV flight track.  That’s what this whole article is about.
  • Fly specific flight test maneuvers repeatably and accurately.  Do you want to nail down the exact stall speed of your aircraft under different scenarios?  You could write a script to fly the aircraft into a stall, then recover, climb to safe altitude, repeat.  You could write scripts to put the aircraft into all kinds of different specific flight situations and carefully record the data.  What is the elevator trim and power settings for level flight @ 25 kts, 30 kts, 35 kts, 40 kts, etc.  How about at a 5 degree bank, 10 degree bank, etc.
  • Create higher level intelligence without having to write code inside the core autopilot.  The autopilot does everything for the aircraft, and it must be reliable and robust and never fail or do something dumb.  This comes through long hours of flight testing.  Now you want to go fiddle around under the hood and change something?  That is begging for trouble!  Why not leave the autopilot alone and write your new functions in an external script?  Maybe you could write a fancy engine-out auto-land script that knows the basic performance characteristics of your aircraft and can plot and command an optimal approach path to touch down from any position and altitude to any landing strip in any wind conditions.