# Thread: LIDAR-lite 360 Mirror Scanner

1. T-1000
Join Date
Feb 2009
Posts
2,061
Images
2
Rep Power
119

## Re: LIDAR-lite 360 Mirror Scanner

Quick update: I need to play some wit the calculate speed function:
Code:
```void calculate_speed( int p_position, int p_interval )
{
int degreesTraveled;
if ( p_position > lastMotorPos )
{
degreesTraveled = p_position - lastMotorPos;
}
else
{
degreesTraveled = p_position - lastMotorPos + 360;
}
lastMotorPos = p_position;
secsPerDeg = ( p_interval / 1000.0/*milliseconds*/ ) / degreesTraveled;
secondsPerDegree = ( 0.9 * secondsPerDegree ) + ( 0.1 * secsPerDeg );
}```
I updated the function to also output secsPerDeg to help debug... This except should give a few clues:
Darn new Arduino when I unplug USB cable it still shows the data, but it is grayed out which is fine, but you can not copy to clipboard... So will describe:
Suppose you call twice with p_position = 0 degrees.

In the code the line if ( p_position > lastMotorPos ) will be false as they are equal, so it will calculate that:
we went: 360 degrees (0-0+360)

Where the calculation went off was Call with 360 degrees followed by 0 degrees.
It will calculate: degreesTraveled = (0 - 360) + 360 or 0 degrees.
At which point secsPerDegree we will get a divide by zero.

My guess is that 360 should have been 0...

2. ## Re: LIDAR-lite 360 Mirror Scanner

You could assume that the servo never travels more than 180 degrees (either direction) per poll.

Or you could change the ">" to a ">=" if you will ever only travel in one direction.
Though, if the encoder is slightly noisy, you may get a second reading that's one tick less than the previous reading, so checking if (p_position > lastMotorPos - 4) or something would probably be even safer!

3. T-1000
Join Date
Feb 2009
Posts
2,061
Images
2
Rep Power
119

## Re: LIDAR-lite 360 Mirror Scanner

Thanks jwatte,

Yep I fixed yesterday with >=. Actually in two places. The place where the motor number is incremented as to avoid the 360 degrees issue. Plus in the function I mentioned as to give me the right answer if two equal measurements. Then handled case where delta was zero as to not divide by zero... Could post current stuff if anyone is interested. Or I think I will do a little more stuff and probably convert the angles to eigher floating point, or 10ths of degree or radians to make consistent with ROS.

Also I think the sensor timings may be influenced by how much stuff I am outputting, so was thinking of maybe converting formats... Maybe binary, maybe multiple sensor outputs per message...

4. Relay
Join Date
Mar 2016
Posts
6
Rep Power
6

## Re: LIDAR-lite 360 Mirror Scanner

50.129.48.17/contact/images/LIDAR.mp4
[IMG]50.129.48.17/contact/images/output.gif[/IMG]

PS the most easy and effective method for improving data point accuracy was using a first-surface mirror, a mirror with the reflective surface on the front of the glass. I ordered one from a kaleidoscope company who specialize in high quality optical mirrors. Less than \$10. The way the PulsedLight LiDAR works is by splitting a laser beam into two beams with resulting wavelength A and wavelength B initially in phase. Then it emits each wavelength from a different lens, which are positioned at offset heights (You can observe this by looking at the physical LiDAR device and noticing how one lens is further recessed than the other). This gives the wavelength B from the recessed lens a further fixed distance to travel, meaning that when it is received back to the device, wavelength B will be offset by wavelength A by some amount. The device then compares received original wavelength A with received recessed wavelength B, and given the known lens offset distance and the offset of the wavelength phases, it is able to determine a distance. It works very similar to the famous Michealson-Morely experiment Other than the fact that that it is interesting, I share this because with a back-surface mirror, especially the thick mirror that you are using, there are cases of "ghosting" (See image). When the LIDAR device detects wavelength A and a "ghosted" wavelength B, it increases the measured offset and perceives and increased phase offset, which gives a much less accurate distance.

Michealson-Morely Experiment explained for those curious

5. ## Re: LIDAR-lite 360 Mirror Scanner

Hello!

Your project looks great! And the results are fantastic.

It looks like you were using the LIDAR-Lite V1.. have you tried the V2? What was the acquisition time in the sample gif you provided?

6. Relay
Join Date
Mar 2016
Posts
6
Rep Power
6

## Re: LIDAR-lite 360 Mirror Scanner

Thank you!

Oh yes, I should have provided some info for that scan. It took about 5 minutes to complete that scan, but that was using one of the slower scan algorithms I have been using for testing. The horizontal (theta) step size was 1/2 and the vertical (phi) step size was 1/2 as well. That scan was taken with the LIDAR v1, which has an acquisition time of about 66-70 pts per second. However, my rig is set up to run two v2s, which will increase my scan efficiency by roughly 2000%. Theoretically, this means that I could take a full 360 scan at 1/2 x 1/2 step resolution (roughly 127500 pts) in a little more than 2 minutes. I would love to use the new v2s, but robotshop has them on backorder, and I cant find them anywhere else. I'm excited for them to get new stock, because then I can realistically set the step size to 1/16 x 1/16 and take scans of 10 million points in 2 hours! It will be interesting.

7. Relay
Join Date
Mar 2016
Posts
6
Rep Power
6

## Re: LIDAR-lite 360 Mirror Scanner

I will go ahead and post this here, as well. If anyone here has a LIDAR-Lite v2 that they would allow me to purchase, I am pretty much desperate and would pay full market price for a used unit. I'm doing a presentation which looks at the efficiency of different scanning algorithms at Butler University's URC on April 8th, and they discontinued the v2, which I designed my entire project around. You can find more details in the post I made in the "Garage Sale" section. If you have a LIDAR-Lite v2, please e-mail me at CMorton737@gmail.com and we can try to work something out. Even if you don't want to part ways with it for good, I would be happy to 'rent' it from you. I'll even pay for shipping and offer a cash deposit until it is returned to you. I would be happy to mention you in my presentation and research paper, both of which will be published.

http://forums.trossenrobotics.com/sh...-at-high-price
Last edited by Squid737; 03-20-2016 at 01:49 PM.

There are currently 1 users browsing this thread. (0 members and 1 guests)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•