AVC 2013 - Lessons Learned

Well, AVC 2013 has come and gone and, while we had some fairly good success this year, it's time to ponder what went right and what went wrong in order to apply this hard-earned knowledge next year.  In the first part of this post I'll focus on my vehicle, Johnny Five.  Then, in a later section, I'll talk about how my daughter did her first time out with her QED turtle car.

Johnny Five - Mark II

I used the same chassis for AVC 2013 as I did my first year in 2013, which is an ECX Torment.  However, I replaced the ESC with a new, similar model after the original ESC that came with the car started to flake out.  I also replaced the steering servo with a metal gear model and also replaced the servo steering horn with an aluminum part, as the original plastic horn had its teeth stripped out (probably due to too much torque from collisions.)  I then had to recalibrate the pulse settings for teh ESC, as it behaved very differently from the original ESC and also had to swap around the control code for the steering servo, as it moved the opposite direction as the one it replaced.  But, all in all, it wasn't much work and I felt more confident about the mechanical details after making these changes.

The code was essentially a rewrite of last year code using all new IMU board I designed and new 3D Robotics GPS based on the UBlox LEA-6H.  The new GPS required the most code rework, as I decided to use its proprietary binary protocol rather than NMEA messages, as the binary lat/log values required no decimal conversion and sidestepped the math precision issues I ran into last year.  However, working with the other aspects of the Ublox binary protocol proved to be quite challenging, as the LEA-6H provides hundreds of different status messages and configuration parameters, making it a challenge to configure. 

I decided to stick with the Arduino Mega as the base processor, but the ATmega32U4 processor on my new IMU board design (the board beneath the GPS module in the upper right corner of the picture above) allowed me to offload the compass tilt compensation logic on the IMU board, which allowed for a lot more free CPU time on the Arduino Mega.  I had planned on using this CPU time to handle the input from the AVRCam clone I built as a way to acquire and track the ramp but, in the end, the camera proved incapable of taking decent pictures in bright sunlight.  So, I had to abandon my plans for tackling the ramp.  I did, however, manage to rework Johnny Five's distinctive movign eyes to make them look around randomly when waiting at the starting line (they'd previously only moved when Johnny Five was racing.)  This seemed to tickle several of the judges who came over to check them out.

I also decided to build a new LCD/Keypad interface for the Arduino Mega (shown above), as the commercial one I'd purchased had gotten very flaky (I suspect due to poor push buttons combined with the funky way it tried to multiplex all the buttons onto a single analog input pin.)  So, for my new board I have each button its own input pin and wrote a library that mimicked the way the old board worked.  Finally, I switched over to an FrSky two-way receiver system to give me full telemetry back from the car and rewrote the code in the TX to give me a real time display of the more important data bits from the car.  All in all, this wound up saving me a ton of time during field testing, which turned out to be critical as I wound up not having as much time to field test as I had hoped due to a nasty cold I picked up a week before the AVC.  I also switched to using a new failsafe mux of my own design (plugged on top of the FrSky receiver in the middle right in the picture above.)

Lesson 1: Practice, Practice, Practice

I learned this lesson in 2012 and swore that I would not repeat it again this year, but I did.  Part of the problem was that the time I had set aside for field testing got eaten up due to my illness.  But, honestly, I should have started months before this.  Instead, I got enamored of the AVRCam project and wound up spending way too much time on it when I should have just taken my car out into the field and put the new GPS through its paces.  My car actually performed fairly well at the AVC, managing to make it all the way around the track on the 3rd run.  However, I'm fairly certain the other two runs failed because I had just not gotten enough practice setting up the car's waypoints and putting it through its paces.

This was especially true in my 2nd run where, for reasons I can't really explain, I decided to turn on the Johnny Five's collision detection sonar even though I had only recently reinstalled it, had not calibrated it, not has I properly set the vertical angle to avoid bounce back from the ground.  The result was utterly embarrassing, as the sonar kept picking up false collision hits causing Johnny Five to weave back and forth like a drunken sailor only to end it's run by steering directly into a barrel it would have almost certainly missed had the sonar not been turned on.  Argh.

Lesson 2: Prepare, Prepare, Prepare

In the category of things I got right, my new mapping software was a big win and a huge time saver and also helped my daughter understand and master waypoint-based navigation.  The software wasn't too difficult to write and really cut down on my stress level at the AVC, as it made it possible to tweak and refine Johnny Five's path until I finally got it dialed on on the 3rd run.  Again, I probably would have done better if I'd gotten in more practice, but the ability to graphically click and place waypoints and then download them directly to Johnny Five help make things fairly foolproof (as contrasted with AVC 2012 where I was often frantically trying to connect to Google maps over the flaky WiFi and then retype the coordinates into the code.)

Reworking Johnny Five's hardware to use custom boards from OSH Park also helped a lot, too.  Last year Johnny Five's wiring was a bit of a mess and I was often worried about inadvertently pulling out a cable and then not knowing how to reconnect it.  But, by designing my own wiring breakout board for the Mega, I was able to greatly simplify and consolidate a lot of the wiring and make it fairly foolproof to reconnect by means of polarized JST connectors.  I also purchased some spare mechanical components for the ECX Torment chassis, as I'd almost had to scratch my first year (2012) when a front steering linkage on a wheel snapped.  Thankfully Michael Shimniok of Bot-Thoughts fame was able to hook me up with a spare.  I wasn't about to let that happen again.

Things to Think About for 2014

I think the best part about the Sparkfun AVC is that it is a rather difficult challenge, especially when you're constrained by a budget.  While I think it's been proven that having an expensive and very accurate GPS can make the challenge much easier, I believe the real challenge is also about how you win.  For me, the goal with Johnny Five has been to learn how to use inexpensive (< $100), commercial GPS modules to get a reliable result.  I'm not there yet, but I believe that's mostly because I've yet to lean how to apply advanced mathematical filter techniques that might help me fuse my odometry inputs with my GPS position fixes to get a more accurate result than either can produce independently.  So, in a way, one part of the AVC is a personal challenge for me to learn and apply these advanced methods.

The AVC is also a great place to try and think outside the box and come up with clever and innovative ways to tackle the course.  One thing that my daughter and I both noticed this year was how few of the cars that got stuck behind an obstacle even tried to recover and move on.  Both of us decided that this was a rather ignominious way to end a heat and we decided that we needed to give it more thought for next year.  Hopefully, if we pull this off, it will make for a better score as well as a more interesting race, as it's rather boring to see most of the cars fail to make it even part way around the course due to an unexpected encounter with a hay bale, a barrel or another car.