Skip to content

the Cyborg Cats' ZED + birds eye vision code for FRC Power Up 2018

Notifications You must be signed in to change notification settings

Team4256/4256-18-ZED

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

4256-18-ZED

Threading model

The Python vision code runs six threads which communicate with each other using Python's MPMC queue.Queue. Threads are encapsulated around classes, and execute their run() methods in a loop. Here is a list of the threads, their functions, and the queues they use to communicate:

  • ZED()

    • Inputs: The ZED hardware
    • Outputs: zed_odometry_queue, zed_image_queue
    • Purpose: This runs in a tight loop getting data from the ZED and pushing it to the other threads.
  • USB(input_camera, destination_queue) (two threads, one each for left and right cameras)

    • Inputs: the specified input camera
    • Outputs: the specified destination queue (camera_queue_L or camera_queue_R)
    • Purpose: Reads a single camera using OpenCV and posts its image to a dedicated queue in a tight loop. OpenCV reads the camera at 30Hz, so there's a lot of waiting in this loop. There are two USB threads...one for the left-facing camera and one for the right-facing one.
  • Stitching()

    • Inputs: zed_image_queue, camera_queue_L, camera_queue_R
    • Outputs: stitched_image_queue
    • Purpose: Process raw ZED binocular images into a "stiched" overhead image
  • NetworkTables()

    • Inputs: zed_odometry_queue
    • Outputs: NetworkTables
    • Purpose: Take the latest updates from zed_odometry_queue and post them to the global NetworkTables.
  • MJPEG.ThreadedHTTPServer()

    • Inputs: stitched_image_queue
    • Outputs: supports a GET handler to send the three up-to-date images to the drive station
    • Purpose: provide up-to-date imagery to the drive station