Wednesday, October 13, 2010

Lab Exercise 6

Date:
7/10 2010

Duration of activity:
6 hours

Group members participating:
Frederik, Lasse & Christian

Goals:
To make a robot car follow the Alishan train track according to the rules specified in the exercise despription[1]

Plan:
Our main plan is to hardcode the track by using the Motor class.

Results:
We first wanted to be able to set a distance in the program which the robot must drive. By using the diameter of the wheel and setting the angle of the wheels (number of rounds) we would be able to drive a certain distance.

Following shows the results measured and calculated:
Diameter on wheels, d = 8.16 cm (declared on the used tyre)
Circumference on wheel, c = pi * d = 25.635 cm
Track width, tw = 12.8 cm (measured)

During the lab session a few sketchings were made, in order to better grasp the track, and how to get around it:
The green box shows a sketch of the track seen from above. The blue box shows how Pythagos' theorem was used to calculate the distance of the straight track part. The Red box shows a sketch of how the turning was calculated.

The distance traveled per degree (dpd) the wheel turns is:
dpd = pi * 8.16 cm / 360 degrees = 0.712 mm/degree

This is useful to know, as the motors are controlled by how many degrees they should revolve.Our next step was to calculate how many degrees the traveling distance was. This was pretty straight-forward - distance divided by the movement pr. degree:
deg = dis / dpd

This calculation was put in the Wheel class[4], thus making it possible just to input the wanted distance.

It was a wee bit more complex to calculate the turns, as the inner wheel will travel less distance than the outer wheel. The speed of the inner wheel must also be less than the outer wheel, in order for the robot to make a smooth semi-circle.
We knew the width of the Alishan track (aw = 190 mm), and we knew the track width of the wheels (tw = 128 mm). Realizing this information made it straight-forward to calculate how far each wheel should drive in order to make a smooth turn (t):
t(inner) = (aw - tw / 2) * pi = (190 - 128 / 2) * pi = 396 mm
t(outer) = (aw + tw / 2) * pi = (190 + 128 / 2) * pi = 798 mm

The ratio between the to turn distances were used to set the speed of each wheel, making the inner wheel turn slower than the outer, thus giving us a nice and smooth turn.

Because we wanted to use the rotateTo() method to control the motors each motor didn't have a seperate thread so we needed to create them ourselves. So now we are to set a number of centimetres to each motor and the motor will run the wheels exactly that distance.
The next step was to find out how to manage the motors in the curves. This was done by using the measurements of the track provided by the official rules[2].

Because the track leans between the platforms it was necessary to know the distances. This was simply done by using the Pythagorean theorem because the other measurements were provided by the official rules. The height of the track, however, was unreadable in the provided drawing, so it was necessary for us to measure this by hand, yielding the result h = 233 mm.
The real distance dis(real) we needed for our car was:
dis(real) = sqrt(h^2 + dis^2) = sqrt(233^2 + 1340^2) = 1360 mm

Testing the car on track
When testing the track we found out that between each move action the tacho count had to be reset. Else the car behaved unpredictably.
The biggest challenge in our approach was wheelspin which caused the car to drive skew, and thereby messing up the relationship between the real world, and the car's internal model of the track. We tried to replace the large thin wheels with smaller, wider wheels, which - to our conviction - had better traction, and we noticed a slight decrease in wheelspin but still not good enough - the car didn't start and end at the same place. Our next strategy was to increase the weight on the wheels to make the contact with the surface better - still no promising results.
During the experiment we also noticed that the car slides a bit with breaking between each movement, especially after turning. Afterwards we rebuild the car because we found some other wheels, which seemed promising because of the softer rubber, the tyres consisted of. The new car can be seen on the picture below:



After various experiments, we decided to return to the original wheel types but still the same simple construction (the one seen in videos later).

During tests we found out that the problem with wheelspin almost disappeared when reversing the driving direction because of the weight distribution (race cars are rear wheel driven too). So we reversed the control algorithm and switched the cables for the two motors which resulted in a more correct behaviour.
When testing the car on the track some minor modifications were needed because it didn't drive 100 % straight at all points in the track. This could be caused by dirt and unevenness on the track.


Afterwards it was time to record the results.

Track results

#1 run: 42.967 seconds:

1st run
#2 run: 31.662 seconds:
2nd run



The control algorithm is found in the Alishan class[3].

Conclusion:

We chose to make a robot without any sensors besides the tachocounters in the motors. The reason for this is that we wanted to explore the challenges in making a blind robot that only had its own internal model of the world, it functioned in.
The resulting robot functioned quite well. There are of course room for improvement - e.g. fine-tuning speed, cornering, and accelleration, but the final time of just above 30 seconds were quite acceptable.
The main challenges we encountered building our blind track-follower were, that we had no way of knowing when the robot made wheelspin (from a system-perspective). If the robot would spin its wheels, it would continue following its own internal map - even though it potentionally could cause mayhem in the real world.

One solution to solve this would have been to combine the current system with sensors to keep a track on the environment. Either sensors to monitor the wheels and correlate with the internal tacho-count to counteract wheelspin - or sensors used to keep track of the line on the track, and thereby use it to compensate for wheel spin, and keeping the robot on track. When the sensors would discover multiple tracks to follow (the Y-shape at each platform), it would know that it should turn - which way to turn would be decided by the internal model.

This hybrid would have the benefits of the internal view of the course, and the benefits of knowing if an inconsistency occurs (via sensors), and thereby making it a more robust line-follower.

The built system, however, made it through the track in quite a decent time, so the enhancement by sensors will have to wait for the next opportunity.

References: