Duration of activity: 3 hours
Group members participating: Lukas, Daniela, Helene
Goals:
- Perform exercises from Lab Session 6
Plan:
- Rebuild the robot according to the Express-Bot instructions at the nxtprograms.com
- Do the vehicle 1 experiments:
- Mount the sound sensor.
- Program the robot to drive forward when it registers a loud sound.
- Program the robot to drive both forward and backward based on sound measurements.
- Do the vehicle 2 experiments:
- Replace the sound sensor with two light sensors
- Program the robort to drive towards og away from light.
- Do the vehicle 3 experiments (if enough time)
Results:
Vehicle 1:
We started by building the Express-Bot according to the following instructions: express-bot.pdf, and mounted the sound sensor as can be seen in the following picture:
We were asked to implement a vehicle that moves faster forward the louder the environment sound is. To do this we created a class called SoundFollower.
We decided to use the following normalization method presented in todays lecture to map the raw values to the interval [0,1]:
We started by defining the min value to 100 and the max value to 500 just to have some values we later could change to get at better behavior of the robot.
When we got at reading of the raw value from the sound sensor we used the normalization method to get a value we could use to adjust the motor power. This adjustments is done by adding a minPower with the differens between 100 and minPower multiplied with the normalized raw value:
(The complete source code can be found here: SoundFollower.java)
After making this program we uploaded it to the NXT, placed it on the floor close to another group who had some speakers playing music. We observed that the robot moved fast forward when the music was loud and slow down untill it stood still when the music weak.
Since this was the behavior we hoped for, we decided to move on to the next exercise to make the car drive both forward and backward depending on the measurements of the sound sensor.
To do this we added the following method, which uses the normalization method from above and afterwards maps the interval from [0,1] to [-1,1]:
The we changed code in the while loop to do different things depending on the result from the widen method is negative or positive. If the result is negative we take the absolute value of it and calclulate the power as before, but this time make the robot drive backwards. It the result is positive we do the exact same as before:
(The complete source code can be found here: SoundFollower2.jave)
When running this program on the NXT we observed that the robot keept driving backwards until a loud sound occured which made it drive a little forward and then start drive backward again when the sound was gone. We tried to change the variables: min and max, to make the robot more "eager" to drive forward. Our best result was when min was set to 0 and max to 200.
We talk about making the robot oscillate at a certain distance from a sound source, but we did not have a good sound source and had already used a lot of time on these experiments so we decided to move on and look at the experiments for vehicle 2.
-------------------------------------------------------------------------------------------------------------------------------
Vehicle 2:
We started by replacing the sound sensor with to light sensors. The setup can be seen in the videos below.
In these experiments we should implement a robot driving towards or away from light. We did this by using the two light sensors and the normalization method as described above. The big differens from the car that drove when registering a loud sound is that the car now have a light sensor determining the power for each motor:
(The complete source code can be found here: LightFollower.java)
When running this program on the NXT and using a mobilephone as a lightsource we observed that the car drove towards the light. If we switch the leftPower and rightPower we observed that the car now drove away from the light. This behavior can be seen in the following video:
After this we implemented that the robot when exposed to ambient light sound stand still but when the light increases (get brighter) should start moving towards the light. We did this by implementing an average for each light sensor, that registers how the light have changed over time. If the current normalized raw ligth value is bigger than the average then the car starts moving towards the light:
(The complete source code can be found here: LightFollower.java)
When running the program we opserved that the car moved when adding light but after a small amount of time it stoped untill we added more light. This behavior can be seen in the following video:
---------------------------------------------------------------------------------------------------------------------------------
Vehicle 3:
We did not have time to do experiments with this type of vehicle.
Conclusion
From these experiments we have learned how to make a direct mapping from the raw values measured by the sensors to the reaction of the actuators. We are doing this by normalizing the raw values and using this normalization to directly determine the power of a motor.
In the experiments where we had more sensors and actuators with one sensor dertermine the reaction of one actuator we observed that swithing which sensor gives information to which actuators makes the robot have different behavior, i.e. drive towards or away from the light.
We started by building the Express-Bot according to the following instructions: express-bot.pdf, and mounted the sound sensor as can be seen in the following picture:
We were asked to implement a vehicle that moves faster forward the louder the environment sound is. To do this we created a class called SoundFollower.
We decided to use the following normalization method presented in todays lecture to map the raw values to the interval [0,1]:
We started by defining the min value to 100 and the max value to 500 just to have some values we later could change to get at better behavior of the robot.
When we got at reading of the raw value from the sound sensor we used the normalization method to get a value we could use to adjust the motor power. This adjustments is done by adding a minPower with the differens between 100 and minPower multiplied with the normalized raw value:
(The complete source code can be found here: SoundFollower.java)
After making this program we uploaded it to the NXT, placed it on the floor close to another group who had some speakers playing music. We observed that the robot moved fast forward when the music was loud and slow down untill it stood still when the music weak.
Since this was the behavior we hoped for, we decided to move on to the next exercise to make the car drive both forward and backward depending on the measurements of the sound sensor.
To do this we added the following method, which uses the normalization method from above and afterwards maps the interval from [0,1] to [-1,1]:
The we changed code in the while loop to do different things depending on the result from the widen method is negative or positive. If the result is negative we take the absolute value of it and calclulate the power as before, but this time make the robot drive backwards. It the result is positive we do the exact same as before:
(The complete source code can be found here: SoundFollower2.jave)
When running this program on the NXT we observed that the robot keept driving backwards until a loud sound occured which made it drive a little forward and then start drive backward again when the sound was gone. We tried to change the variables: min and max, to make the robot more "eager" to drive forward. Our best result was when min was set to 0 and max to 200.
We talk about making the robot oscillate at a certain distance from a sound source, but we did not have a good sound source and had already used a lot of time on these experiments so we decided to move on and look at the experiments for vehicle 2.
-------------------------------------------------------------------------------------------------------------------------------
Vehicle 2:
We started by replacing the sound sensor with to light sensors. The setup can be seen in the videos below.
In these experiments we should implement a robot driving towards or away from light. We did this by using the two light sensors and the normalization method as described above. The big differens from the car that drove when registering a loud sound is that the car now have a light sensor determining the power for each motor:
(The complete source code can be found here: LightFollower.java)
When running this program on the NXT and using a mobilephone as a lightsource we observed that the car drove towards the light. If we switch the leftPower and rightPower we observed that the car now drove away from the light. This behavior can be seen in the following video:
After this we implemented that the robot when exposed to ambient light sound stand still but when the light increases (get brighter) should start moving towards the light. We did this by implementing an average for each light sensor, that registers how the light have changed over time. If the current normalized raw ligth value is bigger than the average then the car starts moving towards the light:
(The complete source code can be found here: LightFollower.java)
When running the program we opserved that the car moved when adding light but after a small amount of time it stoped untill we added more light. This behavior can be seen in the following video:
---------------------------------------------------------------------------------------------------------------------------------
Vehicle 3:
We did not have time to do experiments with this type of vehicle.
Conclusion
From these experiments we have learned how to make a direct mapping from the raw values measured by the sensors to the reaction of the actuators. We are doing this by normalizing the raw values and using this normalization to directly determine the power of a motor.
In the experiments where we had more sensors and actuators with one sensor dertermine the reaction of one actuator we observed that swithing which sensor gives information to which actuators makes the robot have different behavior, i.e. drive towards or away from the light.
References
- Exercises: lab6

No comments:
Post a Comment