larseh created page: Lesson10Week14 authored by Lars Eriksen Høeg's avatar Lars Eriksen Høeg
......@@ -109,13 +109,61 @@ By investigating the odometry error model and compare it with real tests, it see
To reach some noise factors that could give a more accurate error modelling, we tried to adjust the model according to our investigation as well as creating more turns and a longer travel distance on the test track (Picture 7). We also tried to adjust the distanceNoiseFactor and angleNoiseFactor to, private float distanceNoiseFactor = 0.3f; //0.2f and private float angleNoiseFactor = 1; //4f, to minimize the extent of the error calculated by PilotMonitor.
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
![FullSizeRender (1)](http://gitlab.au.dk/uploads/u4099/legolabtimadala/b478c4bc2a/FullSizeRender__1_.jpg)
##### Picture 7: new track where we used the following code to complete the track: travel(50);rotate(-90);travel(29);rotate(90);travel(18);rotate(90);travel(36);.
We then ran 5 tests were the final position where almost the same every time: 5 cm below and 1.5-2 cm to the left(Picture 8). This could be a manual error when drawing the circuit on the blackboard, which is likely since the results are so much a like. Even though
that the extent of the error illustrated by the PilotMonitor-pogram was difficult to compare to our observations, due to a missing scale on the GUI, we believe that these variables corresponded well to the finishing position we observed after multiple runs.
![Untitled drawing](http://gitlab.au.dk/uploads/u4099/legolabtimadala/74df235885/Untitled_drawing.png)
##### Picture 8: Showing our results after 5 tests with new route.
## Position tracking while avoiding objects
In this exercise we investigate how we can track the position of a vehicle moving in a fixed route by means of travel and rotate steps while the vehicle avoids objects in front of it ? To do this, we mount an ultrasonic sensor in front of the vehicle to detect objects as suggested in the exercise assignment.
The legocar has same physical design as in the experiments described above.
A simple solution would be to use a sequantial loop if we know the position of the obstacle. Such a solution could be like this where we use a predetermined route[PilotAvoid]:
public void go()
{
LCD.clear();
Sound.beep();
while ( ! Button.ENTER.isDown()) Thread.yield();
Sound.twoBeeps();
LCD.drawInt(sonar.getDistance(), 2, 2);
pilot.travel(50, true);
while(pilot.isMoving()){
if(sonar.getDistance() < 10){
pilot.rotate(-90);
pilot.travel(20);
pilot.rotate(90);
pilot.travel(35);
pilot.rotate(90);
pilot.travel(20);
pilot.rotate(-90);
pilot.travel(15);
}
}
pilot.rotate(-90);
pilot.travel(29);
pilot.rotate(90);
pilot.travel(18);
pilot.rotate(90);
pilot.travel(36);
while ( ! Button.ENTER.isDown()) Thread.yield();
LCD.clear();
LCD.drawString("Closing",0,0);
}
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
## References
......
......