Pixy2 Not initializing in Java

Hi,
I am currently attempting to use a Pixy2 Camera on our robot for this season of FRC I cant get it to initialize. We have it wired using I2C after SPI didn’t work for us. We used a library I found on GitHub for java (Link in replies). The onboard indicator light is on but library commands are not getting through to the pixy. It is indicating on the Pixy2 itself that it is picking up the game objects but it is not showing on our code. Here is our subsystem code: (https://github.com/1138programming/2022-FRC-Robot/blob/FullSystemTesting/src/main/java/frc/robot/subsystems/Intake.java). Here is the command we are using to test the pixy2: (https://github.com/1138programming/2022-FRC-Robot/blob/FullSystemTesting/src/main/java/frc/robot/commands/Intake/HuntMode.java). We used pixymon to set Pixy2 signatures and were able to pick up the game objects. When using microUSB to the computer, the Pixy2 is fully functional. When we try to initialize the Pixy using the library’s init function, it returns -4 (negative number means failed to initialize). Thanks.

Pixy2 Library Link (https://github.com/PseudoResonance/Pixy2JavaAPI#using-the-api)

We are seeing similar thing. Using SPI port on roborio(not mxp). Works using usb/pixymon. Does not work using this example from repo wiki: Using the API · PseudoResonance/Pixy2JavaAPI Wiki · GitHub

The -4 from init method is a timeout? https://github.com/PseudoResonance/Pixy2JavaAPI/blob/297ee781d7b6caef345adae267e5a821d6f19627/src/main/java/io/github/pseudoresonance/pixy2api/Pixy2.java#L69

Don’t have a solution yet but just wanted to share we are in similar situation.

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