Epic Race at the Sparkfun Autonomous Vehicle Challenge 2017 – Part II


As with any side-project, especially with a hard and fast deadline, loose-ends were just an inevitability. When I left for Denver on Thursday afternoon I had three software bits unfinished. I’d done testing and analysis on all three, but these were still incomplete:

  1. Obstacle avoidance (primarily barrels – we don’t want to hit or get hung up on obstacles for obvious reasons)
  2. Stop at the stop sign before the pedestrian crosswalk (stop within 12” to score extra points)
  3. Hoop Location (drive through the hoop to score extra points)

By the way…if you missed the first part of the “Trilogy” you can catch up here.

Thursday – Arrival in Denver: Thursday night (8:00 pm) when I arrived at the hotel near the event, I went out and looked at the course. You can see my video of the actual course, in its entirety, below.

Friday: Early Friday morning I wrote my barrel-avoidance code and started testing on the actual course. By 3:00 pm, I had my barrel code working and the car was going through the barrel section, mostly avoiding the barrels, five out of six times or so. Unfortunately, I noticed that the car was almost too wide to fit between the tightly spaced barrels so I really needed to go slow and turn sharply. To make this happen I turned the steering gain way up for any instance in time when the car was in barrel-avoidance mode.

3D model of the barrels section

On to the next obstacle…the pedestrian crosswalk! I took some live track data to figure out how to detect the crosswalk (equipped with a fake walking pedestrian) and stop at the stop sign just in front of the crosswalk. To score points the car needed to stop within 12” of the stop sign. In testing this chunk of code, it worked one time in four or five tries – not good enough. I continued to work on this code until 7:30 pm where I discovered my error…. I was using a static variable to indicate that I’d already done the stop and to not do it again. Therefore, the code worked after a clean reset, but not a test restart!

3D model of the pedestrian crossing obstacle

Once I fixed that goof-up, I was reliably stopping at the pedestrian. I put everything together and did a full run and everything worked! Then the course, conveniently, closed at 8pm and I was done for the day. I had one issue remaining. The start line threshold (a plastic floor wire-conduit) was just too high for the sporty low-profile Traxxas chassis. At anything but high cruising velocities it high-centered the car. Why hadn’t I chosen a monster truck chassis instead!?

The remedy was less than ideal. I had to move the car a good deal behind the start line and accelerate to an “escape velocity.” I could use the threshold as an ill-suited stunt ramp to jump over the start line. This basically added 50” to 70” to the calculated travel path as the wheels spun at a much greater rate once in the air – as part of the navigation routine I had been monitoring vehicle travel with the built-in odometer. I did a hack and added in 70” to the path in code. “I’ll test this in the 2 hours of testing Saturday morning…” or so I thought.

Saturday – Race Day #1: It’s a cold October day in Denver and I’m there when the course opens for practice. Rather than use my 70” hack I devised the night before, I manually record a new track path starting 24” behind the start and use that recording to layout a new path.

I do a test run and the car crashes into the hay bales straight ahead…. and breaks the 3D printed bracket that held the LIDAR and electronics on the white car. I brought spares of every 3D printed object on the car (6 parts) except the one bracket, because that was not on the black car. That part was metallic (not 3D printed) on the black car.

So, with only 1 hour 15 minutes till race start I had to get the black car ready. It was 100% complete except I had not wired the start switch. I put both cars in the back of the rental SUV and drove back to the hotel (about ¼ mi away). When I got there, I discovered the tailgate of the SUV had not closed and neither race car was in the SUV! (Cue feeling of being buried alive). I went back and found both cars lying in the road, otherwise undamaged! (Cue feeling of being exhumed shortly before asphyxiation)

I brought them back to the room and hastily wired in the start switch on the black car. I’d planned to do that Saturday afternoon after race day one was over. Rules were: I could run one car on Saturday and a different one on Sunday. I now have 15 minutes till practice is over and 30 min till my heat starts and car #2 had not yet been turned on in Colorado!

Back at the race track, I run my final pre-race tests and it impacts into the same hay bale that broke the previous car. And I then remember that my extra 70” hack was still in place, and hence the overshoot. I spent my final pre-race moments to hastily remove the 70” hack and flip to the now preferred 24” offset path I had recorded earlier. I get in one last test run; it clears the threshold but gets tied up in the barrels. I’m not sure why the barrel avoidance is not working, and had hoped to spend that morning fine tuning the path to center it up on the course and perfect it. Alas, instead I had spent the morning soldering switches and removing my 70” hack. And we’re off!

Saturday Heat 1: The vehicle gets a tiny bit hung up in barrels, but otherwise does the first half of the course. It’s supposed to go just inside the ramp obstacle. Regrettably, due to the lack of track tuning, it hits the ramp/jump and goes off the edge, causing it to pivot a bit and then impact the hay bales on the other side. End of heat 1.

Testing between Heat 1 and Heat 2. The car is now acting unreliably. It runs sometimes, and other times it just wanders off course in random ways. A couple of times when I try to gain manual control with the RC receiver it won’t steer! In troubleshooting this, power-cycling always seems to fix the problem, and I’m wondering if I have a hardware issue. Only one out of three or so test runs work. One run is random, and one gets hung up in the barrels.

The NANO54415 CPU on this car was an old dusty first revision prototype board that I had used on many projects, so I figure there is no harm in swapping the board and do so. Click here for the latest, greatest NANO54415. I reprogram the NANO on the fly with the car code, program in the course, and as Murphy would have it, I’m out of testing time. Time for heat 2….

Saturday Heat 2: I press the go button, it immediately turns right into the wall and dies. What happened??!! The system saves a bunch of configurable parameters in flash. One such parameter is to use the magnetic compass OR just the bare gyro for navigation. I’d found the bare gyro was more repeatable than the compass, but in the heat of the moment I had forgotten that the magnetic compass defaulted to ON. So, the car turned right into the wall!

Heat 3:
The car ran pretty much perfectly, it dodged the barrels well, missed the bonus points for the ramp, caught the hoop and almost stopped at the stop sign. It was supposed to stop within 12” of the line, it stopped about 18” short, so while it stopped and missed the pedestrian (whew!) it did not get the stop bonus.

This was the VERY first car to complete the entire course at this year’s AVC! One other car in a later heat also finished the course so only two cars finished on Saturday. This heat ultimately earned NetBurner the AVC 2017 Silver metal.

Read Part III Next

Share this post

Subscribe to our Newsletter

Get monthly updates from our Learn Blog with the latest in IoT and Embedded technology news, trends, tutorial and best practices. Or just opt in for product change notifications.

Leave a Reply
Click to access the login or register cheese