Duration of activity: 8 Hrs
Group members participating: Alexander Rasmussen and Søren Ditlev
Vehicle 1
Goal:
Make a system according to Tom Dean's notes[1][2]. Attach a sound sensor and try different mapping between the sound and the system motors.
Plan:
Use the Car.java and SoundDriver.java classes to create a system that uses the sound sensor values to send power to the motors. Try Different mapping between the sound sensor and the motors:
- Percentage
- Low sound values as negative motor power
- Inhibitory
The to make the system drive backwards on low sounds we used the the percentage to determine when the system should drive forward or backwards. Sound percentage under 50% would make the system drive backwards. We mapped so that Sound values lower than 50 would be subtracted from a max motor power of 100. This means that the lower the sound the faster the system will drive backwards
Results:
Picture of Sound Sensor System
|
We modified it with bigger wheel to look cooler, and get rid of the cog-wheels in the back
|
Video of fLow sound values as negative motor power system[3]
Algorithm which uses the sound level to go either forwards or backwards:
int goVar = 10;
while (go) {
soundlevel = sound.readValue();
motorPower = soundlevel;
LCD.drawString("Soundlevel " + soundlevel, 0, 0);
if(soundlevel > 50){
motorPower = soundlevel + goVar;
Car.forward(motorPower, motorPower);
}else{
motorPower = (100 - soundlevel) + goVar;
Car.backward(motorPower, motorPower);
}
}
Conclusion:
Motors need a minimum value of 40 in order to turn on the motors and minimum value of 60 in order to move the system. Therefore it needs a high continuous sound to drive straight forwards.A goVar value was added to the system code which multiples sound sensor values and makes the system go faster at lower sound values. We observed that other groups had a problem where the system’s motors made enough noise to make the system going once it was started, however we did not experience that problem.
Vehicle 2
Goal:
Make a system that uses values from two light sensors to power the motors.
Plan:
Use the Car.java and a modified version of the SoundDriver.java (which uses light instead of sound sensors) to program the system. Place two light sensors in approximate 100 degree angle to each other in the front of the system, so that have the possibility to detect different light values from each sensor.Try different mappings between light sensor and motor power and observe how the system behaves.
Results:
Picture of Light Sensor System
|
Video of light sensor system[5]
The code works by setting the measured light value as the power to the motor. Because the motor needs a certain amount of power to drive the wheels, we have implemented a variable goVar that we multiply with the light value to make the robot move. This variable is adjusted accordingly to the ambient light of the environment.
Algorithm which uses light sensor to follow light:
float goVar = 1.9f;
while (go) {
rightLight = lightRight.getLightValue() * goVar;
leftLight = lightLeft.getLightValue() * goVar;
Car.forward((int)leftLight, (int)rightLight);
LCD.drawString("LightLeft " + leftLight, 0, 0);
LCD.drawString("LightRight " + rightLight, 0, 1);
}
Conclusion:
We tried to do a light following system that would follow another system with lamp mounted in the back, in a dark room. However we had a problem getting the first system moving, so the second system would bump into the first. If we tried to introduce an alternative light source into the environment both systems would follow the light source. A way to make the experiment work would be to have one system leading at steady pace and use Ultrasonic sensors to avoid driving into the wall. The second system should follow a light source on the first and have inhibition to is motor power, so once the light value would get too high the system would slow down to avoid bumping into the system in front.
Vehicle 3
Goal:
Combine light and ultrasonic sensors to make a party finder robot.
Plan:
we plan to use the ultrasonic and light sensor as we did in the first partyfinder in exercise 3[4]. We will make the system go towards light but avoid obstacles on its way by letting light values give positive motor power and Ultrasonic value give negative motor power.
Results:
Light and ultrasonic system
|
Video of party finder[6]
The code is implemented by letting the light value work as an exitatory connection and the sonars as an inhibitory connection. To tweak the values from the sensors according to the motor power, we have implemented variables that is added to the light value, and a variable which divides the distance.
Code Of While Loop:
float leftVar = 2.0f;
float rightVar = 2.0f;
while (go) {
int distanceRight = rightSonic.getDistance();
int distanceLeft = leftSonic.getDistance();
float rightLight = lightRight.getLightValue() * rightVar;
float leftLight = lightLeft.getLightValue() * leftVar;
float motorRight = rightLight - ((255 - distanceLeft)/3);
float motorLeft = leftLight - ((255 - distanceRight)/3);
Car.forward((int)motorLeft, (int)motorRight);
leftVar = 2.0f;
rightVar = 2.0f;
}
In order to get the system to work correctly it is important to tweak the light and US to send the appropriate values to the motor. We found, by logic, trial and error, that by dividing the US by 3 and multiplying the light value by 2 the
Conclusion:
The Party finder worked very well. It was able to navigate towards the light and use the Ultrasonic sensors to avoid objects. However we noticed a few flaws. If the system drive into a corner it will detect negative values on both US sensors and stop. This problem can be solved by programming clause that detects when motor power of both motors is lower then 50 and then make the system back and turn using tacho counters. Furthermore the system have a problem of detecting small object directly in front of it( ei. a leg of chair) because such objects are so small that they does not provide enough shade for the light sensor to detect and is slim enough to be placed between the US sensors field of Vision.
References:
[1], Tom Dean, Introduction to Machina Speculatrix and Braitenberg Vehicles