Thursday, October 9, 2008

Robot Race

In this lab we continued our work with the line follower and the Color sensor class from last lab.
Our robot should compete against the other robots time to follow a line from a marked start point to a marked end zone.

Reconstruction of the robot
To make the robot fast we build in a chain with a big gear at the motor and a medium gear at the wheels. This can be seen at the picture below:

We also added 2 extra light sensors in the front to make the control system more accurate. The sensors was put into a pattern as shown on the figure below(sensors marked as red dots):

This pattern was chosen, so the robot would bee able to differentiate a straight line, a soft turn and a hard turn.

Changing the code
Our code is build on the original line follower code, but to take advantage of the changes of the robot physics we have to change the code too.

Fist of all we want to have all 3 sensors added. Because the 2 new sensors is the old type of light sensors, we had to make a driver class for for these. That was done by copying the color sensor driver and then change the calls to the sensor.
The disadvantage by using these drivers was that we had to calibrate them each time we restarted the program.

Theoretical control
From the physics of the sensor pattern we made the following table with the input sensors and the action to be done.
(0 = black, 1 = white)

The slow and fast turns is made by decreasing the speed of the wheel on that side the car should turn to. The levels where the speed decrease to is set in the program.

Practical test
Before the robot followed the line first time we had a lot of debugging going on. As part of this debugging the stop-conditions in the table above, was change to continue doing what you did before.

Some of the results are listed in this table(time in seconds):
There are made experiments with full speed at 100 and slow different from 0 but they all failed.

As described in the table, was the robot rebuild a little during the experiments. But it was only the distance between the left and right sensor which was adjusted. The one with the better result(closer sensors) is shown in this picture:

It was also tried with a larger distance between the sensors, but it made the robot fail.

Making the robot stop at the end zone and measuring the time worked in the first try.

The time we achieved was not impressive - other groups achieving times around 20 seconds.
Some of the reason for this is that we have used a lot of time on things that din't have the advantage that we hoped.
The robot was reacting too slow to changes(updating too slow from the sensors), so it was not possible to drive the robot at full speed - and thereby not possible take full advantages of the gear.

The table describing the actions from the different sensor inputs was neither as useful as hoped. The difference between a slow turn and a fast turn was minor, so there were almost no advantage from that either.

No comments: