Shop OBEX P1 Docs P2 Docs Learn Events
Cliff Sensors..... are there really good options? — Parallax Forums

Cliff Sensors..... are there really good options?

photomankcphotomankc Posts: 943
edited 2012-12-29 11:02 in Robotics
So I have been pondering ways to keep my patrolling robot from taking a destructive excursion down the staircase it is blissfully ignorant of at present. Problem is that I see a lot of difficulties in making something that is both practical for a bot that has to navigate around cluttered space and reliable enough to trust that it really wont go over the edge even in a case where it has wedged itself into a fairly sizable navigation challenge near a "cliff".

So there is physical sensors: Some type of spring loaded feeler that makes or breaks contact if the floor moves away more than a preset amount. This seems the most straight-forward and least likely to false trip but also I see lots of issues. Tile -> carpet transitions for some plunger might lead to getting hung up and the same with any of the ever changing array of challenging terrain features my daughter leaves lying around. Wire feelers out in front/back could handle that more gracefully but I still see issues with them getting snagged on everything around. Some type of ski-foot on the plunger could help with transitions and uneven locations but then I have to listen to that drag around everywhere. Then if a plunger goes down over the edge... well... how do you retract it?


IR Distance / Prox: I could use the same sensors I use as short range collision detection in the opposite role. Failure to trigger the module indicates the floor has dropped away. In practice I have found the prox sensors to be noisy and far from ideal. They often fail to see certain surfaces in the house and I have had to debounce them heavily to keep false triggering at bay. This means that my sample rate is somewhat slow on them. Getting them mounted far enough ahead to be sure the wheel can't roll off the edge on an angle may be touchy as well. Using the IR distance sensor style might work but has the same issues in that avoiding false spikes in distance would likely mean averaging/filtering and that takes time and the wheels are moving right along.


Sonar: Can't see a practical way to do it. Can't be aimed down at an angle. I have found that hard surfaces that are struck at oblique angles are all but invisible to my bots sensors. It has a very difficult time in the painted concrete walls of my office because of that. Sticking two out to stare straight down is ugly and would need to be done pretty high off the floor to deal with minimum distances. Then that's two more sensors that must allow for 'quiet' time to not interfere with the other sonars. I don't see that as practical at all.


Then I got to thinking from another angle. So why engineer a solution to operating in random 'cliff' environments (tables, benches, other houses, ect.) when the plan is to operate in MY house with that one staircase? Perhaps it would be better to simply use an IR 'fence' there to mark that spot as a no-go area and simply place IR receivers on the nose and tail of the bot to pick that up. Not as clever/flexible as some other designs but also solves the problem without even more of battery chewing IR blasters or snagging, dragging physical floor sensors.

Am I missing any really cool mobile technology to prevent my bot from pulling a Thelma - Louise moment? Anyone had good luck in a home environment with some particular type of cliff sensor?

Comments

  • Martin_HMartin_H Posts: 4,051
    edited 2012-12-26 07:54
    Indoors I think IR is a good option. I am trying this with PropTank and should have some results shortly. Outside I was contemplating sonar pointing straight down.

    I have another idea using capacitance based upon Theremin Vision. This was a product that sold a few years back, but no longer. Over in the Propeller forum I posted a video of a Propeller Theremin doing the same thing. I basically used a 555 timer with an antenna as a capacitor to control the frequency. When the ground falls away the oscillator changes its output frequency and the Propeller can measure it. Here's the thread :

    http://forums.parallax.com/showthread.php?143135-Propeller-Chip-and-555-timer-make-a-Theremin
  • RobotWorkshopRobotWorkshop Posts: 2,307
    edited 2012-12-26 08:36
    The Roomba uses IR sensors to help determine if it is getting close to and edge. It seems to work well. You may want to look at how that is implemented.
  • photomankcphotomankc Posts: 943
    edited 2012-12-26 08:37
    Well that's just awful cool! Never seen the the Theremin thing before.

    IR seems like a reasonable option but they are getting pricey for me in power. I guess I need some way to power down the IR subsystem if the bot isn't moving. The simple prox sensors are decent but they eat about ~5mA each. These would eat more since the little LED that indicates a prox detection would stay on all the time. I could remove that I suppose.
  • Martin_HMartin_H Posts: 4,051
    edited 2012-12-26 09:30
    I forgot about this project I did a year ago.

    It uses a line following module to follow an edge.
  • ZootZoot Posts: 2,227
    edited 2012-12-26 09:38
    I use IR sensors (but not remote emitter/detectors like for obstacle detection), rather I use integrated detector/emitter modules like those used on the QTI by Parallax. The results are excellent, even in sunlight conditions. It helps to shroud the emitter/detector package to prevent interference. The Roomba works identically as has been pointed out. If noise is a problem, that can be corrected with better power decoupling and in firmware. I should note that the same sensors can also be used for line following and grayscale detection (cliffs register as "black" way way off the scale -- much higher than even black tape -- so it's easy to distinguish between black and "cliff"). My tabletop line followers all use this method to avoid the edge of the table -- we do some layouts where the line they are following goes right to the edge of the table -- onlookers always start to grab for the 'bot when it goes right to the edge, then of course, it backs up and turns around.

    For some projects, I have used IR rangers (like the Sharps), mounted higher on the platform, and aiming down at about 45 degrees. This lets me use the ranger as BOTH a "low object" and a cliff detector -- if the range is too far, it's a cliff, if the range is too short, it's a low object. Basically, the range has to be in the sweet spot. This is also nice because it gets around the limitation of these rangers, wherein objects that are very very close (< 4cm or so) register as "very far". In that case, a "low object" may give a false positive as a "cliff" but never a false negative.

    There also the old trick from pre-electronic toys of having a gravity switch -- basically a wheel on a heavy wire that rolls on the floor, and falls further at an edge, either breaking/making contact to a switch. This might help with your concerns about a whisker tripping up on tile/carpet transitions and the like.
  • photomankcphotomankc Posts: 943
    edited 2012-12-26 10:40
    Ok, so IR seems pretty viable and it sounds like I need to look at something other than the digital prox sensors and maybe look more at the line following type stuff.

    I like the IR distance sensor too. I was contemplating that but had read cautions about them being at an angle but in this case the real issue is sudden changes in distance not accuracy of the distance reading.
  • Beginner4Beginner4 Posts: 8
    edited 2012-12-26 10:59
    Hello.
    I'm new here.
    I feel like an idiot asking this in the wrong place, but I have looked everywhere and couldn't find where to go to start a new thread.
    Any help?
  • Martin_HMartin_H Posts: 4,051
    edited 2012-12-26 11:33
    Beginner4 wrote: »
    Hello.
    I'm new here.
    I feel like an idiot asking this in the wrong place, but I have looked everywhere and couldn't find where to go to start a new thread.
    Any help?

    Hi, and welcome to the forum. When you are looking at the list of posts, click on the "+ Post New Thread" button in the upper left corner.
  • Beginner4Beginner4 Posts: 8
    edited 2012-12-26 11:46
    Thanks a lot!
    I don't know how I missed that.

    Good day.
  • ElectricAyeElectricAye Posts: 4,561
    edited 2012-12-26 12:31
    photomankc wrote: »
    ...
    IR seems like a reasonable option but they are getting pricey for me in power. ....

    Is there some way to run your IR systems in a kind of duty mode? In other words, instead of having them operating continuously on, could you have them turn on for a few milliseconds, take a reading, then turn off for a few milliseconds, then turn on, etc. at such a rate that your bot would still be safe from driving over the edge? Unless your bot is zipping around at high speeds, I would think you could save power by operating the IR only periodically. I think a 50 per cent duty mode would save you roughly 50 per cent power for the IR systems.
  • ZootZoot Posts: 2,227
    edited 2012-12-26 12:58
    If you are using modulated IR, then a 1ms burst 50 times a second or so to check for "obstacles" or "cliffs" is a good starting place. Of course, you chould calculate the maximum distance the platform might travel during one sample time and work back from there (i.e., if your platform can cover 10cm in 20ms, the above sample rate is too slow)

    For these purposes, I usually count "hits" during a 1ms emitter pulse and use a threshold (e.g., if the detector is sampled every 10us, I add up the number of samples during a 1ms emitter pulse; if the count is over 75% or so, it's definitely a "hit" -- this virtually guarantees no false positives nor negatives).

    At these ranges, you can certainly run the IR led at very low current anyway, so power shouldn't be too much of an issue. If you use rangers, they can be power hungry, but in theory you could turn power them on and off with a transistor and pin. I would think there would be settling time, however, when the device is first powered up so, not sure what kind of sampliing rate you'll get.
  • photomankcphotomankc Posts: 943
    edited 2012-12-26 13:39
    The bot has an intrinsically low duty cycle for movement. It's purpose is to patrol the house and watch for movement and alert if movement is detected where it shouldn't be. To accomplish that it moves to a new location and then sits still for several minutes to use it's passive IR sensors. What I need to do is power down the unneeded IR sensors until the next movement begins. The stairs are not going to sneak up on the robot while it's parked. I already have provisions to power down the steppers when idle so this could be accomplished in the same fashion I think. I just have to find a sensor that will deal well with the various types of dark/light tile, dark carpet, and so forth and be able to handle life right next to the noisy stepper motors.
  • lardomlardom Posts: 1,659
    edited 2012-12-26 21:19
    I'm also experimenting with IR distance detection and I'm trying to find out how to manage the noise. There are some good ideas presented in this thread.
  • Martin_HMartin_H Posts: 4,051
    edited 2012-12-27 20:19
    So I got my IR cliff sensors working and over in the project forum posted a video. I would say they're about 90% on the money, but that 10% can be a doozy. The tank went over the edge of the table four times, I caught it three times, but it hit the floor once.

    I think that light conditions can confuse the IR sensors so it fails to see the cliff. I've had a few false positives too, but they're not as much of a concern.
  • ercoerco Posts: 20,256
    edited 2012-12-27 20:47
    The wifey got me a cute wind-up toy robot with the ultimate cliff sensor, it has a sideways wheel near the front which quickly turns the robot when the very front wheel falls off the edge of the table (cliff) and lets the sideways wheel contact the ground. Will post a video when I get a minute.

    Edit: Uploading now...
  • Martin_HMartin_H Posts: 4,051
    edited 2012-12-28 07:30
    That's certainly goof proof. Scaling it up for something larger might be tricky.

    I think I have insight into how my edge detection fails. My motor driving code is running in one cog while the sensor code is running in another. I am using RC decay to measure the reading for four QTI like sensors. The darker the reflectance the longer the decay takes and I am doing it four times. On a dark side of the table it can take long enough that by the time the sensor cog realizes something is wrong the motor cog has sent the robot off the edge.

    If I slow the bot down a bit and only check the outside QTI's then I would have more time for the motor cog to react. Conversely I think edge sensors should be digital using a comparator which should be much faster.
  • ZootZoot Posts: 2,227
    edited 2012-12-28 11:14
    You can use an ADC instead of RC decay and get faster sampling times for the QTI like sensors. Just a thought.

    My experience is that a "cliff" will give you *very* long RC decay times -- when I use cliff detectors and RC decay, I generally choose an upper threshold for the RC time -- if the value exceeds that threshold, I treat it as a cliff and I terminate the state machine that is for the RC discharge (the state machine switches right back to charging up the cap for the next sampling cycle). I also choose R and C values that give very fast charge/discharge times. Not quite as accurate, but the thresholds are far enough apart that it doesn't matter, and the faster sampling is better -- for obvious reasons :).

    Second, I ususally have code do the calibration and I set healthy thresholds for white/gray/black/infinite (paper, surface, black line, cliff). The code prompts the user to move the 'bot to different positions to take readings (including the cliff, where I hang robot over the edge). These values are used for comparison when reading the values returned by the sensor. It takes all the guess work out, and if you are ever using your 'bot in a different environment, there are no worries about "will this still be a line", "will this be a cliff", etc.

    This is why I am not a fan of circuitry (nor code) that treats the sensor as purely digital -- you'd be surprised how much the threshold values can change from place to place. Especially the cliff -- I've found when using our demo table that the color of the floor, as well as the height to the floor, can influence what a "good" cliff reading is, so with firmware calibration, we can get good values painlessly at any time.

    Third, a shroud or something around the sensor is really good -- especially if you have flourescent lights or really high UV light (like we do here at 5500 feet).

    For others, I will offer one solution to a "trap" when testing cliff detection -- your instinct when testing will be to "catch" your 'bot from underneath if it might not stop at the edge of the surface. But your hands will fool the 'bot into thinking the surface continues, and it will just keep driving. Of course, you can catch it at that point, but it's not very test-worthy. The better method is to catch it from above, so you can see if the detection works but not let it crash to the floor. A string held in your hand and tied to the 'bot can be helpful too (like a safety harness). Foam padding or pillows on the floor around the test edge help also.
  • ercoerco Posts: 20,256
    edited 2012-12-28 12:47
    You could use a Sharp IR sensor looking downward either as a digital or analog sensor. Very insensitive to floor color/texture.

    http://forums.parallax.com/showthread.php?142485-Sharp-Analog-Sensor-as-Digital-Proximity-Sensor&highlight=sharp+sensor+digital
  • ZootZoot Posts: 2,227
    edited 2012-12-28 13:57
    Erco -- yeah, we discussed that in post #6. The same rangers can be used for low object detection and cliff detection. I prefer that approach myself, but only for larger 'bots... it's more certainly more expensive.
  • Martin_HMartin_H Posts: 4,051
    edited 2012-12-28 14:03
    One reason I switched to a tracked robot for this project was to get more leeway on a close call. When I did the edge following it was really easy to have a wheel slip off the edge on a close call, once that happened the rest of the bot followed. I had to space the sensors extra far apart so my wheels stayed away from the edge.

    With tracks I've had the nose go pretty far over and recover, as well as extend just off the edge and resist a lateral slide off the table. As a result I've been able to keep the sensors closer to the discussion bot.
  • ercoerco Posts: 20,256
    edited 2012-12-28 17:12
    Cliff Sensor himself remains elusive, but alternatives per http://www.intelius.com/results.php?ReportType=1&formname=name&qf=cliff&qmi=&qn=sensor&qcs=&focusfirst=1 :

    Clappier Sensor lived in Riverside CA, and

    Clod Sensor has lived in Seattle WA.
  • lardomlardom Posts: 1,659
    edited 2012-12-29 09:33
    This might not be worth much since I'm still learning but I think I have a way to test for ambient IR from sunlight or flourescent light. Don't laugh. I should be able to get a baseline if I place the emitter/reciever in a dark environment at a set distance from a reflective surface. I should then be able to test in normal light with a delay before the led is turned on and then subtract the difference.
    For cliff sensing the detector would remain on while the emitter takes samples intermittently. I'm going to guess the comparison between values would improve reliability.
  • ZootZoot Posts: 2,227
    edited 2012-12-29 09:39
    lardom -- Robotics with the Boe-bot includes an IR "sniffer" program for checking for UV interference on 38khz remote control IR detectors.

    My approach in firmware is usually to check for IR signal on the detector *before* emitting a pulse -- if there is other IR in the vicinity, the firmware waits until there's been about a 3ms blank period with no interference, then it emits the pulse (either to transmit comms to other 'bots or to do obstacle/cliff detection chores).
  • lardomlardom Posts: 1,659
    edited 2012-12-29 10:06
    @Zoot, The "...3ms blank period with no interference,..." is a great rule to follow.
  • ZootZoot Posts: 2,227
    edited 2012-12-29 10:22
    The 3ms is a bit arbitrary, but if covers for IR pulses from other 'bots as well as start and data bits for things like IR remotes. For 'bots that use the IR for obstacle/cliff detection, at a certain point the 'bot emits the pulse anyway, at risk of a false positive, which is better than false negatives or never trying for a pulse reading to begin with. For 'bots that use the IR just for comms, they may or may not attempt transmitting if there is interference.

    Of course, if you are getting consistent interference from high UV bright sunlight or fluoroescent bulbs, that's another story altogether...
  • lardomlardom Posts: 1,659
    edited 2012-12-29 11:02
    @Zoot,
    if you are getting consistent interference from high UV bright sunlight or fluoroescent bulbs, that's another story altogether...
    I considered a photoresistor/transistor facing up but later decided against it. At least a detector facing the floor provides a consistent distance.
    I browsed your site and noted that transmitting ir data bits would also help eliminate noise.
Sign In or Register to comment.