Hey,
Not sure if this has been done before, but used the reflectance sensors as light (laser) sensors.
Slightly dark room works best but all things are tweakable.
Video:
Crappy code attached.
Thanks!
Jason
build_1.zip (80.2 KB)
Hey,
Not sure if this has been done before, but used the reflectance sensors as light (laser) sensors.
Slightly dark room works best but all things are tweakable.
Video:
Crappy code attached.
Thanks!
Jason
build_1.zip (80.2 KB)
Cool! Thanks for posting. That is something I have not seen before, so of course I have some questions: I see that you are using the IR_EMITTERS_OFF option to the read_line_sensors function…so what kind of range of values do you see with the green laser pointer? Did you check whether the sensors were more sensitive to a red one? Does the same robot, when there is no laser to follow, seek out the bright spots in a room?
-Paul
Paul,
Thanks for the feedback! I haven’t tested this idea using a red laser but I assume it would work fine. This is truly a physics question and I’m unsure if a different wavelength of light would produce better results. My green laser pointer has a wavelength of around 400nm and a red would be around 800nm, closer to the Infrared spectrum (so better?).
The time constant can be thought of as shutter speed. Longer time is equal to longer exposure so you could ‘in theory’ see the laser light farther away, but the problem arises when you have over-exposure and all details are lost. Because of this, the robot will go to a brighter spot on the floor if it is a point spot, ambient should be okay.
My code had no documentation, but the routines are quite simple:
get_fulcrum() --> Is a center of gravity calculation. Think of the five sensors equally spaced on a beam with a pivot. Each sensor get heavier as more light is detected thus get_fulcrum() simply determines where the pivot or fulcrum is located.
Things get messy but in the main loop I have a PI controller (based upon error from the center sensor).
Anyway, I would look forward to any updates, clean-up, tweaks to this code. The big issue with this first implementation is that the robot continually moves forward. It would be cool to make this more smart. Ideas?
Again, thanks to you Paul.
Jason
I don’t know about whether it is “truly a physics question” - it is more just a practical question of which kind of laser pointer has the best combination of brightness and ability to trigger the sensor. I am betting on red. I am actually surprised that the green one works at all.
It sounds difficult to teach the robot whether it should go forward or backward. Perhaps you could mount an additional QTR-1RC sensor on the back of the 3pi so that it could know when the light source in in the back? Otherwise, maybe you could keep track of whether the light seems to be getting dimmer as the robot drives forward, and if so, have it try turning around? That might get tricky if the laser spot is constantly moving around!
-Paul
It doesn’t have to be a laser at all, I tried using a LED flashlight and it worked fine!