Robojoy challenge class

4-2 Line trace with only 1 sensor

Want to run faster

In Unit 4, I already have a big satisfactory, but a little greedily, I would power up the following points.

  • I want a faster speed when it is straight ahead.
  • To more easily change the setting of the sensor.
  • I want to change the direction in the curve and more brisk.

This is a program to improve for Unit 5.
Sorry, I am getting long program will introduce the split.

[Download] line tracer Unit 5
(Created in NXT software for education 2.0)

The first half of the program, we initialize each variable here.

  • Variable "Center" is an intermediate value of b white and black of the light sensor. Because there are individual differences in the sensor, please according to the value of that use of your own light sensor,
  • Variable "Gain" is a variable that represents the agility of the motor. If you increase this value, react promptly from the changes in the sensor. If you increase the value is too large, but shaking would grow. In addition, it will then detour when this value is too small.
  • Variable "Power" is the power of the motor. Movement of the robot will be faster when you increase this value.

Here is the program of the second half. Calculate the "position of the sensor" from the value of the light sensor, but further indexing the power of the left and right motor. "Position of the sensor" in the middle is 0, the value is negative the state relies on the black side, and the value is positive the state relies on the white side. Multiplied by a value of Gain to "the position of the sensor", the variable from the Power will add (or subtract) to the result. In other words, the motor rotates in the left and right variable power of Power on the straight line. When it is running on the curve line, the inner power of the motor is reduced; the outer power of the motor is increased.

It is the state of the running.
Because I did speed up, but have slightly staggered, are progressing quite smoothly. In Unit 1 it took 1 minute to 1 round, in Unit 5 was able to reduce up to about 10 seconds to 1round.

[Movie] running of Unit 5 movie (youtube)

I think it would be interesting to change the value of the variable Power and Gain, and try to see how it changes the movement.


Line Trace robot contains lots of difficult technology, but what is popular in the competition. And this technology has far from over. Please look forward to next time.