Let's Make Robots!

Laser Distancing Probe using WiiMote - Brought to you by Rare Swiss Cow Productions

Following on from a post here "LoMoR Blog"

I have at long last started work on a Laser Distancing Probe using a WiiMote.

Basically i have equiped two Servos with simple Lasers and strapped it to a WiiMote.

I can alter the angle of the two laser beams (they can be fixed at one angle .....but where is the fun in that)

errrr - i also worked out that you actually only need one Laser (but again two is more fun)

The laser shoots out two beams of bright light which hits the wall --- here comes the cool part .....the WiiMote is able to see the brightspots - and works out how far apart they are ....... by simple triangulation you can workout the distance to wall.

 

I

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
GroG's picture

Most LIDAR units I have seen have a scanning motor spinning a mirror.. I have done this and so has OddBot

Because of a capture rate of a camera say of 15 FPS you can get a line segment in the picture frame..
If you know the constant parameters of the system (e.g. spin rate of motor, field of view for camera, etc, etc) you can determine depth by the just the line segment, and of course if the line segment is broken you can compute the other depths based on location of the smaller segments...  

Also as mentioned above there is the calculation of the laser angle relative to detection of the spot in the image ... so many ways

I have thought wouldn't it be tingly cool to use two off center mirrors on 2 motors to produce (damn forgot the word for the pattern!) but it looks like this... 

lejoule?  arggh ... Anway changing the speed of the motor changes the design but basically its a 2 D laser grid which the computer can use to do a 3-D calculation of depth !!

Let's start rockin !

GroG's picture

O my gosh, I'm so glad you re-directed me here from the shoutbox...
I think we could be very close to some really good inexpensive LIDAR and data visualization !!!!  Which in turn could be sent back from the computer to the little bot.

Questions:

1. Wii remote (where would you suggest I get one?)
2. Did you have to do any mods on it to work with the 630 nm pen lasers?
3. Wii remote -> Blue Tooth --> PC --> Glove Pie   (Is this correct?)
4. What "form" of data do you get off of GlovePie - a raw video frame?
5. Did you have to do any filtering at all ?

How exciting !!!!

Gareth's picture
  1. supermarket or ebay - you can pick them up as reasonable prices now
  2. For point lasers - then show without mod - if you remove the front red filter then you get a better signal, however ambient light can interfere
  3. In the example above i use Glove Pie - however i have had success with Visual Studio Wiimote
  4. Glove Pie gives xy coords ...... of the 4 strongest points of light it can find
  5. no filtering - however a laser wavelength filter would help with killing ambient light.

I have not experimented with video frames yet.

GroG's picture

 

  1. supermarket or ebay - you can pick them up as reasonable prices now Check - got a lovely wii remote plus (little motor) at super market in blue !
  2. For point lasers - then show without mod - if you remove the front red filter then you get a better signal, however ambient light can interfere -

    Haven't removed it yet but I need to wait until I get a PC Dongle - specifically from the list of supported Bluetooth devices here http://wiibrew.org/wiki/List_of_Working_Bluetooth_Devices

  3. In the example above i use Glove Pie - however i have had success with Visual Studio Wiimote - Check, the wiibrew site seems to be a cornucopia of good info - Being a penguin I'll probably start with http://abstrakraft.org/cwiid/
  4. Glove Pie gives xy coords ...... of the 4 strongest points of light it can find Check
  5. no filtering - however a laser wavelength filter would help with killing ambient light. - Check, I have some red acetate I'll play with

I have not experimented with video frames yet.,  Ok.. I'm be taking little wii steps, its nice to have it pre-processed anyway if the data is going over bluetooth - just gotta get one of those dang-dongles

Thanks !

 

TeleFox's picture

G_laser_6b.jpg

Ok, here's the math breakdown:
γ+α+β=180° from internal triangle angles sum to 180° (γ = angle gamma, looks kinda funny in this char set)
γ=180°-α-β [Eq1]
Φ+α+90°=180° from internal triangle angles sum to 180°
Φ=90°-α [Eq2]
y=(x+s/2)/tan(Φ) from generic trig on the largest triangle
y=(x-s/2)/tan(Φ-γ) from generic trig on the left inner triangle
(x+s/2)/tan(Φ)=(x-s/2)/tan(Φ-γ) equating both "y=..."
x*(tan(Φ-γ)-tan(Φ))=(s/2)*(-tan(Φ)-tan(Φ-γ))
x*(tan(-Φ)+tan(Φ-γ))=(s/2)*(tan(-Φ)+tan(γ-Φ)) from -tan(z)=tan(-z)
x=(s/2)*(tan(-Φ)+tan(γ-Φ))/(tan(-Φ)+tan(Φ-γ))
x=(s/2)*(tan(α-90°)+tan(180°-α-β+α-90°))/(tan(α-90°)+tan(90°-α-180°+α+β)) substituting in [Eq1] & [Eq2]
x=(s/2)*(tan(α-90°)+tan(90°-β))/(tan(α-90°)+tan(β-90°))

(x+s/2)=y*tan(Φ) from generic trig on the largest triangle
(x-s/2)=y*tan(Φ-γ) from generic trig on the left inner triangle
(x+s/2)-(x-s/2)=y*tan(Φ)-y*tan(Φ-γ) taking the difference between the above two equations
s=y*(tan(Φ)-tan(Φ-γ))
s=y*(tan(Φ)+tan(γ-Φ))
y=s/(tan(Φ)+tan(γ-Φ))
y=s/(tan(90°-α)+tan(180°-α-β-90°+α)) substituting in [Eq1] & [Eq2]
y=s/(tan(90°-α)+tan(90°-β))

So now we have an equation for both [x] and [y] that gives us their value just by plugging in the known values for α, β and [s]. We can convert these 'cartesian' values into [d] and [θ] using the following:
d=√(x²+y²)
θ=atan(y/x)

Gareth's picture

I would not have had a clue as to the complexity of what i qouted as "simple triangulation"

I will have to attache my "Laser prods" to a real Robot and then decide which distance i will actually need - maybe it will be a combination.

 

rik's picture

It takes a while to read all that, but not as long as trying to figure out this:

Using the sinus (sine) rule....

a/sin(α) = b/sin(β) = d/sin(γ)   ; da rule
a = s · (sin(α) / sin(γ))
b = s · (sin(β) / sin(γ))

My geo-instinct tells me that d is the average of a and b:
d = 1/2 · (a + b)
d = 1/2 · ( s · (sin(α) / sin(γ)) + s · (sin(β) / sin(γ)) )   ; substitutions from above
d = s/2 · ( (sin(α) + sin(β)) / sin(γ) )   ; (this is so much easier to see using "horizontal division lines")
γ=180°-α-β   ; like you said, internal angles and stuff
d = s/2 · ( (sin(α) + sin(β) ) / sin(180°-α-β)

This expresses distance d in known variables α, β and s, it requires three sine calculations by your algorythm. I never bothered with x and y, because I was interested in d only. But now that we have d, x and y would follow easily. First we need a new definition of theta.
θ = α + γ/2
θ = α + (180°-α-β)/2

y = d · sin(θ) = d · sin(α + (180°-α-β)/2)
x = d · cos(θ) = d · cos(α + (180°-α-β)/2)

Both from generic trig.

I love it how, in a triangle, there are so many ways to get the same answers. Uhhhmm, they are the same right?

8-)

Gareth's picture
Thanks for the info rik.......... now a fitting Rare Robot will have to sport them on his head ....... "Moooo"
rik's picture
yeah!
Gareth's picture

Take a laser and scan it horizontaly in a corner of a room ......

....lo and behold you do not get a straight line but an arrow head pointing to the corner of the ceiling.

the steeper the angle of the laser the more pointed the arrow head becomes.

For detection all you would need to do is detect (during scan) a rapid change back in the same direction you came from.

laser_011.jpg

OK for the "Romantically" inclined if you are still struggling to understand to principle :-

What happens if you project a perfectly round circle (barring servo jitter) at a steep angle into the corner of the room.

laser_015.jpg

If you still dont get it turn the image upside down and impress the hell out of your robots.