onsdag den 3. november 2010

NXT Programming lesson 7

Date: 3. November 2010
Duration of activity: 12.15 -15.00
Group members participating: Nikki & Knud


GOALS for lesson 7
To use the NXT to build and program Braitenberg vehicles as e.g. 1, 2a and 2b, Figure 1.

The concept of the braitenberg’s vehicles is a simple sort of wheeled robot with mounted sensors that sensitive to different stimuli. The sensors are wired directly to the motors that drives the wheel of the robot. It is assumed that the sensors generates a signal that is proportional to the stimulus. A simple example is the light sensor, if it reaches maximum light intensity then motors go full throttle, and if its completely dark the motors don’t run at all.

Eventual sub goals:
1:
Use Tom Dean's notes, [2,3], to understand the three vehicles and use his notes to implement the three vehicles. As sensors you might use e.g. a sound sensor in vehicle 1 to implement a vehicle that moves faster the louder the environment sound is. In the two other vehicles use e.g. light sensors. Is it possible to use two sound sensors in the vehicles 2a and 2b ?
2:
In the vehicles of Figure 1 all connections are marked with a +. This means the more of the measured quantity, e.g. light, the more motor power. Braitenberg also use connections marked with a - to mean an inhibition connection, the more the less. Implement this kind of connection and investigate the behaviour e.g. with two inhibition connections in vehicle 2b.
3:
Put a lamp on top of your vehicle with two light sensors and try to see what happens when several vehicles are put close together e.g. on a floor.
4:
In Tom Deans notes there is a single thread of control in which the two light sensors are sampled and the two power values are put out to the motors. Try to implement the vehicles with two threads of control, one thread for each connection.
5:
In Tom Deans description the variables MAX_LIGHT and MIN_LIGHT are updated over all the sample values obtained during the lifetime of the vehicle. If the vehicle is existing for a long time under different light conditions we might only want to collect these values over the last N samples. Make changes to your program so that this is possible.

Plan for building the robots:
Vehicle 1:
An idea might be to use a sound sensor on vehicle to implement a vehicle that moves faster the louder the environment sound is. A light sensor could also be used to make the vehicle drive faster depending on the light intensity.
Vehicle 2:
Could be made with 2 lightsensors or 2 sound sensor,
Vehicle 3:
Could be made 4 lightsensors, will make sharper turns because the light intensity on opposite motor.

Results:
The sensors do not seem to be completely linear with light intensity. Also the sensor output does not change much unless a flashlight is pointing directly in the sensor. This could be a issue with the dynamic range of the sensor. The robot cant really respond to differences in ambient light.

Vehicles 2a and 2b and 3 was made.
The big difference between vehicle 2 and 3 is that vehicle 3 will make bigger turns.
Picture of vehicle 3:






Code for vehicle 3:
while (!Button.ESCAPE.isPressed()){
           int left = leftLight.getLightValue();
           int right = rightLight.getLightValue();
           int L_Inhibitor = leftInhibitor.getLightValue();
           int R_Inhibitor = RightInhibitor.getLightValue();           

           Car.forward((right+40)-(L_Inhibitor-40), (left+40)-(R_Inhibitor-40));    
        
       } 
 
Source code:
http://www.liscom.dk/lego/Lab7Braitenberg/Braitenberg.java 
http://www.liscom.dk/lego/Lab7Braitenberg/Car.java 

Ingen kommentarer:

Send en kommentar