Thursday, November 25, 2010

Ideas for cheap Laser Rangfinder

The bounty for hacking the XV-11's $30 LIDAR, teardown talk on Sparkfun and hacking thread on Trossen Robotics prodded me into doing some quick experiments.

I've been pondering, but not actually doing anything with laser-based object detection for a year now, for both the Trinity-style firefighting competition and the Sparkfun AVC.

The XV-11 unit looks to me like a camera and a laser pointer spun by a small CD motor (details of the system in this white paper). Picture from Sparkfun below. How hard would it be to hack something like this together?



Awhile ago I bought a line-generating laser to identify obstacles. Powered with a LM317 generating the required 3.0V, the laser generates a pretty nice line once you focus it.



Based on ideas I found online, one places the laser at some point low on a robot, with the laser's axis and line parallel to the ground, while the camera is placed some distance above and pointed slightly down, so that parallax can be leveraged.

A horizontal line is generated lower in the camera image for nearby objects, and higher in the image for far away objects.

Since I'm using Pokey's grayscale camera, rather than a color camera, I took pictures with and without a photographic red filter to see if that would help distinguish the laser reflection.

Laser line, red filter. Note height of line on cup, laser printer.

Laser line, no red filter

One could probably write code to detect the line even in a grayscale image although this would be substantially easier with an IR laser and IR filter. Or with a color camera.

Here's a color picture of the test area, my desk. Old HP laser printer to the left, McD's cup, front and center, etc.

As for the LIDAR concept, put a camera next to a laser pointer, align them to leverage horizontal parallax so one can measure distance based on the position of the dot.

I was curious to see what a tiny red laser pointer dot would look like on the grayscale camera. The dot is pretty tiny at about 8' distance (see red arrows).

Distant dot (red arrow), no red filter

Distant dot, with red filter

Maybe too tiny to reliably detect, although with the LIDAR one can constrain the search area vertically and possibly horizontally.

And constrain the search algorithm to square and circular shapes.

Come to think of it the code could correlate dot size with position for added robustness.

And actually the red filter seems to make the laser dot the brightest thing in the image, once the exposure and gain is set properly.

Nearby dot, no red filter

Nearby dot with red filter
Once code and camera can find the dot, the system has to do it quickly so it can be mounted on something spinny.

Doing a 360 degree sweep at 10Hz like the XV-11 means 3600fps which suggests it is using a much faster optical device than Pokey's camera or anything like it. I am guessing Neato is using a linescan sensor. You also need a fast processor. Speculation on the Sparkfun teardown blog post points to a Texas Instruments DSP device, TMS320C2801 at the heart of the XV-11 LIDAR's image processing.

I hit a wall at 3fps with an Arduino running Pokey's camera. I'm in the middle of interfacing with a Propeller but at absolute best I can get from that camera is 30fps. Nowhere close to fast enough for LIDAR. But workable with the laser line sensor concept. But all that's best left to another blog post or two.

I plan to just wait for someone to hack the XV-11 LIDAR and wait for spare parts to come out of Neato and hope I can afford the darn thing or build it myself for $30 as promised.

Sunday, November 21, 2010

Robotics goodies on sale...

Check it out, microcontrollers and other robotics goodies on sale. No affiliation with either company. Hope this is helpful to others on a shoestring budget like me.

Pololu is doing a black Friday sale with great prices on what I think is really useful stuff. I'm a fan of Pololu; Pokey's brain and drivetrain came from them. Good guys. Anyway, I have my eye on the $20 Orangutan B-328, $10 dual serial motor controller, $5 step-up step-down regulator, and $9 3-axis accelerometer but there's a bunch of stuff others might want too.  Hm, I better check my bank account balance...

Newark's Element-14 has some nice promotional deals going on controller boards like a $17 Multicomp Arduino board (35 day lead time, though), Multicomp Mega for $35, a Multicomp Nano for $28, an Amicus18 PIC board for $32 and an NXP OM11042 rapid prototyping board for $41.25 with the NXP LPC2368 ARM7 MCU.

Friday, November 19, 2010

Sparkfun AVC 2011: RC Truck

I had some birthday money burning a hole in my pocket and I've been thinking about the Sparkfun Autonomous Vehicle Contest too much lately.

I bought an budget-friendly, entry-level 1:10 RC truck.  An ElectrixRC Circuit.


I guess I'm going to go ahead and do this AVC thing. There's a long to do list. Let's see here...
  • Interface Arduino MCU to RC truck (done)
  • Research truck's handling limits* (in progress)
  • Collect acceleration data (in progress)
  • Devise Electronic Stability Control algorithms
  • Setup Android coding environment
  • Ramp up on Android coding
  • Explore using Android phone for navigation
  • Arduino to Android interface (bluetooth?)
  • Devise curb & object detection mechanism -- vision? laser? lidar?
Since Sparkfun hasn't actually announced the 2011 contest yet, I'm not sure how much time I have left but I'll assume it's happening around tax time again.  In fact, there's no guarantee the AVC will happen at all but I'm hopeful based on a comment on their website by an employee:

Although we haven't made any official AVC 2011 announcement (and this isn't one either), everybody around the office is assuming that AVC will continue every year into the indefinite future. It's just too much fun not to do it! Trevor

What I've learned so far about using my phone is that it lacks gyros, kind of a big deal I fear.  It makes the interface with the Arduino a little messier than I'd prefer.

Pic from Sparkfun.com
The 1-axis gyros I ordered from Sparkfun arrived, so I will most likely let the Arduino handle IMU interfacing, and have the phone manage the high level GPS and compass navigation.

---
* Yes, of course I'm going to get to play with the truck! Duh!