Date: 24/04 2014 and 28/04 2014
Duration of activity: 10.15 - 15.00 and 9.15 - 13.30
Group members participating: Pætur, Christian og Søren
Goal: At gennemføre ugens opgaver [1].
Plan: Gå opgaverne sekventielt igennem.
Results: Vi har gennemført alle opgaverne, dog havde vi ikke tid til den sidste opgave.
Lesson 9
In this lab session we will apply the tacho counter of the NXT motor to keep track of the position and direction of a LEGO car with so called differential drive where two motors are used independently to move and steer a car as shown in Figure 1. The different interfaces and classes available in leJOS for localization and navigation are described in the tutorial : Controlling Wheeled Vehicles, [5].
Figure 1: A car with differential drive that can turn in place, [3].
Navigation
In Chapter 12 of Brian Bagnall, [2], he uses a differential driven car to experiment with the leJOS facilities for localization and navigation. On page 298 of Brian Bagnall's Chapter 12 he describes a simple test program that uses the class TachoNavigator to make his car "Blightbot" move between different positions in a Cartesian coordinate system.
Figure 2: A car with differential drive moves between four points in a Cartesian coordinate system, [2].
Use a similar car to perform a similar test several times and record how accurate the car returns to its original position. In Maja Mataric's paper on Toto, [4], she describes how to gather data on the movements of Toto by attacking a marker to the robot.
Use a similar method to gather data on the path that your car drives.
We tried to make the car navigate the course of figure 2, but we also tried to make our car go in a square. The following picture is where we try to get our car to navigate the course from figure 2:
Figure 3: Car drives the course from figure 2 on a whiteboard, repeated 3 times.
The runs made in figure 3 were both made with a track width of 11,0 cm, while the wheel diameter in the left picture is 5,6 cm and in the right picture 5,5 cm.
To see how the pattern changed with the change of wheel diameter we repeated the run three times. In figure 3 it can be seen, that the consequence of a wheel diameter of 5,6 cm was that the pattern slowly rotated counter-clockwise while the pattern drawn with a wheel diameter of 5,5 cm slowly moved clockwise. These observations is marked with the two arrows in figure 3 where the numbers 1,2 and 3 represents the sequence in which the patterns were drawn.
We thought that the solution was to set the wheel diameter to 5,55 cm, just in the middle of 5,5 cm and 5,6 cm, where the pattern respectively rotated clockwise and counter-clockwise.
Unfortunately our assumption that the pattern would be perfect with a wheel diameter of 5,55 cm was wrong. In figure 4 this run can be seen.
Figure 4: Car drives the course from figure 2, 3 times in a row with a
wheel diameter of 5,55 cm.
These test drives were done on a whiteboard, and we noticed that it looked like that the rear wheel made the car drift sometimes during some of our test drives. We got some very skew squares. To accommodate this issue we changed the rear wheel of the car to a vertically mounted LEGO axle. This reduces the car drift, but we still could not get a perfect run where the car returns to its original position and direction.
We then changed from testing the drives on the whiteboard to test the drives on pieces of A3 paper taped to a table and remounted the LEGO 9797 Car standard rear wheel. We had the assumption that this would reduce the drift for 2 reasons:
- The paper would be less smooth than the whiteboard and thus reduce drift
- The paper would be more even (as we had noticed that the whiteboard had an uneven surface) and thus reduce drift.
Figure 5: Car drives in a square on two A3 papers with wheelDiameter = 5,6 cm and trackWidth = 10,9 cm. A video of the leftmost drive can be found here: http://goo.gl/ZQf1Te and a video of the rightmost square drive can be found here: http://goo.gl/jwZx82
The tests on the paper produced more steady results with less drift, which made it easier to finetune the values of the trackWidth and the wheelDiameter. From the two drives on figure 5 we can see that the endpoint is very close to the start point when driving in a square.
Brian Bagnall notes that "Blightbot does a good job of measuring distance but his weakness arises when he rotates". Perform experiments to investigate his observations.
Figure 6: A picture of the drawing made after a marker was attached to the vehicle and the vehicle was programmed to draw a square.
Figure 6 shows that the vehicle is quite good at driving the same distance at every run, but does indeed, as Bagnall states, not handle the rotations very well (it must be noted that this can be because of the challenge of getting the trackWidth and wheelDiameter parameters right, which results iin a challenge of handling rotations). It is clear in figure 6 that the car rotates a little bit too much at every run, meaning that the pattern, a regular square at its origin, is repeated a few centimeters left from the original starting point. But it is also clearly seen in figure 6 that the size of the square is exactly the same at all runs, meaning that “Blightbot does a good job of measuring distance.”
The code we used for our drives can be seen here:
Figure 7: Code used to draw a square.
Navigation while avoiding objects
How can you make the car move from place to place by means of the leJOS navigation system while the car avoids objects in front of it?
We did not implement this, but our plan would be to first make a path consisting of a few waypoints eg. (0,0), (0,100), (100,100), (0,0) to make a right triangle in the navigator class from leJOS, see figure:
Figure 8: The triangle we would draw if the program was implemented
For the car to avoid an obstacle placed to block the route we would equip the car with an ultrasonic sensor. If the ultrasonic sensor detected an obstacle within 20 cm the car would stop and measure the distance to the left and to the right. The direction in which the largest distance is measured, a waypoint would be added to the front of the path, which is illustrated in the following figure:
Figure 9: The path after a new waypoint is added to avoid the obstacle
A bumper could also be used to avoid getting stuck, using the same procedure as we did in lesson 7.
Improved Navigation
In [2] there is a formula that shows how the position and direction are updated during the moves of a mobile robot. In [5], another update formula is used. What is the difference, what is the most accurate? Try to figure out how leJOS updates the position and direction. Can you use [5] to improve that? Or?
We didn’t have time for this one.
References
[1] Opgaveformulering http://legolab.cs.au.dk/DigitalControl.dir/NXT/Lesson9.dir/Lesson.html
[2], Brian Bagnall, Maximum Lego NXTBuilding Robots with Java Brains, Chapter 12, Localization, p.297 - p.298.
[3], 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.
[4], Maja J Mataric, Integration of Representation Into Goal-Driven Behavior-Based Robots, in IEEE Transactions on Robotics and Automation, 8(3), Jun 1992, 304-312.
[5], leJOS Tutorial: Controlling Wheeled Vehicles
[6], Thomas Hellstrom, Foreward Kinematics for the Khepera Robot
Ingen kommentarer:
Send en kommentar