Wednesday, September 29, 2004

Line Follower robot, version 1

I built the LineFollower, using chapter 3 of the O'Reilly book referred to in the previous entry. Here's the first version of the line follower control program. The robot follows a dark line on a white background (e.g. the Lego testpad). If the leaves the line, it turns a bit to the right looking for it, and if this fails turns further to the left, then yet further to the right and so on. The decision about whether it is on the line uses some thresholds on the light sensor value, which may need to be changed for different conditions. It works better following a line which is curving to the right because of the search strategy, and sometimes it will get confused and turn right round. I have a short movie of it, but I'm short of web space, so if you want to see it, leave me a comment with your email address.

[Later note: another reason why the robot works better following a right curving line is that the motors appear unbalanced. With the sensor disabled, it tends to curve slightly right. Changing the power setting on the motors helps to fix this, e.g. 8 for motor A and 5 for motor C.]

The style of the program is rather cruddy. It's a very procedural approach. For the next step, I aim to rewrite it using some of the more advanced APIs in LeJos.

1 comment:

Anonymous said...
This comment has been removed by a blog administrator.