<< return to Pixycam.com

Arduino Pixy line following

hi all

I am planning on using pixy for making a line following robot for the robocup junior australia competition. However I am not sure wether or not the pixy will be good for line detection as the line is black on a white background. I’ve heard glowing reports from someone who used a v4. However I am not sure how I should program for pixy to detect the line. I am presuming that I will use the x coordinates mainly, and depending how far left or right the line is control motor speed.
Would there be a better way of using pixy to detect the line?

Thanks
Lindsay

You probably won’t be able to reliably train Pixy on a black object. Worth a try, but you’d be better off with objects that have a distinct hue. I think you’d be okay just tracking the x coordinates of the black pixels and adjust accordingly.

Scott

how do you track the x and y coordinate . which variable must we use

Hey Kenneth!

I was able to teach my robots to follow a line using Pixy as a feedback sensor for my motors. Your line/lane must have some distinct color. You can assign a color signature to your lane.
Then you can cycle trough detected blocks and pick out the once that have your lane color signature. Then you could find the largest block and get its center’s x coordinate (which goes from 0 to 320, so as you drive around you want to see your lane block at x=160). Turning is a bit more tricky, you would need to develop your own algorithms !

Hey Vadim,

i am working a project that teach my small car to follow a line. Can you now teach your Roboter to turn?

Bin

Hi Bin Du!

Im not exactly sure what you mean by teaching robot to “turn”.

I got my robot to follow a lane which has turns. In my case, i have a lane (bright pink and orange color) and it has both smooth arcs and sharp 90 degree turns. Pixy grabs centroid location of detected lane and im using it as a feedback for a PD type controller. 90 Degree lane turns are a little bit trickier, you may need to cover the lane corner, otherwise your robot may not turn as expected and just continue going straight