Greetings to y’all, we are looking for assistance to use the Pixy camera, this year we really intend to have vision processing, we have read many articles and many posts here in ChiefDelphi but we still don’t fully get how we can wire the pixy to the roboRIO and how the robot will get the data from the pixy.
The most useful code that we have found is from user 2B||!2B in another post, but i understood that he was using the MXP port, and i don’t have any idea how he did that.
We would like to use the Pixy Camera through the SPI port on the roboRIO.
We are also using the navx-mxp on the MXP and communicating through I2C, I’m not sure if it’s correct using both, if we don’t need the I2C for the navx we could try using it for the Pixy :yikes:
Thanks for the assistance teams!
I2C is a bus - you can connect multiple sensors to one port. If you take a look at the NavX you’ll notice there are four pins labeled I2C - you can hook another I2C device up there. The only problem you might encounter is if two devices have the same I2C address - not likely, unless you use two of the same sensor.
If you are using navX-MXP, you can communicate with it using SPI - which is even faster than the I2C bus and is what hundereds of other teams are using. Using SPI would free up the navX-MXP from using 7-bit I2C address 50 (hex 32), in the case of an addressing conflict.
If you have any questions or encounter troubles, feel free to contact support@kauailabs.com - we’re here to help.
- scott
Thanks! Communicating with the navx hasn’t been a problem, we already used USB connection and I2C, we will communicate if we encounter more difficulties, thank you very much.
But still, we don’t know how to acquire data from the pixy, something else that i haven’t seen in any post about the pixy is getting the image and being able to see it on the dashboard. Please help hahaha, we are now able to plug it either USB, I2C, SPI, we just need to understand how to get the data AND the image. Please help :ahh:
You cannot do both with pixy if I remember right. Use a usb web cam for drivers, use the pixy for targeting type stuff. Pixy uses different protocols depending which method you use to hook it up. Pixy hooked up via spi,i2c, etc… sends target data only. Pixy hooked up via usb sends image stream in addition to target data. But you need ‘pixymon’ or some equivalent code to see the image stream. Also I don’t think you can hook up pixy via usb and other connections(spi,i2c,etc) at same time. I can’t find exact reference to this right now… maybe it was in here?
http://cmucam.org/projects/cmucam5/wiki/Porting_Guide
The porting guide has lots of good info.
Search on CD for code examples or github for code examples.
Good luck!
-Maciej
This was helpful, thank you very much.
Now we only need to understand how to wire the Pixy correctly and get the data in Java depending on which communication protocol we used. I already know that we need to use Pixymon for configuring the output ports.
Thanks again for the assistance teams, it has been very useful.
We use arduino to get data from pixy and send to rrii because it is more easier cause there is a arsuino pixy library.also we use i2c to communicate arduino and rrio if you want i can send our arduino and java codes
Thanks but that would remove our navX since we are using the MXP for that
We need the pixy to communicate directly with the roboRIO.
I2C, RS232, SPI, we can use anything if you guys help us with images of the wiring and its coding. We are learning something new everyday but we haven’t got to make it work.
Thanks for the help teams!
Our team used i2c to connect our pixy to roborio. Here’s a thread one of our mentor’s posted with pictures showing how we hooked up pixy:
Our code is in Java. You can find our pixy code here:
The Pixy classes and Vision.java are what you should start with. The ‘comments’ branch has added more comments and cleaned up the code, but never got to merge/test it to master branch.
You can search on github for more examples… something like this:
Here are a bunch of other CD threads that mention code and links…
https://www.chiefdelphi.com/forums/showthread.php?t=157657&highlight=pixy
https://www.chiefdelphi.com/forums/showthread.php?t=157908&highlight=pixy
-Maciej
This has been very useful. Think we are almost there, we managed to wire it for I2C, right now we are working to adapt your code for our robot. I think it’s great that you have your code so well commented on github. Thanks for sharing!
Thank you all guys! I’ll post again if anything pops up
The roboRIO has 2 I2C “ports” What we do as a team is plug the navx directly into the MXP port, and then plug in the pixy to I2C. If you need code, we think we have it figured out for java. Respond to this post or PM me if you need help.
Our library has pixy camera support for a number of connectivities: I2C, Serial and SPI. The code is organized into different layers. The physical layer deals with the physical connectivity:
https://github.com/trc492/Frc2017FirstSteamWorks/blob/master/src/frclib/FrcPixyCam.java
https://github.com/trc492/Frc2017FirstSteamWorks/blob/master/src/frclib/FrcI2cDevice.java
https://github.com/trc492/Frc2017FirstSteamWorks/blob/master/src/frclib/FrcSerialPortDevice.java
The protocol layer deals with parsing the object block regardless of what bus the pixy is connected to.
https://github.com/trc492/Frc2017FirstSteamWorks/blob/master/src/trclib/TrcPixyCam.java
Hi AlkyAky - I am working with a team and a pixy2 - would you send me your arduino and java code please - or github location.
Thank you