torsdag den 6. september 2007

Resistance is futile (Lesson 1)


The main goal for todays excersice is to get our lego robot (aka "The Borg") assembled and test that it is working according to specification. Furthermore we will make sure that we can compile, upload and run programs from the workstation. There are also a couple of small experiments which we will carry out with the LineFollower program.

The assembly of the robot was carried out swiftly, as most of it had already been done before this session. We did however experience some problems with installing the drivers and software needed on the workstation, and with uploading programs to our robot.

The problem turned out to be the fact that the drivers where installed in "Program Files" folder, which has a space in it. We reinstalled the drivers to a different location and got the first "Tune" program up and running. Whether it was a software bug or a human error that caused the robot to freeze up afterwards is unknown, but the problem was resolved by removing the battery and reinserting it.

After having "The Borg" come alive we then uploaded the LineFollower program and ran initial tests. It all ran as expected, and the robot was able to follow a (broad) black line by swaying left and right.
We noticed that the ligthsensor was not sensitive enough to read any notable light difference between black and white if the drawn line was thin. This is something to keep in mind when setting up courses for the robot in the future.


After the inital success we continued on to experiment with the robots "sense of color".
It turns out that the light sensor is able to destinguish between different colors, but it is a very minute destinction between most of them. What this means is that it would probably be hard to have the robot destinguish between different colors other than "light" and "dark" ones. Perhaps something inbetween could be possible as well, but the results would be dependent on the light coming from the environment and could vary alot.
The color table we were able to draw up looks as follows:
Color Light
Orange 59%
White 58%
Yellow 57%
Red 56%
Purple 43%
Black 37%
The experiments where carried out in the same spot by sliding different color papers under the lightsensor attatched to the robot. We tried to keep the incoming light the same on all tries to have a stable environment.

The next experient we carried out was to display the free memory on the heap while trying to see the difference between prining out a stored string variable and printing out a new string every time.
It turns out that printing out a string stored in a variable that is not canged saves alot of memory. The memory consumption while printing out the string literal "left" would increase gradually. This is because the program had to create a new string object every time and thus using the same amount of memory each time through the loop. If we instead printed the left variable out as is default for the program, the memory consumption would remain the same (and less) than for the other solution.
This is also something to keep in mind if memory consumption becomes an issue in the future.

Lastly we did an experiment where we altered the sample rate of the lightsensor.
It was obvious that if we had a very fast sample rate the robot was more responsive and would not sway very far from the line it was following.
If however the sample was increased to 1000ms it was possible for the robot to completely miss the black line of tape, by driving over it before the sample was taken.
Again it is a tradeoff between processing time vs precision and we suspect that it is something we will have to experiment quite a bit with for future projects.

This sums up the first day in the life of a Borg. Tune in next week for more life experiences

Project group:
Elvar Olafsson 20030582
Ebbe Flarup 20030592
Henrik Andersen 20030577

Ingen kommentarer:

Bidragydere