Changes between Version 36 and Version 37 of VisionFramework


Ignore:
Timestamp:
Nov 25, 2017, 12:12:48 PM (7 years ago)
Author:
benjialbert
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • VisionFramework

    v36 v37  
    11= Vision Framework =
     2
     3Mentors: Joy Cho
     4
     5Students: Reid Huntley, Benji Albert, Nathan Misner
     6
     7== Background ==
     8In 2015-2017, team 2537 developed a machine vision platform for autonomous targeting and navigation.  It was first used successfully during the 2016-2017 season and helped the team reach the finals at the world championship.  The vision platform is based on the [https://www.raspberrypi.org/products/raspberry-pi-3-model-b/ Raspberry Pi 3] with [https://www.raspberrypi.org/products/camera-module-v2/ camera module] in a [https://www.amazon.com/Distributed-MCM-83-17540-Enclosure-Raspberry/dp/B01KGTD3I0 clear case].  The 2016-2017 version used an [https://www.amazon.com/eBoot-MP1584EN-Converter-Adjustable-Module/dp/B01MQGMOKI MP1584EN power supply] to convert the 12v battery voltage to the 5v required for the machine vision hardware.  It also included a transistor switch to allow the Pi to control power to a [http://www.andymark.com/product-p/am-3597.htm green 12v LED light ring].  Communication between the Pi and roboRIO was uni-directional using PWM.
     9
    210== Objective  ==
    3 Create a reprogrammable module in which a Raspberry Pi 3, protective case, power cable, light ring, and camera are self contained and execute a base program on startup.  The base code of the module continuously reads the camera feed (subscribes to camera) and publishes corresponding data via the Pi's serial output (located on the Pi's GPIO connector). This data can then be fairly simply read by the RoboRIO. We hope that this will make implementing a vision subsystem a more simple proposition, allowing more teams to do so.
    4 ----
    5 ----
    6 ----
    7 ----
     11Extend the vision module to make it more accessible to other teams and more user friendly generally.  Changes planned for the 2017-2018 season include:
     12* Execute a base program on startup that continuously reads the camera feed (subscribes to camera) and publishes corresponding data via the Pi's serial output (located on the Pi's GPIO connector). This data can then be fairly simply read by the RoboRIO.
     13* Replace the 12v monochrome LED ring with a smart Neopixel-compatible 12x RGB LED light ring based on the WS2812 controller.  This will allow the module to run entirely from 5vdc and provide teams with the ability to select their light-ring color and even make some fancy light shows.  Smart light rings are available from [https://www.adafruit.com/product/1643 adafruit] and [https://www.ebay.com/itm/12Bit-WS2812-5050-RGB-LED-Ring-Strip-Integrated-Drivers-for-Arduino-Module/391717334432 eBay] among other sources.  You can read about the neopixels [https://learn.adafruit.com/neopixels-on-raspberry-pi/overview here].  Neopixel control can be achieved using many libraries including [http://diozero.readthedocs.io/en/stable/ diozero]; see also [http://rtd.diozero.com/en/latest/LEDStrips/ here]
     14
    815== Materials ==
    9 * Clear Case
    10 * Raspberry Pi 3
    11 * Micro SD card
    12 * Usb Keyboard
    13 * Usb Mouse
    14 * HDMI cable
    15 * Monitor (that accepts HDMI input, or use an HDMI to VGA adapter)
    16 * Ribbon Cable Camera
     16* [https://www.amazon.com/Distributed-MCM-83-17540-Enclosure-Raspberry/dp/B01KGTD3I0 Clear plastic case]
     17* [https://www.raspberrypi.org/products/raspberry-pi-3-model-b/ Raspberry Pi 3]
     18* [https://www.raspberrypi.org/products/camera-module-v2/ Pi camera module w/cable]
     19* [https://www.adafruit.com/product/1643 NeoPixel Light Ring]
     20* 8GB or larger Micro SD card
     21* Usb Keyboard and Mouse (for developing on the Pi)
     22* HDMI cable or [https://www.amazon.com/gp/product/B016HL49OS HDMI-to-VGA adapter] (for developing on the Pi)
     23* Monitor (that accepts HDMI or VGA input)
    1724* Micro USB Cable
    18 * Adafruit NeoPixel Light Ring
    19 * 3 individual male to female PWM wires
    20 * 3 individual female to female PWM wires
    21 ----
    22 ----
    23 ----
    24 ----
     25* Qty 3 M-F and qty 3 F-F [https://www.amazon.com/gp/product/B017NEGTXC jumper wires]
     26
    2527== Raspberry Pi Setup ==
    2628
     
    6466sudo shutdown -r now
    6567}}}
    66 ----
    67 ----
    68 ----
    6968=== X server ===
    7069Install Xorg and Xinit:
     
    9695navigate to {{{Edit -> Profile Preferences -> Colors}}} to deselect {{{Use colors from system theme}}}[[BR]]
    9796select {{{Built-in schemas: White on black}}}
    98 ----
    99 ----
    100 ----
     97
    10198=== Development Tools ===
    10299==== Java 8 ====
     
    122119}}}
    123120
    124 ----
    125 ----
    126121==== Pi4J (Java-GPIO Interface) ====
    127122Now we can install [http://pi4j.com/install.html pi4j], a Java interface for the pi GPIO:
     
    130125}}}
    131126
    132 ----
    133 ----
    134127==== rpi_ws281x (NeoPixel Control Library) ====
    135128Then we can use the rpi_ws281x library for controlling the [https://www.adafruit.com/category/168 Adafruit NeoPixel lightring][[BR]]
     
    146139}}}
    147140
    148 ----
    149 ----
    150141==== OpenCV ====
    151142
    152143First of all, order some pizza or something because this is going to take about 3 hours (if you are lucky).
    153 
    154 '''EDIT: we have tried with a heatsink as well.  It doesn't work.  You need to water cool your pi.  Please skip to the WATER COOLING section.'''[[BR]]
    155144
    156145Also, you need a heatsink for your processor before building OpenCV.  If you see this overheating symbol, you will die.  Straight up.[[BR]]
    157146[[Image(https://i.imgur.com/kYydNgVm.jpg)]][[BR]]
    158147
     148'''EDIT: we have tried with a heatsink and by itself, it didn't work.  You need to used forced air (fan) or water *and* a heatsink to cool your pi.  Please skip to the WATER COOLING section.'''[[BR]]
     149
    159150If you don't have a heatsink on hand, tape some pennies to the CPU like we did:[[BR]]
    160151[[Image(https://i.imgur.com/KqWLvKJm.jpg)]][[BR]][[BR]][[BR]]
    161152
    162153'''================WATER COOLING================'''[[BR]][[BR]]
    163 If this still doesn't work, it may be necessary to water cool your pi:[[BR]]
     154Poor man's water cooling system:[[BR]]
    164155[[Image(https://i.imgur.com/DPOazIJm.jpg)]][[BR]]
    165156Make sure to change the ice cube at least once every half hour.  Also, only single bag the ice cube.[[BR]][[BR]][[BR]]
     
    184175NOTE: we could not get the java wrapper to work with ffmpeg enabled (we ran into a Segmentation fault with opencv libs 3.2.0, 3.3.0, and 3.3.1).  We gave up and disabled it.[[BR]]
    185176
     177NOTE: All of the below steps work with OpenCV versions 3.2.0, 3.3.0, and 3.3.1.  Use whichever you prefer.
     178
    186179If you do not want to git clone the master opencv repository, download a zipped version:
    187180[https://github.com/opencv/opencv/archive/3.2.0.zip opencv-3.2.0.zip][[BR]]
    188 ----
    189 ----
    190 ----
     181
    191182=== Java Projects with OpenCV ===
     183
    192184==== Enable VideoCapture ====
    193185First, to allow OpenCV VideoCapture to access the ribbon cable camera, execute the following:
     
    219211* {{{Main_class = name of the class file with main method}}}
    220212 * For example, where {{{Vision.class}}} is the class file, {{{Main_class = Vision}}}
    221 ----
    222 ----
    223 ----
     213
    224214=== C++ Projects with OpenCV ===
    225215'''NOTE: our performance doubled when we transitioned to C++ from Java'''[[BR]][[BR]]