Tuesday, May 29, 2012

AVC: Brain Transplant and Updates

Many months ago I burned out UART2 on Data Bus' mbed microcontroller. I'm adding a new serial-based sensor for obstacle detection and the original mbed is all out of ports (one for GPS, one for the LCD display and one for the USB serial connection).

A new mbed is on order from Sparkfun (I put off spending $60 as long as I could) and it will be plugged into a revised baseboard, connecting it to all Data Bus' sensors and actuators.


It's smaller, has an integrated microSD card slot, a built-in buzzer for audio feedback and status, inline resistors on all the UARTs (to prevent burning them out again) and will have nice laser-printed silkscreening instead of sharpie scribblings like the current board.


Other Updates
In other news, I haven't made much progress increasing the robot's speed. As soon as I upped it a few m/s, several issues cropped up that have to be addressed before further increases are possible.

I've been working on position estimation refinements. After the robot updates heading estimate with lagged GPS data, it now updates current heading and position based on that estimate. That required converting all the code to using cartesian coordinates instead of latitude, longitude.

I'm also working on a way to deal with gyro bias. I haven't had much luck so far. Part of the problem is that the robot is extremely sensitive to initial heading; there's a steady state error that isn't being corrected. As a result, the gyro bias compensation doesn't work properly.

Minor Success
I did some test runs at SFE on Monday and met Team Viator. Their robot made several successful runs around the building.

I'm happy to report Data Bus made its first autonomous trip around the building with a final position error of only a couple meters. Yay!

Purple path is the estimated position
On the downside, that was the only success out of several attempts. The steady state heading errors, as well as a faulty left wheel encoder system, resulted in all kinds of failures.

Friday, May 25, 2012

AVC: Visualizing Position


Look at all those pretty lines. Each represents the path of Data Bus as recorded in a log file for each run. Visualizing Data Bus' reported path has been invaluable in troubleshooting, tuning, and tweaking.

So, how do I turn the log file into the mapping above? A series of handy scripts and tools...

Friday, May 18, 2012

AVC: PID Controller

I decided to implement a PID controller on Data Bus to manage speed. Rather than repeat what everyone else has written about the topic, let me point you in the right direction and address a few practical points with code examples.

I'd be happy to hear from readers with more experience on PID implementation and tuning to further improve this article.

Here are a couple of good discussions about the topic....

Tuesday, May 15, 2012

AVC: Speed Tests

At the demo, Data Bus, running autonomously, was traveling about 5m/s, slightly faster than the winning speed at last year's Sparkfun AVC. I believe my robot needs to be faster.

So, on Sunday, my little girl and I went down to the school and we bumped up the speed incrementally to see what would happen. The results were... not pretty. These gps plots closely reflect reality.

The GPS plots are close to Truth but shifted southwest about 2-3 meters

Friday, May 11, 2012

AVC: Serial to I2C Bridge

I finished designing, etching and silkscreening a new board last night and started populating it. It's a slight redesign of a board I did before last year's AVC. What's it for? Not telling yet. :)


I can say this. It's an Arduino clone that will speak serial on one set of pins via NewSoftSerial and I2C on the standard set of pins. It has an FTDI header for programming via bootloader.

Tuesday, May 8, 2012

AVC: Demo Results


I'm pleased to say the Demo went very well, thanks to an all night hacking session on Friday. I was able to address the GPS data lag and fuse GPS and gyro with a Kalman Filter.

Data Bus made 5 or 6 runs on Saturday, all successful. Position along the course was within about 2 meters.

The solution works well enough that even after crashing into one of the camera people, the robot still finished the course fairly close to the final waypoint.

Onto obstacle detection and avoidance!

Friday, May 4, 2012

AVC: Ready for Saturday Demo? Uhh...


I attended my first Robot Party tonight! I probably should have been coding but I needed a little break. It was really fun and I highly recommend it.

Team Daisy Rover, another 2011 AVC veteran, will be joining us on Saturday with a robot! That's a 100% increase in robot fun, folks!

Even better, after sitting on the waiting list for months, Sparkfun just told Ted and Daisy Rover that they are now officially entered into the 2012 AVC! Congratulations!

As for Data Bus, the good news is that the robot sort of works outside my house, albeit slowly and with lagging steering correction. My single test at the demo site went poorly so I'm not too confident about Saturday.

Using the Venus high dynamic range firmware reduced smoothing a bit, but not gps lag. I was able to prototype a basic, time-shifted feedback in Octave. The algorithm compares gps heading to integrated gyro heading from one second prior and then adjusts the current heading and gyro bias by a fraction of that error.

Here's a plot of the result for one of the autonomous runs. The shifted/corrected gyro heading is in red, the smoother GPS heading in green. Blue is the current gyro heading.


I ran the algorithm using data collected from a couple of autonomous runs, generated position estimates by combining heading and distance traveled, then displayed in Google Earth. The light red and light blue paths are based on raw gps heading. The dark red and blue paths are based on corrected gyro heading.


 


Truth be told, these plots don't look too bad. I implemented the algorithm as carefully as I could on the robot, but the real world tests were a miserable failure. Data Bus even crashed and rolled on the second run, plotted below. Yay.


The GPS path is in light blue and is fairly close to the real path taken (can you see where the robot went up on the curb and crashed?) The dark blue line is the path based on corrected gyro heading. This is the path Data Bus thought it was following. Data Bus was off by quite a distance! Stupid robot.

I  have some ideas as to what happened, but I don't think I can get this working reliably before Saturday. I'll most likely revert the code changes and run the Bus slowly with waypoints carefully selected to accommodate the lag.

Wish me luck. I need a lot more than I've been having lately.

But, enough doom and gloom. Tomorrow is going to be a Cinco-de-Mayo Robot blast of a good time and I'll post the video to prove it! Stay tuned...

Tuesday, May 1, 2012

AVC: GPS Lag, Gyro, Heading Estimation


You may recall that Data Bus was behaving erratically, steering in wild circles. Why?

With only 4 days left until the big demo, I better figure it out and fix it, fast!

A number of people have written with some excellent thoughts and insight that have been invaluable in understanding the problem and various solutions. Here are some clues...