wiki:ControlSystems/SoftwareTeam/Training/AdvancedTraining/FRCVision

FRCVision is a software suite that makes it easier to use a Raspberry Pi to offload vision processing tasks from the RoboRIO. Below is the recommended process for vision development:

You will need:

  • RoboRIO
  • 12V DC power source supplied by robot OR you can use an external power supply (ask an electrical mentor for help); you'll need:
    • 12VDC AC adapter rated for at least 1A such as these
    • DC barrel jack pigtails such as these
    • RoboRIO power connector such as these
  • Raspberry Pi 3B or 3B+ (4 is not recommended due to need for active cooling (fan).
  • MicroSD Card at least 8GB or larger from a reputable manufacturer such as this one (cheap cards such as Patriot often won't work).
  • Laptop with SD reader/writer or a USB reader/writer for uSD cards
  • Raspberry Pi Camera with cable or USB webcam
  • 5V/2A or higher micro-USB power supply or a micro-USB cable and a USB 3.0 port on your laptop
  • 3x Ethernet cables
  • Ethernet Switch

Helpful:

  • Download FRCVision here
  • Follow the instructions here to install the FRCVision image on the microSD card
  • Connect the camera to the Raspberry Pi
  • Install the uSD card in the Raspberry Pi

By Default, the Raspberry Pi requires a wired Ethernet connection; this is because WiFi? is not permitted at competitions. To connect the Pi, the RoboRIO, and your computer for development, it's easiest to connect everything using wired Ethernet and an Ethernet switch:

  • Connect the Ethernet Switch to your local area network
  • Connect the Raspberry Pi Ethernet port to the Ethernet Switch
  • Connect the RoboRIO Ethernet port to the Ethernet Switch
  • You may need to configure the RoboRIO for DHCP so it will get an IP address from the local area network rather than using its fixed static IP address of 10.25.37.2
    • Connect the USB cable from your laptop to the RoboRIO
    • Open a web browser and connect to the RoboRIO at 172.22.11.2 (the IP address assigned to the USB connection)
    • Select the Ethernet page and under Configure IPv4 Address select "DHCP or Link Local"
    • Before competition or when you are done with development, remember to set it back to Static with IP address 10.25.37.2
  • Power up the Raspberry Pi and allow time for it to boot (may take 30s or longer)
  • Try connecting to the Raspberry Pi web server at http://frcvision.local (if this doesn't work, you're going to have to figure out the IP address the Pi has been assigned and connect to it directly (e.g. http://172.30.1.25). You can get the IP address by querying your router if you have access or by or by connecting a monitor to the Pi HDMI port and a keyboard to a Pi USB port and logging in (username is 'pi' password is 'raspberry') then use the ipconfig -a command to see the assigned IP address for the Ethernet port.

If all went well, you should be able to download code to your RoboRIO and when you launch the driver station, you will have a new camera choice: 'rPi Camera 0' that is streaming video. The next step is to start writing java code that runs on the roboRIO, does vision processing, and sends processed results (e.g. coordinates of a target) back to the Rio using Network Tables. Network Table support is included with FRCVision and you can view an extensive set of variables included by default in the Variables tab of the Smart Dashboard.

FRCVision provides sample vision processing code in C++ and Java. To build the Java vision processing example code, you will need Java 11 installed and:

  1. Download and install Gradle (the tool used for building):
    1. create a C:\Gradle folder
    2. download gradle from here
    3. extract the gradle folder 9e.g. gradle-6.0.1) from the downloaded zip file into C:\Gradle
    4. add the extracted bin folder (e.g. C:\Gradle\gradle-6.0.1\bin) to the Windows search path.
  2. Download and build the Java vision processing example code
    1. Download the example (java-multiCameraserver.zip) from here
    2. Extract the .zip file into a folder in your RobotProjects folder (e.g. FRCTest1)
    3. Open the folder in VSCode
    4. Open a terminal window in the folder: Select folder then View->Terminal
    5. Build the example using the command gradle build
    6. You should now have a jar file (e.g. java-multiCameraServer.jar) in the project build/libs folder ready for upload to your pi
  3. Connect to your FRCVision Pi and upload the application:
    1. Connect your browser to http://frcvision.local (if that doesn't work, you'll need to find the IP address of your Pi - often 10.25.37.3)
    2. Select the Application tab
    3. Under vision application configuration, select upload executable file, browse to the build/libs folder of your project, select java-multiCameraServer.jar (or whatever jar file you've built), and press the Upload and Save button
    4. Select the Vision Status tab and enable console output to see the program output

See here for more info

Last modified 5 years ago Last modified on Jan 11, 2020, 5:40:06 PM