LabVIEW for LEGO MINDSTORMS and LabVIEW for Education

cancel
Showing results for 
Search instead for 
Did you mean: 

Help with Line Following Program for NXT 2.0 in LabVIEW

Hello Everyone,

 

My FIRST FRC Team is hosting a "Lego Robotics" Summer Camp this summer, our goal is to introduce young minds to the concepts of engineering, programming and robotics, and ultimately plant the seeds for a FIRST FLL Team. I presuaded my mentors to introduce LabVIEW to the 6th-8th Graders participating in our camp, and it was working out well for us until we tried to make a line following program. Our kits are the LEGO Mindstorms 2.0, so we are trying to use the color sensor for tracking the line, however, it isn't really working out that well. After several failed attempts I still cannot figure out how to follow a line with the color sensor. So basically, I am posting here to get some help with a Line Following Program for the NXT 2.0 written in LabVIEW, any sample code or help would be appreciated. Also, I am using LabVIEW 2011 32-bit with the latest NXT Module.

 

(We have a bunch of Educational NXT Kits also, would it maybe just be best to take a light sensor from one of those. Ideally, I would like it to work with the color sensor though, so the other kits are not missing their light sensors)

 

Thanks,

JSzaday

0 Kudos
Message 1 of 5
(11,911 Views)

Hi JSzaday,

 

This article has some advice about using color sensors to do line following.  It also includes links to sample .rbt files.

 

This article discusses PID control with the color sensor and may also be helpful.

Jayme W.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 5
(11,904 Views)

Thank You for your reply, I saw the first article before, but I am not sure how to use the color sensor in "Light Sensor" mode in LabVIEW. The ideas presented in the  second article are also helpful, but I do not know how to make a LabVIEW version of the presented NXC Code.I know that you would use a shift register to represent "previous_error," but I am not sure how to go about implementing the rest of it, I'll have to work on it.

0 Kudos
Message 3 of 5
(11,901 Views)

I just attempted to "translate" this NXC program to LabVIEW, but apparently I did something wrong. I have attached my attempt in a VI File, if someone could look over it for me I'd appreciate it, as I am still a rookie LabVIEW programmer, and probably made a silly mistake!

0 Kudos
Message 4 of 5
(11,899 Views)

What exactly is going wrong?

You are using the color sensor in color detector mode in this vi which wont work for line following i guess. Color detector returns an enumerated value of {black, blue, green, yellow, red, white}.

 

Your probably want to switch it to Red Light Sensor, which will work the same as the normal LEGO light sensor. You can change the mode by operate clicking on the poly-selector (dropddown) that currently says "color".

0 Kudos
Message 5 of 5
(11,882 Views)