Autonomous Car pt.3

Date Fri 05 April 2013

It's been a while since my last update on the autonomous car project. Lots of things have been changed or redone. The biggest upgrade was replacing the Arduino mega with a Chipkit max32, which I had discussed in my last post. The increased speed of the Chipkit board has really improved the car. The first thing I noticed was that the loop time decreased from about 50ms on the Arduino to around 20ms with the Chipkit. This means that the gyro scope data can be updated much faster and helps produce a more accurate heading. I highlighted most of the car's new features in the image below.


One of the added bonuses of the Chipkit is that it has a 3.3V logic level. This works out well since all the sensors are also 3.3V, and I could easily add an SD card for data logging without having to buy a level converter or filling up my breadboard with tons of voltage dividers. I’m using a microSD card adaptor with a header soldered on it and a 512mb microSD card to the data logging. Keeping track of all the car’s data has been a huge help. I easily caught several bugs already that I would have otherwise had to spend days trying to figure out.

The LCD was also a very helpful addition. Being able to see the data right on the screen while the car was trying to drive itself into a river is very useful. Right now it displays the Kalman heading (from the GPS/Gyro), the GPS heading, the heading difference, and the distance to the next waypoint. That's about all that will fit on the small screen.


With all of that and a lot of work on the code, the car project is going really well. I still need to get a video of it, but for its run today, the car drove down the street meeting 3 waypoints and then returning to the starting point. The only intervention needed was a quick save from driving into a deep puddle (no puddle detection yet). The image below shows the car's gps coordinates plotted on a map. The blue line is the calculated path between waypoints, and the red line is the actual path the car took. Notice that it gets a little messy where the car turns around. That's where the car nearly drove into a puddle.


The code is still far from ideal, so I’m working on a few new changes right now. The GPS signal seems to be a bit noisy at times. Looking back on the heading data collected during a run, I can see that the car is properly correcting its heading to meet the waypoint. The problem is that a new GPS update will throw the heading off. Sometimes this has been as large as 15-20 degrees, which cause the car to think that its way off course.

I thought the Kalman filter should take care of this problem, but it doesn’t seem to fix it. It may be a bug in my Kalman code or perhaps I need to smooth out the heading data first. I’m looking into both options right now. To smooth out the heading data, I’m working on some code that will store several heading updates in a first-in-first-out array. That should correct any big changes in GPS heading.

I’m also working on adding dead reckoning to the code. With this the car will calculate it’s current heading off of only the gyroscope in-between GPS updates. This would also make it easy to add in a function that tells the car to only use the gyro if the GPS signal drops out or it the quality of drops too much.

Comments !

comments powered by Disqus