In my last BitZero update, I installed a GPS module and began having a problem where the servos seemed to be glitching every second or so. This turned out to be a resource contention. The GPS module communicates to Arduino with interrupts, and this was disrupting the PWM pins from sending proper signal to the servos. The solution turned out to be using the Adafruit Servo Shield. The PWM processing is offloaded to the shield and can continue to run when the Arduino chip gets an interrupt.
Next I got the GPS module running. At the time I had a compass installed as well but was dissatisfied with its accuracy. North was off by at least 30 degrees and sometimes the compass reading was zero. It occurred to me later that I could read samples from the compass and average them. I may revisit this later. But I noticed that even when the compass failed entirely, the GPS module would eventually take over and the vehicle reached the destination just fine. The GPS module can calculate direction from its previous location and current location. So it just needs to drive around a bit until it figures out where to go. I was hoping to have a robot a little bit smarter than having to sniff around, but that’s life. This is fine for now.
One thing I think I’m coming to find is that the resolution of GPS is not granular enough for this scale vehicle to drive in the streets. I can place a point in the middle of the street and really any where across the width of the street is recognized as the same point. This makes it impossible to be used autonomously in residential area. A wide open space is required. And I have ideas around that which will be announced soon.
And finally, I’ve upgraded the code to store multiple waypoints. Here is a demonstration.