In this chapter, we will begin constructing a classic robot: the Line-follower robot. In the process, we will enhance our knowledge of LeJOS and put it through its paces. The creation of the robot will be divided into three parts, which will be covered in three chapters including this one. In this chapter, we will cover the following topics:
The Line-follower robot is a classic construction in the field of robotics that tests the robot's awareness of its environment and its ability to respond to it. A Line-follower robot is able to follow a path marked out on the floor (such as following the yellow brick road to visit the wonderful wizard of Oz).
You start by marking out the path on the floor for the robot to follow. The simplest means of achieving this is to use an electrical tape of a color that is easily distinguishable from the color of the floor (a high contrast makes the tape-floor boundary easy to detect). This immediately means that we will be using the color sensor to detect the path by determining whether the line is present at the robot's current position.
A number of variants exist for line-following, some of which allow the path to intersect with itself. We will focus on a simple variant with sharp corners/turns and no crossovers (where the path intersects with itself). Once we learn how to solve this, the other variants are easy to handle.
We start by clearly defining the behavior we wish to achieve. We will need to keep this in mind when we are programming the robot to ensure that it functions according to these specifications.
The following is the behavior required by the Line-follower robot:
18.221.245.196