Experiments with an Infrared Range Finder

Jin Su Kim and Charles Ruhland

IR Sensor

Introduction and Goals

The Chiara robots are equipped with a Dynamixel AX-S1 Sensor Module, which is mounted on the head directly below the camera. The module provides left-, right-, and forward-facing infrared range finders. The goal of our project was to investigate the properties of these rangefinders and to implement robot behaviors for demonstrating those properties. Specifically, we devised a method for determining the distance to and orientation of walls in the field of view of the robot, and used that data to create a wall-avoidance behavior.

Approach

Initial investigation

The range finders operate in a very simple manner: they simply emit a ray of infrared light and measure the amount that returns. Thus each range finder outputs a single value, which Tekkotsu normalizes to a floating-point value between zero and one inclusive. A sensor value of zero indicates no reflection; a sensor value of one is not very useful as it means there is too much incoming light to be read accurately. In order for the range finders to be useful, we needed to establish a mapping between the properties of an object being measured and the values returned by the measuring sensor. Unfortunately, we soon learned this was not as simple as aiming a sensor at objects at various distances and recording the sensor value returned. Several factors could affect the sensor value:

Selecting a wall material

Wall candidates

As mentioned in Initial Investigation, object composition affects the performance of IR sensor. Materials we tested as a wall include:

After running a reasonable number of tests on different materials, we found out that the range within which IR sensor can detect something is the longest for White poster board. In other words, the texture and color of the poster board reflected the infrared light of the sensor better than any other material. For the purpose of our demo, "Wall-avoidance behavior", we have concluded that a white poster board is the most practical one not only because Chiara's IR sensor has the longest range for it but also it is easy to construct a simple maze with poster boards for demo later.

Establishing a distance benchmark

Measuring distance

Now that we had determined the material of the object to detect with the rangefinder, we were left with the problem of finding both the distance to and angle of a wall using just a single sensor value. Our solution was to record sensor values for an object at various distances from the rangefinder, but having a fixed angle relative to it.

A tape marked every 2 cm is placed straightforward from the center of Chiara's front IR sensor. We placed a white poster board at various distances (4cm - 72cm) oriented perpendicularly on the tape, and recorded the sensor value at each distance. We repeated this process several times and averaged the results.

Then we imported data into Matlab to figure out a function of values returned by IR sensor reading and distances from the sensor to a target. Using the curve fitting tool in Matlab, we ended up with approximately an inverse square relationship (shown below).

Distance graph fit

The inverse of the function shown above provides what we were looking for: given a sensor value v, return the distance d to the object observed (assuming the object is perpendicular to the infrared beam). This inverse is given by the formula:

Inverse formula

Where a = 34.26, b = -1.616, and c = -0.03016.

Determining wall distance and angle

Wall geometry Forward distance

With a function computing the distance to a perpendicular object given the infrared sensor value, we could use trigonometry and a robot behavior to compute the distance to an object at any angle. First, we added some code to the Lookout class in Tekkotsu that scans along an arbitrary line and returns a series of data points collected during the scan. Each data point contains the head pan and tilt angles, and the raw sensor value for the front IR sensor. We then wrote a behavior class that scanned horizontally in front of the robot, with about a 70° angle on either side of its body. The maximum sensor value was selected from the scan data, and its corresponding pan angle was assumed to be the angle the head must rotate to be perpendicular to the wall (since the maximum sensor value would occur in that position). Using this perpendicular angle, we could compute the distance to the wall if the infrared beam had been pointing straight ahead from the Chiara's point of view. See the diagram and equation for more information. Below are screenshots from the scanning behavior showing a computed distance result and a graph of the data points collected during the scan.

Wall scan info Scan data graph

Results

We were able to use the approach described above to implement a wall-detection behavior that demonstrates how we can determine both the distance to and angle of nearby walls. The robot travels in a straight line, alternating between walking and stopping to perform an IR scan in front of it. When it detects that it is too close to a wall, it rotates to be parallel to the wall, and then strafes until it is close to the wall, thus demonstrating that it has found both the distance and angle of the wall. Finally, it rotates so that it is perpendicular to and facing away from the wall; the behavior then starts over.

Demonstration video

Unexplored Ideas

We did not make use of the left or right IR sensors in our behavior. We did think of two behaviors that could make use of them, though. The first one would use the raw sensor values from the left and right IR sensors to allow the Chiara to gauge its distance from walls either side of it. The behavior would try to keep the sensor values within a certain range, so that the robot would follow walls but not get too close to them. The second behavior would use all three sensors to scan for walls around the robot, and use the distance and angle information to plot them in local shape space. It could use the same algorithm as the MapBuilder to merge duplicate instances of the same walls and to eliminate nonexistent walls.