lørdag den 10. oktober 2009

Lab session 6


Attendees: Jesper Jakobsen, Mads Hansen Lund and Michael Nygaard Pedersen


In this lab session we will try to make a car that drive as fast as possible following the Alishan train track. The Alishan train track has been used at a robot competition called World Robot Olympiad in 2007 (Ref 1).

Sub goals

To evaluate the sub goals a detailed analysis of the track is made.

Track analysis

Figure 1 shows the track with all the issues needed to be resolved. All the state identifiers are unique for this lab session and might be used more than once, but will always refer to the same state.

Figure 1 - Alishan train track top view

1: The robot should drive forward in the beginning and activate line following sequence, when at least two sensors detect a white surface.

2: The robot should be orientated on the right side of the line in the first straight line.

Figure 2 - Follow simple line

3: When the center sensor and sensor on the inside of the corner reads a black value the robot is set in reverse and will now detect and drive more careful.

Figure 3 - Detect sharp corner

4: When the sharp corner functionality has been executed the standard line following code is activated again. But the line orientation should be shifted after X seconds and the sharp corner functionality is also inverted.

Figure 4 - Change side to keep orientation on the left side for the next corner

5: If all sensors detect black a 180 degree turn should be performed after X seconds and both the line orientation and sharp corner functionality must be reversed yet again after X seconds of blind mode to ignore the big black line across the track. Then the program is just executed like from the bottom and up.

Figure 5 - Wait and turn 180 and evaluate that track is half finished

When all three sensors detect green for the second time the program is stopped and total time is logged.


To sum up a self explaining pseudo flowchart for the main algorithm is presented in Figure 6.

Figure 6 - Pseudo flowchart

The plan is to implement this general Alishan train track algorithm and apply some or all the necessary exception states to complete at least one half of the track.


Description of robot

The racing vehicle utilizes three RCX light sensors located in front of the steering wheels to gather information about the racing track in advance. The three light sensors are fixed in position with respect to each other but can move up and down in order to keep the same distance to the surface. This done with an assistant ''distance wheel'' which insures that the light sensors always are kept in a constant distance from the track (see Figure 7).

Figure 7 - Picture of robot

The picture to the right in figure 7 shows a logged time for a run on the track in milliseconds.

Software description

Folowing flow chart diagrams and related text should be read together with the uploaded code (REF3).

The concept for the software is based on the linefollower from Lab Sesion 1 (REF2). The linefolower has been modified for the Alishan train track. The main differences are illustrated in Figure 8 where the program has a optional line side orientation.

Figure 8: Flow chart for the main concept.

The 90 degrees corners requiere an more aggresive turn, which is peformed with a reverse motor drives and slower speed illustrated in Figure 9.

Figure 9: Flow chart of the two turning modes (the hard turn is activated by a 90 degrees corner).

When the robot encounters a 90 degrees corner it passes the corner by failure, but registers that an error has been made. To get back on track the robot move slightly backwards and proceed with a more gentle tracking method and more aggressive handling.

Figure 10: Flowchart illustrates that the robot reverse back to find the line again when it arrives at a 90 degrees corner.

Problems encountered

At first the light sensors were located too close to the steering wheels which made the vehicle unable to react to changes in the racing track.

The line follower uses a bang-bang control algorithm, which at first made the vehicle sway relative violently from side to side.

The biggest problem was to make it through the 90° corners. When encountering a corner the line follower algorithm would cause the vehicle to race off track.

The final algorithm used causes the vehicle to be relatively slow since it needs to slow down to manage the 90° corners.

When encountering the black line separating the last slope and the highest plateau, the vehicle sometimes think it has encountered a corner and starts moving backwards.

The battery needs a fair amount of charge to be to drive uphill.


The robot did not reach the final destination, but all the principles from the track analysis has been investigated and proven to work. The robot is very slow but works very well uphill, which is the only functionality fully implemented. This video shows the robot in action:


Ref 1 http://legolab.cs.au.dk/DigitalControl.dir/NXT/Lesson6.dir/Lesson.html

REF2 http://legolab.cs.au.dk/DigitalControl.dir/NXT/Lesson1.dir/Lesson.html

REF3 http://legocarsten.blogspot.com/2009/10/code-from-lab-session-6.html

Ingen kommentarer:

Send en kommentar

Faste læsere