3pi white line follower

3pi White line follower

Hi team
This is related to 3pi PID line follower
I have found how to change the codes using Atmel Studio to follow white line on black background
Ex

unsigned int position = read_line_white(sensors,IR_EMITTERS_ON);

Please advice how may I change the code in Arduino environment to detect white line follower

Hello, Dayan.

You need to set the whiteLine argument to true when calling readLine . For more information, see the documentation for readLine in the “3pi Robot Functions” section of the Pololu AVR Library Command Reference guide.

- Amanda

Hello Amanda

Thanks for the reply
I go through the following link https://www.pololu.com/docs/0J18/19 but I could not get the logic. Can you please provide the modified code instead of following code

unsigned int position = robot.readLine(sensors, IR_EMITTERS_ON);

Is this correct
unsigned int position = robot.readLine(sensors, IR_EMITTERS_ON,0);

Hello, Dayan.

If you are using a white line on a black surface, you can use a whiteLine parameter of 1 when you call readLine(), for example:

position = readLine(sensors, IR_EMMITTERS_ON, 1);

Brandon

hello Brandon
It is well clear now
Can you advice me how about sensor calibration code changed to be done follow the white Line

As well as

Once I set the white line follower code like this

position = readLine(sensors, IR_EMMITTERS_ON, 1);

Then I need to reset the black line follower

position = readLine(sensors, IR_EMMITTERS_ON, 0);

or

position = readLine(sensors, IR_EMMITTERS_ON);

Thanks in advance

You should not need to change anything for the calibration. If you are reading the position of the sensor over a white line, you can use position = readLine(sensors, IR_EMMITTERS_ON, 1); and if you are reading the position of the sensor over a black line, you can use position = readLine(sensors, IR_EMMITTERS_ON, 0);. If your course has sections of both, your robot will need to determine which section it is currently in and use the correct whiteLine parameter.

Brandon

hello brandon!!!
I want to follow this line , I should use read line function or read line white function?putus putus

You can see an example of both white and black line courses in this forum post). The course shown in your diagram is a segmented black line on a white surface, so you would use the normal readLine() function with the whiteLine parameter of 0. However, the readLine() function does not do anything special to handle segmented lines; it simply returns the current position of the line being detected, so you might need to add some extra logic for detecting when the line is segmented and acting appropriately (e.g. when the line disappears, go straight until the line is detected again).

Brandon

ok thanks , I try it