Pages

Jan 25, 2007

Coach needs some help...

I'm not that experienced on RoboLab - I received the following request from Jim C. and am hoping some of our readers might be able to offer some suggestions:

"I am teaching a group of students immgrating from the RCX to NXT. We have been working on buidling a line follower using the NXT set.

We have decided to use the robolab 2.9 program to work on this project as they are more familiar with robolab software.

Would appreciate it if you could help to point us in the right direction with regards to the following:

1) How do I calibrate the NXT light sensors? I understand that the NXT-G software has a calibration function but not the robolab 2.9 software. There is no calibration file in the NXT brick as well so we can't use that.

2) Can 2 NXT light sensors be used to build a line follower robot? How different would the program be via-a vis using a single light sensor?

12 comments:

Why do you need to? The light sensor returns a value: all the NXT-G calibration does is select two numbers to scale that value between, so that the sensor returns 0 to 100 over a certain specified (calibrated) range of the raw return from the sensor. You could certainly do this under Robolab 2.9, it's just not built in. short version: the light sensor works JUST FINE without any special calibration.

> Can 2 NXT light sensors be used to> build a line follower robot?

Certainly. And yes, the possibilities of using two light sensors are significantly different than with just one. How do you follow a line with one light sensor? Can you (or better yet, your students) think of a way to use two light sensors? A way similar to the one light sensor solution? How about completely novel ways?

Yes, I could stop being cryptic and just "give you an answer" here, but this is a fantastic chance to get the students to teach themselves. I'd encorage you to treat it that way.

Not at all. The first thing the program could do is "request" the user to hold it over a white area and a black area, and use those to compute what the "correct" raw limits are, and use those in the program. Don't like that? Then write a seperate program that does this "calibration", and write those values to a file... which your line following program can read and use later. This, after all, is all the light sensor calibration really is - an auotmation of a technique that's been used by a lot of folks for a long time.

nxt-g would be the better software to choose because once you do get used to it, it becomes much easier to calibrate the sensors. but otherwise;

for the light sensors, the best way to use a single light sensor in my opinion (easiest, plus helps build simple math logic) is by using 3 values, 1. the value of the black line (middle of it) 2. the medium value of the edge of the line 3. the value of the white area.

so its a matter of light sensor hits white (assuming you start on the left side of the line) u turned to far left, so keep turning right untill you get to the medium value.

if you hit the low/dark value, then you turned to far right, move left.

play around with this, make it go forward or just keep bouncing back and forth between two values (slow but very accurate)

TWO light sensors: so much more fun and so much easier. a tank bot would work best (for turning).

simply "sandwich" the line by putting two light sensors at least a centimeter from the edges of the line. you can either have each light sensor control one side of the bot (simple program, i think the brick was called task split or something split) or make a more complicated program.

two light sensors would work extremly better, and iv been able to test it on complicated courses with sharp turns and gaps, easier to program, more fun too.

single light sensor works just fine one the circular track provided by lego.

and if you get the light values perfectly, u can do complicated tracks. the only problem with that is depending where the robo is facing, the light values will be different (angle, shadow, people blocking light, etc) so it becomes much harder to use 3 different values.

Our FLL team used RoboLab 2.9 and managed to calibrate the NXT light sensors. But I'm not sure if it is the way you are talking about. We had the robot drive to the stain resistant fabric mission. On the way, it sees both extremes...black and white. We had it store the highest and lowest values it saw and set them up as dark and light. I'm not sure because I didn't work on that program at all, but I believe that we manually set the "envelope" or where id decided if something was light or dark. And if it saw something lighter or darker than the first values, it would automatically set them up as the new high or low.

I have successfully programed my robot to follow a line using a single light sensor and am trying to develop a 2 light sensor version.

I have written a program that is marginally working but am having trouble with light shadows and inconsistent response. The robot moves foward 2 seconds and reads each each light sensor . If left sensor reads black then robot turns left until it sees white. If right sensor reads back then it turns right until it sees white. Then it repeats the process. does anyone have any hints?

Books

Subscribe To

Follow by Email

ADULTS/PARENTS: We remove any inappropriate comments/postings as fast as possible. The LEGO® MINDSTORMS® NXT system is for all ages, but it is our goal to provide a blog that is useful to the youngest of tinkerers.

LEGO, MINDSTORMS, RCX, and NXT are registered trademarks of The LEGO Group.