Recent Changes - Search:

Tracking

Hardware

Software

Mega Plan

Etc.

HowToUseVision

How to use the vision libraries

The vision system was recently overhauled to allow for the flockbot to select, and change, the currently processing vision library during its execution.

The system initially begins by starting up OpenCV (ver. 2.3 c++) and the camera system. Once everything is ready for processing, the vision thread blocks and awaits instructions on which library to load and run. The step to select the library may be taken from either an on-board behavior (Dynamic C or Lua script), or can be sent from a connected client over the socket on port 2005.

Once the vision system begins processing, it will process images until it receives the instruction to shut down and prepare itself for the next library command. This means that your program can switch libraries mid-execution as necessary for your computations. Below are the series of steps needed for both approaches.

C/Lua

  1. Include the appropriate library header (ie. zbarcode.h/barcode.h/blobtrack.h).
  2. Execute the <library>_run() function to start the library (ie. zbarcode_run()/barcode_run())
  3. Call the functions via the provided API to access the processed vision data (ie. ary = zbarcode_get_barcodes())
  4. When finished, shut down the library with the shutdown_run() command.

Example:

#include <stdio.h>
#include <stdlib.h>
#include "barcode.h"

void *start_behavior(void *args) {
  camera_forward();
  barcode_run();
  while((val = barcode_get_barcodes()) == -1);
  printf("Received a barcode.  Found: %d\n", val);
  shutdown_run();
  return;
}

Socket

  1. Send <len>VR<library> to begin vision processing (ie. 10VRbarcode, where 10 is a binary value, not ASCII)
  2. Send 2VS to begin receiving processed vision data from the Flockbot (The format will be specified by the library author)
  3. Send 2VF to stop receiving processed vision data
  4. Send 2VK to shutdown the vision processing
Edit - History - Print - Recent Changes - Search
Page last modified on April 08, 2014, at 08:39 PM