First of all, I will preface this by saying that we already have a few working Autonomous builds, so don’t worry about this being super late in the season - it’s mostly a “add it if we can, scrap it if we can’t” kind of thing.
Anyways, we’re trying to hook up a Pixy cam for tracking the gear pegs. However, we have no real clue what that entails. We have read the porting guide, but any further advice (and especially examples) would be much appreciated. First of all, the cable that came with the Pixy is much too short and doesn’t appear to be able to plug in to the RoboRio. So we need another cable. But should we use I2C or SPI? And, once it is connected, how do we pull the data for two objects in LabView (in order to average the distance and find their center)?
Again, any help is much appreciated, but don’t spend too much time freaking out over how “late” this is.
Our team had a whole lot of trouble getting it working but just recently we got a solution that involves using the arduino to do the processing and then having the arduino send the data for each motor over to the roborio.
I suppose you could but it is so easy with the arduino as you didn’t need a custom cable and there is already sample code. For our code we modified the Hello world code and simply just have a couple if statements that is based off of the average of the two blocks and sends over digital to the Rio if the target is straight ahead to the left or to the right. You also need to configure the pixy camera with pixy mon properly if you want to do it this way however.
If you haven’t yet solved the data to the rio problem, see the porting guide. We used the I2C port on the roboRio - our electrical team made a connecting wire, and we put a little diagram on the back of the 3D printed case in case the wires came out. You can take a look at our code if you want - we borrowed from others and wrote some ourselves. There are folks out there extending what we have done as well.
You’re right, but I have yet to come across code that I’ve been able to use to get the pixy to communicate with the rio over a serial interface.
To be honest, I doubt that you could tune a PID loop to be more effective than a good driver. Personally, I recommend just getting a camera feed to the driver. If one were dead set on using the pixy, I would recommend just getting x-axis data and feeding that to the driver. However, that would probably require serial communication unfortunately.
Does your team use Java? I looked for a github but I couldn’t find one. Regarding last year, a large part of that was that you guys had an excellent shooter. Regarding this year, I’m kinda stopping our work on vision because of how weak fuel is. We have a working shooter (as you saw) but the reality is that we will be able to use the key most of the time and use the camera to line up the rest of the time.
Also, as far as I can tell it would be extremely difficult for our team to make a custom cable. We lack the ability to 3D-print, and our Electrical “Team” is just one kid. Given this, any suggestions on how to connect the Pixy to the rio without using analog/dio?