Showing posts with label Sparkfun AVC. Show all posts
Showing posts with label Sparkfun AVC. Show all posts

Tuesday, March 1, 2016

Sparkfun AVC 2016


Sparkfun announced that the 2016 Autonomous Vehicle Competition will be happening in September this year!

That's good. It'll be cooler than summer, almost certainly sunny and a pleasant 70-80 degrees. Plus we have loads of extra time to procrastinate. Win-win!

The big news is they're making some kind of addition to the AVC involving -- if the pictorial hint is to be believed -- little kids driving around in home made go-karts?!? Or... I really don't know...

What does it mean!?!?!?
Maybe autonomous road racing? That'd be sweet. Maybe kids will race with bots? Maybe robot kids will... nevermind.

What about me? Though life has been leaving boot prints on my backside for the better part of the last year, IF the AVC additions are super-interesting, Data Bus may have to make a comeback.

I haven't forgotten about rovers. In fact, I've been working on some Rover-related goodies in the meanwhile...

Friday, July 11, 2014

Stop that Robot Jeep

Photo by Alicia Gibb, CC-BY-SA
The last thing we needed was a 5,000 lb full size Jeep going out of control at the 2014 Sparkfun AVC. One of our safety features was an on-by-default brake actuator.

The microcontroller deactivates it during a run but if hitting the e-stop, or shutting off the ignition, or arriving at the last waypoint re-activates the actuator and stops the Jeep. During the run I could still press the brake manually. Here's how we built it.

Thursday, July 3, 2014

AVC: What About Data Bus?

Though Data Bus made it to the 2014 Sparkfun AVC, it had to sit out again this year. Time ran out to fix the Bus so I focused on the Jeep.

Data Bus makes a cameo (arrow)
You can see Data Bus in the Sparkfun AVC recap video, sitting on the table near Troubled Child and also riding on top of the Jeep on our final run...

Tuesday, June 10, 2014

AVC: 10 Day Panic

Oh crap. The competition is heating up for the Sparkfun AVC. There's only 10 days left.

And I'm doomed. As usual.

Top Contenders

I'm in the Peloton class. So are some heavy hitters.

Monday, June 2, 2014

AVC: Heading Errors, Path Following Woes

A little over two weeks to go as I write this. That's not much time.

Testing uncovered a couple of obvious problems. The robot is experiencing heading errors and the pure pursuit path following is still working poorly.

Thursday, May 29, 2014

2014 AVC: Entry Video

Here's my Data Bus proof of concept video for the 2014 Sparkfun AVC.



Thursday, May 22, 2014

AVC: Pose and Map Display

To fix the path following algorithm on Data Bus I have to know what the robot is thinking.

To know what it's thinking, the robot is now sending some new data in its telemetry stream to the GCS.
  • All waypoints
  • Index of the next waypoint
  • Lookahead position

The GCS now opens a map window which scales and displays the data above as well as vehicle pose (position and heading).

Tuesday, May 20, 2014

Sparkfun AVC Update

The last few months, within the free nooks and crannies of an incredibly hectic life, I've done my best to fit in work on my Sparkfun AVC entries, Data Bus and the still-top-secret SHARC entry.

Thursday, May 15, 2014

AVC: Ground Control Station


With less than two months left to get Data Bus working, why am I working on Ground Control Station (aka GCS) software?

Thursday, February 27, 2014

AVC Path Following

I implemented an improved path following algorithm on Data Bus and later, the SHARC self-driving Jeep that won Doping in the 2014 Sparkfun AVC.

The old, simple path following algorithm worked but didn't correct cross track error. The new algorithm chases a virtual rabbit, computing where the rabbit is and how to intercept it.

The Pure Pursuit algorithm is conceptually elegant and simple. It's easy to program, it's popular, and, clearly, it works quite well.

Pure Pursuit Algorithm

The robot follows a virtual rabbit that travels around the legs of the course, with each leg defined by two points. The rabbit is always located along the current leg of the course, A=[W0 W1].

The projection of the robot's position onto A is point P and the rabbit is located along A, a fixed distance from P. The fixed distance between P and the rabbit is called the lookahead distance.


The algorithm moves the rabbit's position at each update step, computes a relative bearing from the robot to the rabbit, computes an arc path tangential to its heading that intercepts the rabbit. The result of this unending pursuit is a smooth correction to the robot's heading and cross track error. This algorithm is called Pure Pursuit.

Here's the math I used to compute the intercept arc. The distance from W0 to P is the projection of the robot's position onto W, given by a dot product:


Where A=[W0 W1] and B=[W0 robot]. Vector A, divided by its magnitude, is the unit vector pointing along A. The dot product can be computed with trig functions (slow) or you can do it this way (fast):


 

Once you have a scalar from the dot product you can find your goal point, the rabbit, like this:





Even if the math looks spooky, the code is trivial. Here's the Processing code I used for my simulation.

  // Leg vector
  float Ax = Xw[next] - Xw[prev];
  float Ay = Yw[next] - Yw[prev];
  // Bot vector
  float Bx = x - Xw[prev];
  float By = y - Yw[prev];
  // Dot product
  float legLength = sqrt(Ax*Ax + Ay*Ay);
  float proj = (Lx*Bx + Ly*By)/legLength;

  // Goal point ("rabbit")
  float Rx = (proj+lookAhead)*Ax/legLength + Xw[prev];
  float Ry = (proj+lookAhead)*Ay/legLength + Yw[prev];


See? Not bad at all!

Turning

The robot now knows where the rabbit is. The robot knows it's heading and position. It can compute the relative bearing to the rabbit. But how much should the robot turn to catch the rabbit?

An elegant approach with smooth behavior that doesn't require complex programming logic or trial and error tuning is to use an intercept arc that intersects both robot and rabbit, and is tangential to the robot's heading. Here's how.

We have the robot at B, it's heading described by BC, and the rabbit or goal point at G. The distance between B and G is D.


A circle that intersects B and G and is tangential to BC with radius R will have an origin along a line that is perpendicular to BC and passes through B. We simply need to find out R, the radius for this circle. Time to break out some trigonometry.



Draw another radius line perpendicular to BG. This line will bisect BG (each line is D/2 in length). Studying the right triangles generated by these lines, notice that the relative bearing, theta, is also the angle between the new radii intersecting B and G, respectively.


We can express D/2 in terms of R and Theta, then solve for R:



The robot recomputes a new intercept arc at every update step. The result is a continuous path towards the goal point. The path is followed, the cross track error is accounted for.

Conclusion

So, despite planning to test this on a small 1:10 RC car, I ended up proving it out on the full size Jeep. Once the turning radius and lookahead distances are set reasonably, it works a treat!

If I get some time I'll post up the calculations for converting from arc radius to steering angle to servo signal. Suffice it to say that determining the correct steering angle to traverse the intercept arc is relatively simple to figure out, using basic geometry.

References
Path Tracking for a Miniature Robot.pdf
coulter_r_craig_1992_1/coulter_r_craig_1992_1.pdf

Tuesday, February 4, 2014

SHARC AVC Meeting

Dinosaurs and coolers in 2011
SHARC met again on Saturday to discuss our plans for the 2014 Sparkfun AVC.

A number of folks new to the AVC and some new to robotics are interested in entering which is great. Some of the more experienced SHARC folks are going to give them some guidance along the way as we attend working sessions to build up our respective rovers.

Expect to see a slew of SHARC robots overtaking the AVC this year!

2013: Two wheeled robots, hovercraft, cars, trucks...
I had previously mentioned the top secret SHARC AVC entry. We talked about that some more and we have a plan. It's going to be massive.

If we can pull it off, that is. I'd rather make some progress on the iffy bits before making the big reveal. Talking about what you're going to do is much easier than doing it.

We did feel obligated to ask the Sparkfun folks if our idea would be generally allowed. To which they said, "bring it on."

Monday, November 18, 2013

Sparkfun AVC 2014 Announced

Sparkfun has announced the date and venue for the 2014 Autonomous Vehicle Competition. June 21st at the Boulder Reservoir. Details here.


Thursday, July 18, 2013

Rover RC Multiplexer


Safety switch? Takeover circuit? RC Mux? Kill switch? Whatever it's called, this circuit is how you take over control of your autonomous rover milliseconds before it crashes itself into a curb, lake, or ankle. And I've just redesigned mine. Here are the deets. (Meanwhile, it's now for sale on Tindie)

Friday, June 7, 2013

AVC: Throwing in the towel

I made progress but not enough today, so it's time to be realistic and call it quits for 2013.

The robot ran somewhat consistently at the local elementary school but wasn't following the path properly. It knew where it was, the position estimation was in the ballpark, but the robot didn't follow the path it was supposed to.

AVC: things go right again

I'm upgrading my chances at the AVC from mostly crap to slim. It would seem I've managed to slay some critical bugs.

After killing bugs with angle calculation earlier, I found a stupid mistake in the steering angle calculation and problems with the lag compensation. Surely there's two or three more lurking, waiting to make a fool of me.

Anyway, the robot successfully completed three short runs outside the house, ending with a track variation of about 2' and a heading variation of about 10 degrees. While this is a big improvement over previous runs, there's still more to do than I'd like. Here's the analysis.

Thursday, June 6, 2013

AVC: finally something goes right

Finally, something went right. My chances of success at AVC just went from total crap to mostly crap.

Though I couldn't get the new Venus to track satellites, I discovered why the uBlox wasn't working with my code base, fixed it, and it's now tracking lots of satellites.

The uBlox problem was due to a stupid mistake I made on my baseboard. Once I hooked it the GPS up to the good UART port, GPS data came streaming in. That's not all

Wednesday, June 5, 2013

GPS not fixed

Last we left off, my beloved Venus GPS was dead. Nothing coming out of the TX pin. So I ordered a new one late last week before my out of town trip. It had arrived when I returned but something is wrong; it's unable to pick up satellites worth a darn. Even outside! I have no idea what is going on.

What little spare time I've had for testing has been lost to rain. I installed my shiny purple OSHpark baseboard last night.

I found and fixed a bug in the estimation code. I was multiplying a heading error tern by a fraction to reduce its influence over time. The difference was normalized to a range of -180 to 180 only after multiplying. It should have been normalized before the multiplication.

I may stand a chance if...
  • the last critical bug is fixed (I know there are plenty of other bugs),
  • I can get a working GPS,
  • the encoders are fixed once and for all,
  • I can find a good-enough Kalman Filter tuning,
  • I can get accurate measurements for waypoints Saturday
No problem.

Friday, May 31, 2013

Encoder Fixed

 Naughty little wheel encoder!
I mentioned suspicious signals from the encoders. Here's what I was seeing. This is a plot of the distance traveled versus time. The plot is showing that one of the wheels is able to travel more than 300m in a fraction of a second. Cool.

Thursday, May 30, 2013

AVC Update

Over on diyrovers Google Group we've been getting some sneak peeks at the 2013 AVC competitors' progress!

Team 0x27, winners of last  year's AVC posted up a video of preliminary testing of their unicycle robot...



Meanwhile, Savage Solder, a recent Robomagellan champ, is performing brilliantly in this test video:

Friday, May 17, 2013

Noise and the 3DR uBlox LEA-6 GPS

3DR uBlox LEA-6 GPS + secret sauce
I'm evaluating a 3DR uBlox LEA-6 GPS for use on Data Bus to either replace or supplement its current module, the Venus 638FLPX.

At first the GPS could not obtain a fix. Here's how I brought the GPS from no fix to a 10-satellite fix. From my basement!