mandag den 6. september 2010

Week 1 in LEGO Lab

Date: 2/9-2010
Duration of activity: 2 hours
Group members participating: Michael Vilhelmsen, Heine Stokholm

  • The goal for this first lab session, was to get familiar with the leJOS Java System, and use it to compile and upload a Java program to the NXT. And to build a robot of course!
  • The plan was simple: Build a robot, install leJOS on the NXT, upload a program, mess around with the light sensor, and finally study the memory usage of the NXT
  • The result were as follows:



    • We downloaded and installed leJOS without any complications.
    • We built a robot according to specifications. The result was a robot much like this one (except ours had claws!)


 

    • We uploaded the Java program found here
    • The program was executed from the NXT and the robot behaved as was expected - it followed a black line on the floor.
    • Then we studied how the light sensor used in constructing the robot works. The Java program had a feature that allowed us to read the light percent values that the light sensor registered. Using this, we made a table of the different values, and noticed the difference when the light sensor had it's diode turned on and off. The values can be seen below



    • Finally, we modified the Java program to display the memory usage of the NXT. We then introduced a small change to the way strings were output to the display, and saw how this changed the memory usage.
    • The conclusion is a 3 part one;
      • By studying the Java program, it was apparent how the robot was able to follow a black line. It was obvious why it had to be a black line, and it was (as expected) a very simplistic implementation. But we tested the robot several times, and it was quite capable of following the black line.
      • When we studied how the light senser worked, we saw that it measured the amount of light returned from the surface it was reading from. Thus it makes sense, that when it is reading from a black surface, the value is lower, since black absorbs most of the light (and thus reflects less). The values in the table are consistent with this conclusion. We saw that with the diode turned off, all values became lower, as would be expected. The only value that remained the same, was the sunlight (where we pointed the sensor at a window towards the sunny sky) which makes sense.
      • For the memory usage, we first saw how the NXT filled up it's memory, and then freed it all during garbage collection. The change we made to the Java program was to make the program use memory in an inefficient way, and we saw that the memory did indeed fill up faster.
    All in all this lab session was pretty easily done, and the results were hardly surprising to anyone.

    Ingen kommentarer:

    Send en kommentar