All Projects → PseudoResonance → Pixy2JavaAPI

PseudoResonance / Pixy2JavaAPI

Licence: other
Pixy2 API ported to Java for FIRST Robotics RoboRIO

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Pixy2JavaAPI

roborio-vm
Scripts to create QEMU virtual machine from the RoboRIO image file
Stars: ✭ 33 (-8.33%)
Mutual labels:  frc, roborio
FRC-Java-Tutorial
A tutorial on how to program a robot for use in the FIRST Robotics Competition
Stars: ✭ 52 (+44.44%)
Mutual labels:  frc, roborio
roborio-opencv
Scripts to build OpenCV for the RoboRIO
Stars: ✭ 13 (-63.89%)
Mutual labels:  frc, roborio
frc-characterization
Tools to help FRC teams measure the physical parameters of their robot
Stars: ✭ 55 (+52.78%)
Mutual labels:  frc
pyfrc
python3 library designed to make developing RobotPy-based code easier!
Stars: ✭ 46 (+27.78%)
Mutual labels:  frc
statbotics
📈 Modernizing Data Analytics for FRC Robotics
Stars: ✭ 20 (-44.44%)
Mutual labels:  frc
frc-score-detection
A program to detect FRC match scores from their livestream.
Stars: ✭ 15 (-58.33%)
Mutual labels:  frc
pathplanner
UI for generating trajectories with Pathfinder, based off of Vannaka's Motion Profile Generator
Stars: ✭ 21 (-41.67%)
Mutual labels:  frc
StuyLib
Award-Winning FRC Library by StuyPulse Team 694
Stars: ✭ 17 (-52.78%)
Mutual labels:  frc
FRC-2019-Public
Public release of Backlash's 2019 FRC Code
Stars: ✭ 62 (+72.22%)
Mutual labels:  frc
robotpy-cscore
Python bindings for the cscore image processing library
Stars: ✭ 17 (-52.78%)
Mutual labels:  frc
NU18
Code for 2018's robot.
Stars: ✭ 13 (-63.89%)
Mutual labels:  frc
first-rust-competition
Rusty Robots: https://crates.io/crates/wpilib and https://crates.io/crates/cargo-frc
Stars: ✭ 45 (+25%)
Mutual labels:  frc
LibDS
Library for controling FRC robots
Stars: ✭ 29 (-19.44%)
Mutual labels:  frc
shuffleboard
A modern dashboard for FRC
Stars: ✭ 70 (+94.44%)
Mutual labels:  frc
pynetworktables2js
Forwards NetworkTables traffic to a web page, allowing you to write custom dashboards for your robot using HTML/Javascript
Stars: ✭ 40 (+11.11%)
Mutual labels:  frc
tbapy
📈 Python wrapper for The Blue Alliance API.
Stars: ✭ 39 (+8.33%)
Mutual labels:  frc
PowerUp-2018
The FRC 2018 programming repository for FRC Team 3695, Foximus Prime
Stars: ✭ 16 (-55.56%)
Mutual labels:  frc
FRC-NT-Client
WPI NetworkTables Client for Node
Stars: ✭ 20 (-44.44%)
Mutual labels:  frc
examples
Repository of RobotPy example projects
Stars: ✭ 25 (-30.56%)
Mutual labels:  frc

Pixy2JavaAPI

Build Status Latest Javadocs

Pixy2 API ported to Java for FIRST Robotics RoboRIO

Port by PseudoResonance (Josh Otake) with help from other various contributors.

Thank you for your support and usage of this API!

Original Pixy2 Code for C++ Arduino

Please read the wiki for more detailed information about Pixy2JavaAPI!


Installing the API

To install the API, it can either be downloaded and copied directly into the project, or you can use it with Gradle/Maven.

The maven repository is located at: https://nexus.otake.pw/repository/maven-public/ The group id is pw.otake.pseudoresonance and the artifact name is pixy2-java-api For FRC Gradle builds, this can be easily added by adding the following to build.gradle in the project's root.

Add maven { url 'https://nexus.otake.pw/repository/maven-public/' } under repositories

Add implementation 'pw.otake.pseudoresonance:pixy2-java-api:1.4.1' under dependencies Make sure to set the API version to latest available.

Your build.gradle should resemble this:

repositories {
    maven { url 'https://nexus.otake.pw/repository/maven-public/' }
}

// Defining my dependencies. In this case, WPILib (+ friends), and vendor libraries.
// Also defines JUnit 4.
dependencies {
    implementation 'pw.otake.pseudoresonance:pixy2-java-api:1.4.1'
    implementation wpi.deps.wpilib()
    nativeZip wpi.deps.wpilibJni(wpi.platforms.roborio)
    nativeDesktopZip wpi.deps.wpilibJni(wpi.platforms.desktop)
    implementation wpi.deps.vendor.java()
    nativeZip wpi.deps.vendor.jni(wpi.platforms.roborio)
    nativeDesktopZip wpi.deps.vendor.jni(wpi.platforms.desktop)
    testImplementation 'junit:junit:4.12'
    simulation wpi.deps.sim.gui(wpi.platforms.desktop, false)
}

If there are issues using the repository, or you don't want to use it, the files can also be copied directly into the project and used, however I ask that you leave the file headers intact, so that others can find the project.


Using the API

First create a Pixy2 camera object with Pixy2 pixy = Pixy2.createInstance(link) and supply the link type of your choosing. Next, initialize the Pixy2 camera with pixy.init(arg). You can either omit arg, or add a value based on the link type.

The Pixy2 can now be called on with the various provided methods as outlined in the documentation included in the code and on the Pixy2 website.

Please read the wiki for more information about how to use the API, including examples.


Supported Links to Communicate with Pixy

SPI, I2C (Untested), UART/Serial (Untested)

New link types can be easily added to support future hardware, or other Java-based projects by implementing Link


Wiring Pixy2 to RoboRIO

SPI is the recommended link type due to it's higher data transfer rate as well as better implementation in the WPILib API which helps with efficiency.

SPI

Pixy2 Port RoboRIO Port
1 MISO
2 5V
3 SCLK
4 MOSI
6 ⏚ Ground
7 CS0 (Optional)

NOTE: Pin 7/CS0 pin is the optional SPI Slave Select (SS) pin. It can be connected to any SS pin on the RoboRIO, CS0, CS1, CS2 or CS3. If slave select functionality is not needed, set the Pixy2 to use the data output Arduino ICSP SPI. Use SPI with SS for slave select support. In the code, the slave pin in use can be selected by using an initialization argument of the corresponding pin. 0 for CS0, 1 for CS1, etc.

I2C

Pixy2 Port RoboRIO Port
2 5V (from VRM)
5 SCL
6 ⏚ Ground
9 SDA

NOTE: The RoboRIO does not have a 5V output for I2C, and thus, the 5V must be sourced elsewhere, such as from the VRM, or another 5V pin.

UART/Serial/RS-232

Pixy2 Port RoboRIO Port
1 RXD
2 5V (from VRM)
4 TXD
6 ⏚ Ground

WARNING: The RoboRIO RS-232 port outputs an RS-232 serial signal, which is incompatible with the Pixy2's TTL serial signal and may result in damage to the Pixy2. An RS-232 to TTL converter board can be used, or the Pixy2 can be wired to the TTL serial pins in the RoboRIO's MXP expansion port.

NOTE: The RoboRIO does not have a 5V output for UART/Serial/RS-232, and thus, the 5V must be sourced elsewhere, such as from the VRM, or another 5V pin.

Pixy2 Pinout

Pixy2 Pinout

Pixy2 Connection Guide

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].