Reliable input from distance sensors

Hello,

We are tying to use ultrasonic distance sensors on our robot. We have a sharp 57 2y0a710 and a MB1200 XL-MaxSonar®-EZ0™, we are able to get the output, but it is not accurate. Does anyone know how to get reliable output?

Thanks!

Ultrasonic and IR aren’t great in the first place. What’s the sort of accuracy you’re experiencing?

The Garmin LIDAR Lite V3 is way more expensive at $150 and either in pulse (they call it PWM) or I2C mode you may have some problems implementing it before you actually need it at this point.

By implementation issues there are some topics on ChiefDelphi right now about I2C issues from late January 2017. Some of those may be addressed by more recent updates.

In pulse (PWM) mode there WPILib counters don’t say much resolution details about measuring the 10uS/cm pulse timing.

I’ve got one here on an Arduino in pulse mode.
It’s a big difference from the sonar sensors.

However, from what I see, it’s much more consistent even over the 50ft.
Unless you block the laser I rarely see major bouncing in the measurements.

So while you might get a measurement that’s not quite the right distance in centimeters I’ve been playing with it and the repeat-ability is high.

Inexpensive range finders are sometimes far more repeatable for a given sensor than across individual sensors, even in the same batch. When we did some testing on a Sharp rangefinder a few years ago, we found 5-10% variation among sensors but 1-2% repeatability for each sensor. We worked up individual calibration curves for each sensor. We labeled the sensors and put all of the curves in the robot file, as well as which specific sensor we had installed on each side (we had one left, one right). This makes it easy to swap out sensors if needed.

The counters have 25ns resolution.

Thanks, where did you find that information?
I’ve looked a few times without success.

https://www.chiefdelphi.com/forums/archive/index.php/t-142983.html
That’s the closest I got but that measurement of 25ns seems to be related to the internals of the FPGA not the entire system.

Even if you can get to 1us pulses (let’s say you can read up to 5,000,000 edges from an encoder that’s good for 0.2us): if this is correct one should be able to measure the period of the pulses when using the LIDAR Lite V3 in pulse (PWM) mode using the RoboRIO.

We never got quite that far playing with the sensor and I wasn’t able to find any examples floating around.

I do note that the current link for the specifications that topic referenced above uses now says 20ns.

"Minimum pulse width 20 ns "

I note from the topic I linked, as well, that software had an impact on the capacity of the final poster to achieve the high rate of measure which raises the question if this is tracked as a metric from version to version of the RoboRIO software.

I just remember it from a conversation with some NI guys from a couple Champs ago. The WPIlib counter just wraps the FPGA counter object, which timestamps edges with a 40MHz clock. No idea how that relates to the 20ns “minimum pulse width” - perhaps that’s the cutoff on an analog low-pass filter on the circuitry that generates edge events?

We have two ultrasonic sensors on each side of our robots gear and we average the distances between the two.