[Shane Ormonde] recently learned how to measure distance using just a webcam, a laser, and everyone’s favorite math — trigonometry. Since then he’s thrown the device onto a stepper motor, and now has a clever 2D room mapping machine.
He learned how to create the webcam laser range finder from [Todd Danko], a project we featured 7 years ago! It’s a pretty simple concept. The camera and laser are placed parallel to each other at a known distance, axis-to-axis. On the computer, a python script (using the OpenCV library) searches the image for the brightest point (the laser). The closer the brightest point is to the center of the image, the farther the object. Counting pixels from the center of the image to the laser point allows you to calculate an angle, which can then be used to calculate the distance to the object — of course, this needs to be calibrated to be at all accurate. [Shane] does a great job explaining all of this in one of his past posts, building the webcam laser rangefinder.
From there it was just a matter of slapping the rangefinder onto a stepper motor, driving it with a small PIC, and running the calculations on the fly! His results are fairly impressive.
You could add a dispersion lens to increase the dot size, this might yield greater resolution.
We’re all watching the red dot travelling along a wall in the dark. Congratulations Sir ! I am now officially a Cat !
Made my day :D
Try replacing the laser pointer optics with line optics (or use a cheap laser level tool from economy hardware store). This will make a vertical line instead of a dot.
Now you can use your code to check all the pixels in an entire vertical stripe instead of a single dot. and get a lot more vertical res.
For fun and entertainment – the IR filter on your webcam could be removed but you could add a green laser instead – also shot through same optics (or directly adjacent to red line, or in same position but switched on and off on alternate frame times).
Or a blue laser or whatever – the point being that surfaces that don’t reflect red well might reflect another colour better.
Great work. and in Python too. Yay Python !
Thanks a lot man! Good ideas. I’ll definitely try out a vertical line instead of a dot when I get a chance.
To get a line, shine the laser through a glass or plastic rod. For a quick test, use the stem of a wine glass.
One step closer to those little balls in Prometheus that map out the caves.
The next step should be a script for Sketchup that builds the room from the data.
Using Sketchup is a great idea! Could mount it on a robot and map out buildings, like in Prometheus but less cool
There’s a bunch of n-Copters and wheeled vehicles that do this task. Sebastian Thrun made an ATV that maps derelict mines. the Simultaneous Location And Mapping(SLAM) problem has quite a following and decent funding as of late.
Check this video out of a quadcopter performing SLAM:
http://www.youtube.com/watch?v=-nhHfuQ5L0A
I did this with a atxmega and TSL1401-DB Linescan Camera Module. I’ve gotten over 500 measurements per second. The limiting factor is the scanners light sensitivity.
I have always had this idea of some type of system that simply senses its surroundings. Have you ever noticed that you can feel when something is behind you? Even things you can’t see, you have a sense (as inaccurate as it is) of your surroundings. If you walk in the dark, you can sense that you are coming upon a wall. Or when someone is standing behind you suddenly.
The effect I think is changes in air pressure. Like the Archimede’s principle. Air is a fluid, and anything within it will displace it which creates a directional force. I believe we can sense this pressure change on our skin.
I haven’t quite figured out how to build something like this, but in my head I forsee something similar to an arrangement of speakers used as microphones. Obviously that should be able to sense pressure changes due to a disturbance in the fluid air, but if the measurement device is stationary and the objects in the room are stationary, it seems like it would measure nothing.
Don’t laugh, but I’ve always named it acoustical mass displacement sensing.
Any thoughts on this?
Incomplete thought. In order to sense things, one of the parts in the system will have to move. I wonder if simply vibrating the sensing instrument (and then filtering that vibration out) would be enough.
reading the comments made me laugh a bit, not at any of the ideas but the outcome and possible news headlines…
“NSA caught snooping on building mapping robots”
It’d be cooler if he used a laser and a shark.
Start with one of these.
https://www.youtube.com/watch?v=JSkvW2uO0DI
I’d like to point out another cool hack in this picture: The use of zip ties and metal scrap to prevent a pair of helping hands from tipping over. Why didn’t I think of that?
Agreed! It’s the little things that make all the difference. My magic hands, before and after:
Very cool!
And good idea with the verical line,eventualy,you may end up with the kinect:-)
Reblogged this on ad hocumentation • n. fast, instinctive documentation of ideas and solutions. and commented:
Shane Ormonde, from DIT programme DT009, also recently featured on hackaday.com. His project is a lovely adaptation of a webcam laser range finder (originally by Todd Danko) to scan and map the shape of a room. It’s an ingenious piece of work – I hope to try this out myself soon!