Duration of activity: 3 hours
Group members participating: Lukas, Daniela, Helene
Goals:
- Perform exercises from Lab Session 9
Plan:
- Modify the standard car with a better support wheel.
- Use the DifferentialPilot class to make the car drive in the pattern given in the exercise.
- Perform experiments to se how precise the DifferentialPilot is.
- Discuss how to navigate while avoiding objects.
- Discuss how to improve navigation.
Results:
We started by modifying the standard car we build from the instructions at the last lab session. We replaced the supporting wheel with a round brick to make the car turn more smooth.
After building the car we measured the wheel diameter and the distance between the wheels, we got the following result:
- Wheel diameter: 56 mm
- Wheel distance: 103 mm
We wrote a navigation program, which uses the DifferentialPilot and the above measurements to make the car drive in the following path:
To do this we wrote the following code:
where we start by initializing the differential pilot with our measurents and afterwards asks the pilot to make the care drive in the wanted pattern.
To test this program we attached whiteboard marker to the car and placed it on a whiteboard lying on a table. Our first attemts was not very accurate with respect to the rotation. We had some problem with rotating the right angle. Especially the last rotation was far to big. When we started to investigate these problemes our first observation was that we had not calculated the last angle correctly. Just observing the figure we thought that the cars should rotate an angle of -135 degrees, but when using the cosinus relation to get a more accurate result we got that the car should rotate an angle of 90+27,5 = 117,5, which is much smaller than our original angle.
The rotations was still not very precise, so we decided to invesigate whether our measurements were correct. Since the car drives the exact value specified when driving a straight line we concluded that the problem must be in the distance between the wheels and not the diameter of the wheels, since the diameter has effect on both straight lines an rotations, while the distance only effects the rotation.
This conclusion lead us to try to vary the value for distance between the wheels in the code. To check whether the value is good or bad we changed the program to make the car drive straight for 20 cm and then turn 180 degrees and keep repeating this. Our goal is for the car to keep driving on the same line. The code for this experiment can be seen in the following figure:
The complete program can be found here: Navigator.java
The following video shows the car drive according to the above code for the original wheel distance of 103 mm:
In this video it is clear that the car turns to little, which gives us a very nice pattern, but not the one we desired. In the following you can see the test drives for different values of the distance between the wheels:
Wheel distance: 106 mm
Wheel distance: 109 mm
Wheel distance: 108 mm
This experiment show us, that the best distance was 108 mm.
After these exeriments we tried to measure the distance between the wheels agian using a measuringtape. We found that the actual distance between the center of the two wheels was very close to 108 mm.
The reason why this measurment is so different from our first one could be that while handling the car we have moved the wheels a little, and the first measurement might not have been very accurate.
After this adjustment we tried to run the penny pattern program again, and this time we got a very good result. See the following video and figure:
The rotations was still not very precise, so we decided to invesigate whether our measurements were correct. Since the car drives the exact value specified when driving a straight line we concluded that the problem must be in the distance between the wheels and not the diameter of the wheels, since the diameter has effect on both straight lines an rotations, while the distance only effects the rotation.
This conclusion lead us to try to vary the value for distance between the wheels in the code. To check whether the value is good or bad we changed the program to make the car drive straight for 20 cm and then turn 180 degrees and keep repeating this. Our goal is for the car to keep driving on the same line. The code for this experiment can be seen in the following figure:
The complete program can be found here: Navigator.java
The following video shows the car drive according to the above code for the original wheel distance of 103 mm:
In this video it is clear that the car turns to little, which gives us a very nice pattern, but not the one we desired. In the following you can see the test drives for different values of the distance between the wheels:
Wheel distance: 106 mm
Wheel distance: 109 mm
Wheel distance: 108 mm
This experiment show us, that the best distance was 108 mm.
After these exeriments we tried to measure the distance between the wheels agian using a measuringtape. We found that the actual distance between the center of the two wheels was very close to 108 mm.
The reason why this measurment is so different from our first one could be that while handling the car we have moved the wheels a little, and the first measurement might not have been very accurate.
After this adjustment we tried to run the penny pattern program again, and this time we got a very good result. See the following video and figure:
Based on these experiments we started to discuss the following two questions stated in the exercise:
- Navigation while avoiding objects
We could use the differential pilot to remember the robots position. When we remember the way the robot drives and how much it turnes at any point, we can calculate the current position and orientation by using vector operations. From this, we can always find the direction and distance to the goal we wanted to drive to.
To detect obstacles we could use ultrasonic sensors, which give a distance to some object that may be in the way. Using this distance and the sensor orientation and position relative to the robot, we can compute a point in 2d space, where there is an obstacle. To check if the robot can drive through some part of the field, we remember all the points where there might be an obstacle, and simply avoid points with some distance or check if the robot might fit in between two obstacles/points.
Method 1 (source [2]):To detect obstacles we could use ultrasonic sensors, which give a distance to some object that may be in the way. Using this distance and the sensor orientation and position relative to the robot, we can compute a point in 2d space, where there is an obstacle. To check if the robot can drive through some part of the field, we remember all the points where there might be an obstacle, and simply avoid points with some distance or check if the robot might fit in between two obstacles/points.
- Improved navigation
Use a thread to constantly check what we would call tacho count ( which they call shaft encoders ), and loop in small time intervals. For every time interval, assume that the robot drove in a straight line, and update the position we are at accordingly. This is called "Dead Reckoning"
Method 2 (source [5]):
Forward kinematics.
This method does not assume that the robot drove in a straigh line, but approximates the curve the robot drove around a center point with some angular velocity.
We see that the big difference between the two method is that method 1 is a more rough approximation, while method 2 tries to approximate the cars movements based on the laws of kinematics and angular movement.
We did not succeed in determining the method used by leJOS. We think that it looks more like method 1, by tries to do something smart when the car drive in a arc.
If we should choose between the two method we think that method 2 seems to be somewhat more accurate, because the timesteps used in method 1 could easily be a little to large, and the robot could have turned to much to make the approximation with a straight line to erronous.
Conclusion:
We got our car to drive very precisely along the path, when we found the correct values for the wheels diameter and distance from each other. This means that the DifferentialPilot implementation is reasonable accurate. Further testing could be done by letting the DifferentialPilot drive the robot for much longer distances and more complex paths, to see how well the implementation holds up or how good our measurements are for the long run.
References:
- Lab exercises: lab9
- Source [2]: Java Robotics Tutorials, Enabling Your Robot to Keep Track of its Position. You could also look into Programming Your Robot to Navigate to see how an alternative to the leJOS classes could be implemented.
- Source [5]: Thomas Hellstrom, Foreward Kinematics for the Khepera Robot



