<< return to Pixycam.com

Selecting middle line of three parallel to be vector

Hi!

I am building a line following robot with pixy2 and arduino. In this project the line that the robot is supposed to follow is alone at some times and sometimes there are two extra identical lines that are parallel to the line I want the robot to follow.

When there are only one line the robot tracks the line without a problem. However, when the two extra parallel lines appear the trouble begins. I want the robot to follow the line in the center of the three but sometimes the pixy2 chooses one of the other lines as the main vector. Is there any way to tell the pixy2 to always choose the line in the middle as it’s main vector?

Here is a picture of how the line looks.

Hello,
You can’t tell Pixy to ignore the other lines, but you should reliably be able to detect all lines. If lines are close to each other, Pixy will try to merge them so you might try to decrease the “maximum merge distance” and see if that helps:
https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:pixymon_index#line-tracking-expert-tab

You might also try to increase the “line filtering”.

Pixy2 will also select the primary line only report it if you call getMainFeatures(). You should call getAllFeatures(). This will return all lines that Pixy sees and you can select the middle line.
https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:line_api

Hope this helps :slight_smile:

Edward