LabVIEW for LEGO MINDSTORMS and LabVIEW for Education

cancel
Showing results for 
Search instead for 
Did you mean: 

I have built a car it to follow the black line and stop at red. I am confused of how to make it follow the line. Can anyone help me?

My project is based on developing a race car. My car is now running fast and can stop when it sees an obstacle. But, I want it follow a line. I have tried doing it in two ways. Its not working. I don't know if it is because of my surface. I even tried the line follower option in the nxt toolkit. Anyway, I have attached my files. Your help will be appreciated. Thank you!!

Download All
0 Kudos
Message 1 of 7
(8,906 Views)

Can someone really bug me with something? My motors are connected to port B and C. I am confused whether to use 2 light sensors or 1 because the car couldn't make an easy turn with one sensor and also runs out of the line. I tried using a motor for the two front wheels (tried to make a movable chasis) but once it turns left, its not regaining its position back. Please help me with the line following technique.

 




0 Kudos
Message 2 of 7
(8,886 Views)

Hi,

 

a line-following robot follows an easy principle: it detects the brightness differences on the ground and moves accordingly

When you use a single light sensor, you follow the edge of the line, making it more of a border-follower. When the robot is on the dark side, he turns to the light one, and vice-versa.
 You often see robots doing a little zigzag over a line, that happens when they are not well ballanced.

With two light sensors, you take their brightness difference and turn accordingly. So for example, when your left sensor is on the line, showing black, and the right one isn't, showing white, the robot turns towards the line. It turns slower with a smaller brightness difference, when the sensor only sees a part of the line.

 

The two VIs you posted both look like a single sensor configuration. If you have a second sensor, I vould definitely recommend a double-sensor-configuration. For the beginning, just play a little with the sensor, and look at the brightness-values they give you back. Once you realise which value corresponds to which surface, you can then try to calcutate the difference, and so you can see if you are too much on the left or on the right. As a 3rd step, you can the use this information to control your wheel speeds.

 

Good luck, and have fun with your project!

 

Oliver

0 Kudos
Message 3 of 7
(8,857 Views)

Hi Oliver,

 

Thanks a lot for your kind reply. I was much worried last week and wasn't getting any replies from anyone. Actually, I had a car made of 4 wheels with a movable chassis and had problems with its gear. It turns into one direction and doesn't regain its position. That was the reason, the program was not working on my model. Now, that I have changed my model to a 3 wheeled one. Its now working fine. Yea I tried working with one and two sensors. The speed isn't varying but the accuracy is varying a bit. I experimented it by myself and got it working. Anyway thanks a lot for your help.

 

But, I have another query. Can you tel me how to make my car stop at the red line(finish line)? I don't know how to make my light sensor wokr as color sensor again in the program. Can you please quickly tell me?

0 Kudos
Message 4 of 7
(8,850 Views)

Hi kg5375s,

 

well, there are different methods of scanning a color. First of all, it is important to know which kind of sensor you use. If the sensor is able to detect a color (i supporse it does) you have a color-output where you can compare the measured color to the one you're looking for. Then, you can use a case structure, and react accordingly.

 

If you tell me the exact sensor you use (type-nr, exact name or something like that) i may be able to help you a little more.

 

Oliver

 

 

0 Kudos
Message 5 of 7
(8,840 Views)

Hi Oliver,

 

The kit number is 9797. I am using a color/light sensor and the type number is 4296917. I must make it work before this friday. Anyway, see if you can help. Thanks

0 Kudos
Message 6 of 7
(8,830 Views)

Hi,

 

sorry for the late reply, I wasn't on the forum for several days.

 

I hope you managed to solve you problem before the deadline. If not, all you have to do is to compare the color of the color-sensor (that comes out of the VI) to a color you have set before (the kind of red you want to detect). If the color matches the color you're loking for, you you execute what you want to do then.

0 Kudos
Message 7 of 7
(8,808 Views)