How do you program a line tracker?

#1

How do you program a line tracker?

0 Likes

#2

Here is a document that can help you out
http://cdn.robotc.net/pdfs/natural-language/hp_line_follower.pdf

0 Likes

#3

Thank you for showing me that.

0 Likes

#4

You are welcome. If you look up vex line tracker code you can find lots of PDFs with information about how to program them.

0 Likes

#5

This is not a code sample, but it does give you a description of how to use a line tracker. Warning – this uses words, and you will have to read the words to understand it. One of the most important things to note is that the black value and white value are going to be different on every run because of lighting differences, so you need to set them dynamically for each run.

7 Likes

#6

Wise advice for reading the game manual too :slight_smile:

11 Likes

#7

We don’t use V5 yet. How do we code it?

0 Likes

#8

I am building an elevator. I need to you use a bump until the line tracker. What should I do? I tried waitUntil but that isn’t working. Help!!!

0 Likes

#9

I would start by describing your problem more thoroughly.

1 Like

#10

Plugging it in is a good place to start. Also this is on the docs and downloads tab on its product page. Also from the product page, sample code.

Sounds like a Principles of Engineering project to me. However you’re a little confusing, are you trying to run your elevator until the line tracker picks up on some form of indicator? Is there a line tracker looking for an elevator to pass by?
Okay, I’m gonna drop this right now (if you want fight me) but I’ve found most of the robotC built-in functions to be completely broken. Last year when this came up instead of using the waitUntil statement we utilized an infinite loop that would only end when a certain criteria was met from the sensor. (see below)

while (!(sensorValue(someSensor) < 500)) {}
    // the program will get stuck on this loop until someSensor's 
        value is less than 500

I don’t know if there’s anything with programming conventions and all but there is literally nothing in the while loop

1 Like

#11

thanks!!!

1 Like

#12

what is threshold???

0 Likes

#13

I found this site http://cdn.robotc.net/pdfs/natural-language/hp_thresholds.pdf but I’m still confused. How are they used?

0 Likes

#14

I’m waiting until the line tracker picks up on some form of indicator.

0 Likes

#15

Here’s my code so far-
task main()
{
int threshold = 230;

if (SensorValue(Floor1button) == 1)

startMotor(PulleyMotor, 127);
waitUntil(SensorValue(Floor1) == threshold);
stopMotor(PulleyMotor);

}

0 Likes

#16

And that’s where you’re going wrong. My advice goes:
Try putting your line tracker in front of your ‘indicator’ and let it sit there for awhile. Use the robotC Sensors tab to see what values it’s outputting and work from there. Due to the nature of the line tracker (and really, a lot of sensors) When it picks up on an object it gives a range of values, which sometimes depends on the quality of the sensor or what you’re looking at. Chances are when the line tracker is looking at your indicator its probably not going to give you exactly 230. Try changing the condition of the while loop:

while (!((sensorValue(somesensor) > 200 && sensorValue(somesensor) < 300) {}

Now that line will be checking if the value of the sensor is greater than 200 but less than 300. (200 and 300 are arbitrary numbers, you’ll have to find the values yourself)

3 Likes

#17

Thanks!!!

0 Likes

#18

what is threshold and how does it work?:confused:

0 Likes

#19

I have three line trackers will it work for all three?

0 Likes

#20

I changed the channel to the programming language you are using. If you are not using ROBOTC and I am wrong about what I am assuming that you need help on, you can change it to the channel of the coding platform you are using. :wink:

1 Like