torsdag den 2. september 2010

NXT Programming lesson 1

Lesson 1 description 
Date: 2 september 2010
Duration of activity: 14.15 - 17
Group members participating: Nikki & Knud


GOALS for lesson 1
  1. To build LEGO Mindstorms Education NXT Base set 9797 lego car
  2. Installation of the Lejos Java system (lejos for eclipse + USB driver)
  3. Compile, upload and test Java control program LineFollower.java to make the car follow a black line on a white surface (http://www.legolab.daimi.au.dk/DigitalControl.dir/NXT/Lesson1.dir/LineFollower.java )
The process of achieving the goals:
1.
The NXT base 9797 lego car was built from the lego user manual. Our received lego set lacked alot of the blocks needed to built the car so we spent alot of extra time looking for those blocks.

2.
leJOS for eclipse was downloaded from http://lejos.sourceforge.net/nxj-downloads.php
and installed using the guide provided on lejos homepage
http://lejos.sourceforge.net/nxt/nxj/tutorial/Preliminaries/UsingEclipse.htm
it quickly clear that the NXJ plugin didnt work so the guide couldnt be followed step by step.

We googled and found various forum where it was obvious that a lot of people had problems with getting the plugin to work.

We tested if it was possible to compile a project (for example the hello world) in the command prompt. In order to do that the following to Path system environment variable
Path C:\programmer\leJOS NXJ\bin

In order to build ant and compile that way in eclipse the following system environment variables was added:
JAVA_HOME C:\programmer\Java\jdk1. 6. 0_21\
NXJ_HOME C:\programmer\leJOS NXJ

In eclipse the ant file of the respective project in question is build from right clicking on build.xml and selecting Run as -> ant build

For a long time there was problem with the linker, that was because we didnt reboot after setting the variables.

The usb driver (Fantom driver) was downloaded from
http://mindstorms.lego.com/en-us/support/files/Driver.aspx

3.
We carried out some tests

Test 1:
"Try to place the light sensor above different colors and make a table of light values corresponding to the different colors. Use the light percent values for black and white to explain how the threshold value could be obtained from a reading above black and white."

Results:

Yellow: 60
Red: 54
Blue: 36
Green: 49

black: 35
white: 57

Conclusion:
A reasonable threshold would be a middle value between the two values in question

Test 2:
"The light sensor is used with the red LED turned on light.setFloodlight(true). This means that the sensor measures the reflection of the red LED. Try to turn the LED off and notice the differens in measurements obtained by making a similar table of readings above different colors. With the LED turned off the ambient light level is measured. This is e.g. usefull in day/night detection."

Results:
green: 37
blue: 25
red: 28
yellow: 38

Conclusion:
The colors now them self doesnt give a huge spreading compared to before, its now more dependent from the ambient light. So shadowing the sensor changed the values even more.

Test 3:
"In the program a delay of 100 msec is used between light sensor readings. We call this the sample interval. Try with a sample interval of 10 msec, 500 msec and 1000 msec. Explain what happends."

Conclusion:
The robot becomes slower at responding, which results in bigger turns and slower "oscillation" frequency as the delay increases.

Ingen kommentarer:

Send en kommentar