Odometry or Sensors?

Navigation is an important part of robot movement. There are two main methods for determining how to move a robot: Odometry or use of Sensors. These two methods require very different techniques.


Odometry is the movement of the robot for specific distances as measured by the rotation sensors and algorithms that incorporate the wheel base, diameter, and distances to be traveled. While this may seem to be a very accurate method of moving the robot, there are several inherent problems including inaccuracies of the rotation sensor, slippage of the wheels or treads, variations in the performance of the motor controllers from differences in power levels. Though Odometry has some issues that reduce its effectiveness, it is useful for short movements that do not involve a lot of turns. How many turns is a lot? Well, if you have to make two or more turns to get from point A to point B, then you may have trouble if you rely solely on Odometry.

Navigation by Sensors

Navigating the robot by use of sensors may enable you to move the robot accurately for longer distances.

Some common techniques for navigation by sensors include:

Navigation by use of sensors requires some additional programming techniques to make it work. Often you will create/use loops and wait functions to make the robot do something until the sensor detects a critical event. When the event is detected, then the robot will go onto the next steps in the program.

Position of the Ultrasonic Sensor

Sometimes it may be useful to measure the distance to various objects and walls. This can easily be measured using the Ultrasonic Sensor. But how and where do you position the sensor onto the robot? Make sure the sensor is pointing straight (i.e., not at an angle) usually from the front of the robot. The sensor can tell the robot how far it can move forward before running into an object. Some of the objects that you may be sensing are not very tall. Therefore, you may want to locate the sensor on a lower part of the robot frame/chassis.

About the Light Sensor

Light sensors measure one of two things: Reflected light or Ambient Light. In measuring "reflected light", the lightsensor will emit a beam of light outward from the sensor (usually onto the game board mat) and then measure the amount of light reflected back from the surface. The "reflected light" mode of operation works well for enabling the robot to "see" lines printed onto the game board mat. The beam of light emited by the light sensor is usually round in shape and red in color. The beam is emitted from a small led mounted at the housing of the sensor. The beam expands from the sensor so that the red circle of light shown on the mat will grow or shrink depending on the distance between the mat and the sensor. In the Ambient Light mode, the sensor will measure the amount of light that is detected coming into the light sensor. The Ambient light mode is seldom used in FLL robotics tournaments. So, for the rest of our discussions of light sensors, we will be referring to light sensors in the "reflected light" mode.

Position of the Light Sensor


Light sensors need to be close enough to the surface so that an adequate amount of light will be reflected back. However, the sensor should not be so close as to reduce its ability to detect variations between the light and dark parts of the game board mat. For example, in following a line using one light sensor, the robot will be programmed to follow the edge of the line. For optimal performance in line following, the beam emitted by the light sensor will fall half on the line and half on the white part that forms the background of the mat. If the sensor is too close to the mat, then there will be fewer variations of light between "on the line" and "off of the line".

Position in relation to the wheels

For line following, generally the light sensor needs to be toward the front of the robot. This enables the robot to use the light sensor to "lead" it along the line. In other words, the light sensor is like a forward scout that tells the robot what is happening ahead of the robot's current position.

If the sensor were placed in the back of the robot, then the robot would already have moved past a turn before the sensor would detect it. By placing the light sensor at the front of the robot (or even slightly ahead of the robot) the sensor can detect an approaching turn "before" it's too late and give the robot enough time to begin adjusting its position in relation to the line.

So how far forward should the light sensor(s) be positioned? This depends on your robot design and what kinds of lines will be encountered by the robot. For example, how sharp are the turns in the lines? Are there any turns in the lines? How big are the wheels on the robot? Are there gears used to increase or decrease the speed of the motors? These sort of factors may alter how much the speed of the motors has to be adjusted to move the light sensor left or right of the edge of the line. If the sensor is too far ahead of the wheels then very minor adjustments to the speed of the motors may have large swings in the position of the light sensor(s). I try to place the light sensors within an inch or two forward of the position of the drive wheels.


Light sensors are one of the few sensors that need to be calibrated for most effective use. Calibration is a process that, once performed, enables the sensor to output values on a scale that has been standardized though the calibration process.

Light sensors can output two types of values:

  1. Raw values (from 0 to 1000)
  2. If using the graphic programming languages of NXT-G or EV3: Scaled values (from 0 to 100). If you are using RobotC as the programming language, you will need to create your own calibration function.
The purpose of calibration is to enable you to develop a program that expects the light sensor to output specific values based on what the sensor is looking at. In general, if the light sensor is pointing at a white surface of the mat, then the value output should be 100. If the light sensor is pointing at a thick black line on the mat, then the value output by the sensor should be 0. In other words, the value represents the amount of “white” that the sensor detects on the mat. Values in between 0 and 100 would represent portions (or fractions) of the line detected by the sensor. If the light sensor is directly over the edge of the line with half of the sensor detecting the line and the other half still detecting the white background, then the value output by the sensor should be 50 (which is half way between 0 and 100).

If you are trying to follow the edge of a line, then your goal would be to move the robot so that the light sensor value stays at around 50.

Shielded or Unshielded

Light sensors are sensitive to the environment in which they are operating. An unshielded sensor is affected by the ambient light from the environment. For this reason, if the sensor is unshielded, you will need to re-calibrate the sensor each time the environment changes (i.e., from practice room to tournament hall and from practice table to tournament table). If you are at a tournament or a week before the tournament, you should modify the program to perform an automatic process to re-calibrate the sensor prior to running the main (or first) program.

One thing that may significantly help the sensor is to “shield” it from ambient light. Basically you will construct a small box that will serve as a shroud around the sensor. This doesn’t have to be very big. It just has to seal the gap between the sensor and the mat. The shield (or shroud) should lightly touch the mat (or at least come within 1 millimeter of it). The shield may make it harder to write programs since it may be more difficult to determine if the sensor is in fact “on”. For this reason, I would recommend developing the program without the shield. Then once you get close to the tournament date, you should install the shield to reduce the effects that various lighting conditions of the tournament may have on the sensor.

One or Two Light Sensors?

Most line following programs are written to use one light sensor. But it is possible to use two light sensors to follow one line. Also, some teams may use light sensors located on different parts of the robot to enable line following in different directions or with lines that are on different sides of the robot.

Position of the Touch Sensor

Touch sensors can serve many useful purposes. They can detect the position of walls, position of mission models, and be used as switches to start or control the program. When placed on the front or back bumpers, these sensors can tell the robot when it has crashed into a wall (going forward or backward). If located on the side of the robot, these sensors can help the robot to know when or if it is in contact with a side wall. When mounted on the top, these sensors can be used by the programmer as a switch to start, stop, or control the program.

Feeling the Wall

Feeling Objects in the Environment

When to use the Color Sensor

The surface of the typical FLL Game Board Mat will have a variety of color images. However, the lines for following are usually just black with a white background. Some mission models may be colored and may be detected by the color sensor. Please note that the color sensor operates slightly differently than the light sensor. Where the light sensor detects the amount of light (reflected or ambient), the color sensor will detect specific colors (red, green, blue, yellow, orange, purple, white, black). As the detector is determining what color it is seeing, there may be some false readings.