VEX IQ distance sensor ...

We are investigating the distance sensor and find that we cannot determine when an object is at infinity. That is, we can detect when the sensor is some prescribed distance from an object, but if that object is removed or the sensor is rotated and finds free space beyond the range of the sensor, it does not return a meaningful value that we can test against. Generally, it returns the last value where the sensor received a valid return and not a much higher value (representing no valid return). Is there a status flag or some alternative way of detecting that the sensor is essentially in free space with no return echo? thank you - TeamTaylorRobotics (Friday Harbor Elementary School).

Which programming language are you guys using?

Sorry … we are using Flowol 4. I think in the real world this might not present a problem. We are doing experiments where this causes an issue. If the sensor is unobstructed such that it no longer receives a return echo, it continues to return the last valid distance and yields no indication that it has been moved and is now unobstructed. As soon as a return echo is once again received, the distance value is updated. That may not always be the case, where you rotate the robot after detecting a wall, and with nothing in front of the sensor, you cannot determine that there is no longer an obstacle since it continues to return the old value. suggestions? thank you

Ahhh, OK. Not tried this with Flowol yet but in RobotC or Modkit, a value of 26214 represents the infinite. Will check Flowol and report back…

Right - looks like Flowol can read a max of 250mm unless this can be changed in settings somewhere so you can consider 250 as no (or infinite) reading.
Tested with attached program.


thanks … when we run a similar loop the value of x maintains the last valid value (or something close) when we hold the sensor up into free space. I was desiring a high-limit value that indicated there was no echo return and that there was no object in front of the sensor. I’m wondering if there is a technical description on the distance sensor where I can determine if there is status available that might indicate that condition. thanks again.

calvc01 is correct. Flowol 4 uses a max distance of 250 cm and so the value should go to 250 when there are no object(s) in front of the distance sensor.

If your sensor isn’t behaving like this, first check the VEX IQ firmware using the Updater at this updates the firmware in the Brain. There was recently an update to the firmware in the Ultrasonic Distance sensor itself (make sure this is connected to the VEX IQ brain when updating the firmware and choose to ‘Update All Components’. From our testing, this update did make some improvements to the sensors when there are no objects in range.

If this doesn’t work, can you let me know which version of Flowol you’re using (see the Help -> About menu for the version number).

problem solved - when I execute the program on the VEX IQ it behaves as I would expect. Using it tethered to the PC and running Flowol 4, it does not update correctly in the interactive mode.
I appreciate everyone taking their time to assist us with this issue. - TeamTaylorRobotics (Friday Harbor Elementary School).

Glad it’s working for you when the program is downloaded.

The sensor value should also work correctly when displayed in the right-hand sensor panel, and when a flowchart is running tethered on the computer. When convenient can you update to the latest Flowol 4.17 and see if that solves the problem when tethered. Flowol version information can be found here:

Update - this problem only exists with the OS X version of Flowol 4. I tested the program with Windows 8.1 and it behaves (correctly) as expected.
I will share with my Roboteers what engineers have to do sometimes to find solutions. Thankfully, RobotMesh is very responsive and appreciative of feedback.