How to make the pixy cam detect objects, for the robot intake to run automatically

I am new to my team and I have to find out how to get the robot to detect an object so that the intake can automatically pick up the ball, I’ve been looking around and haven’t found anything yet. Can anyone help?

Are you programming in Java or Labview?

Try looking into this…

Are you asking about how to wire it? How to write s/w for it?
Start with a search on CD:
Then after you read thru some threads and the pixy2 docs ask more questions.


I don’t know how to wire or write software for the pixy cam

Check out this Pixy2 library for communicating with the pixy2.

Our team used the pixy2 last season to line up for hatch placement. We used the SPI interface for connecting to thePixy2.

public static Pixy2 pixy = Pixy2.createInstance(new SPILink());

Here’s a link to how we used the Pixy2 for line follow last year. I’m guessing you want to use the pixy for color detection or identifying power cells. Hopefully this code is instructive for how to communicate to the pixy in general.

1 Like

Thank you very much! Hopefully I can work something out.

Sorry, Randomstring beat me to the punch. However, now I realize, there were some pieces in my post that could help…
You have two options.

  1. Use a co-processor (usually aArduino or Raspberry pi). With those, you setup the device just like the Pixy site tutorial, and then output your data through gpio or network tables.

  2. Connect directly to the rio (this may involve working in the linux shell on the rio, I am not certain. That is important to be aware of because you could mess up the file system that way. The first time it happens, it causes panic, and mass confusion and anxiety, yet. It is almost certainly not bricked. Contact NI for a reflashing tool, and you will be fine (they are free downloads that you put on a flash drive; hint, if you get there, use a flash drive with a light on it. It will help you understand what is happening).

I could be wrong with number 2. We are using number 1 and Python as our language of choice.

Good luck.

~Mr. R^2

1 Like

Thank you! Anything helps!

This library for the WPILib makes communicating directly between the RoboRIO and the pixy pretty straight forward. No need to muck around with the linux shell.


Connecting to a co-processor (pi or Arduino) is also a good option.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.