... | ... | @@ -257,15 +257,59 @@ In comparison to a real life scenario you could argue that most people occupies |
|
|
### Implementation:
|
|
|
We used the class PilotSquare.java and modified it in order to complete the task. The main modifications are showed below:
|
|
|
|
|
|
```
|
|
|
oldPoseX = poseProvider.getPose().getX();
|
|
|
|
|
|
//travelDistance is a double predefined as 75
|
|
|
while(oldPoseX < travelDistance){
|
|
|
distance = ultraSonic.getDistance();
|
|
|
pilot.forward();
|
|
|
|
|
|
|
|
|
if(distance < distanceThreashold){
|
|
|
//Do turns to avoid object
|
|
|
|
|
|
pilot.rotate(90);
|
|
|
pilot.travel(20);
|
|
|
pilot.rotate(-90);
|
|
|
|
|
|
// Length of object
|
|
|
pilot.travel(37);
|
|
|
pilot.rotate(-90);
|
|
|
pilot.travel(20);
|
|
|
pilot.rotate(90);
|
|
|
}
|
|
|
|
|
|
oldPoseX = poseProvider.getPose().getX();
|
|
|
show(poseProvider.getPose());
|
|
|
}
|
|
|
```
|
|
|
##### Fig. 31 - Code from PilotSquare.java shows how an ulrasonic sensor is used along with the poseProvider to get the robot to avoid objects when it encounters an object while still being able to get to its desired destination.
|
|
|
|
|
|
The code shows that as long the x value from the current pose is less than the predefined travelDistance, the robot will drive forward towards its destination. While driving forward the ultrasonic sensor conducts readings in order to detect upcoming objects. If an object is detected it will trigger the if statement containing the code to avoid the object. After completing a series of avoidance steps the oldPoseX value will be updated with the current pose’s x value. Then loop starts over and the robot will travel the remaining distance towards the destination.
|
|
|
|
|
|
|
|
|
|
|
|
## Result
|
|
|
The robot was able to drive along a path with a fixed length and avoid the object encountered in various positions.
|
|
|
|
|
|
[![image alt text](http://img.youtube.com/vi/aCHZVuBc0l0/0.jpg)](http://www.youtube.com/watch?v=aCHZVuBc0l0)
|
|
|
##### Fig. 31 - Video showing how the robot car is avoiding a bucket on the route.
|
|
|
##### Fig. 32 - Video showing how the robot car is avoiding a bucket on the route.
|
|
|
|
|
|
This proves that a robot can navigate between dynamically placed objects while following a predefined route. In spite of the successful result, the experiment showed some concerns which should be handled through further experimentation:
|
|
|
|
|
|
While testing this implementation, we encountered a systematic error that we had a hard time determining the cause of. The issue was, that the robot did not travel the exact distances determined in the code and did not turn exactly 90 degrees. To solve this we tried changing the trackWidth and wheelDiameter as in the previous exercise. This quickly resulted in the trackWidth and wheelDiameter differing a lot from the actual measurements of the robot. The problem with systematic errors is that their impact cannot be determined until they are actually found and removed [5]. We suppose that this systematic error could have been cause by ourselves, simply by calibrating the robot too much to drive a specific route with the best possible results.
|
|
|
|
|
|
|
|
|
|
|
|
## References
|
|
|
|
|
|
[1] - http://legolab.cs.au.dk/DigitalControl.dir/NXT/Lesson10.dir/paper58.pdf
|
|
|
|
|
|
[2] - http://commons.wikimedia.org/wiki/File:Particle2dmotion.svg
|
|
|
|
|
|
[3] - http://en.wikipedia.org/wiki/Dead_reckoning
|
|
|
[4] - http://legolab.cs.au.dk/DigitalControl.dir/NXT/Lesson10.dir/paper58.pdf |
|
|
\ No newline at end of file |
|
|
|
|
|
[4] - http://legolab.cs.au.dk/DigitalControl.dir/NXT/Lesson10.dir/paper58.pdf
|
|
|
|
|
|
[5] - http://en.wikipedia.org/wiki/Systematic_error#Removing_Systematic_Errors |
|
|
\ No newline at end of file |