@@ -214,6 +214,26 @@ A link to the final code, [RoboRacerV3], is also found in the references section
An autonomous Lego car application has been implemented which was able to drive up and down the Alishan track in a time of 27,9 seconds, as seen in [Video 2].
The development process has been characterized by the postulation and verification of various hypotheses during the project.
At first we attempted a strategy with only a gyro sensor to detect the plateaus, and hard-coding of the turns.
This strategy however, assumed that the car could drive in a straight line with the same power applied to both motors, and therefore it was quickly abandoned due to motor mismatch.
The plateau detection with the gyro sensor worked, and hence this was part of the next strategy.
In order to be able to drive up the ramps a line following approach was implemented using light sensors.
Firstly, a single light sensor was used as in a previous exercise .
Another light sensor was added to avoid the dependency of having to be on the "right" side of the black line, thereby increasing the chances that the line following behavior can find the line after a turn.
The light sensor measurements were used as the input to a PID regulation of the motors.
Different motor drivers were tested, until it was realized that direct speed control was needed, especially when going downhill on the ramps.
Even though it worked uphill, a regulation based on motor power was unable to follow the line downhill because of too violent turns - even with the PID gain constants adapted to downhill drive.
Therefore we ended up using the `RegulatedMotor` driver, which provides the capability to regulate directly on motor speed, ensuring robust line following both up and downhill.
The strategy for turning was unchanged during the course of development, and was implemented as a lower speed on the inner wheel, a high speed on the outer wheel and a delay.
These parameters were tuned for each turn and the speed of the car, in order to hit the next ramp with the black line in between the two light sensors on the front of the car.
The 180 degree rotation at the top was implemented by making the motors turn a specific amount of degrees in opposite direction.
As with the turns, this was empirically adjusted to ensure an accurate rotation.