Thursday, September 2, 2010

Lab Exercise 1

Date:
2/9 2010

Duration of activity:
4 hours

Group members participating:
Lasse, Frederik & Christian

Goals:
  • Get the leJOS software running on own PCs
  • Be able to compile and upload a line follower program to the NXT brick
  • Build a Lego car equippeded with two motors and a light sensor
  • Do experiments with the light sensor
Plan:
First install the (USB) drivers provided by Lego and then the leJOS drivers in order to make sure the USB drivers will work.
Experiments with the light sensor will be done by using different colored Lego bricks.

Results:
We tried to install the leJOS plugin for NetBeans because it is our favourite java editor. After we'd been trying for about 2 hours we decided to install Eclipse and the matching plugin. We managed to get it installed after having some trouble installing it via URL. The solution was to uncheck the "Group items by category"-checkbox to be able to see the plugin and download it.
After setting the paths for the leJOS installation we were able to compile and upload programs to the NXT brick!

Afterwards we wanted to be able to compile and upload programs from another PC by following the same procedure. We ran into an error saying "Something went wrong" when trying to upload and we found out that the problem had to do with the "Java Build Path" in Eclipse. It turns out the "classes.jar" file must not be built as the last item - by moving it up on the list we managed to get it working.

There were no problems building the Lego car because a building instruction were provided in the Lego Mindstorms Edication Set.

We performed a series of readings from the light sensor on different colors. The different colors was from lego-bricks to get the same type of surface for all readings. The light sensor has a flood light which makes the sensor measure the reflected light from the surface. We measured with flood light (A), without flood light (B) and without flood light while blocking the ambient light (C).



Conclusion
We managed to get two PC's running with the leJOS software, installed the leJOS Eclipse plugin and was able to compile and upload programs.

The readings from the light sensor concludes that the light sensor is able to distinguish between black and white. Other colors are between these values and therefore harder to tell apart. The usage of the flood light ensures more consistent data in diferent lit environments. When not using the flood light the whole range of colors are affected by an offset depending on the ambient light which may compromise the sensor readings.

References
The instruction used for the Eclipse plugin (doesn't describe the solutions to the problems we had):
http://lejos.sourceforge.net/nxt/nxj/tutorial/Preliminaries/UsingEclipse.htm#7