int chaseLoop() { uint16_t x, y; BlobA *blobs, *blob; BlobB *ccBlobs; uint32_t numBlobs, numCCBlobs; // create blobs g_blobs->blobify(); blob = (BlobA *)g_blobs->getMaxBlob(); if (blob) { x = blob->m_left + (blob->m_right - blob->m_left)/2; y = blob->m_top + (blob->m_bottom - blob->m_top)/2; combine(x, y); } else { rcs_setPos(LEFT_AXIS, RCS_CENTER_POS); rcs_setPos(RIGHT_AXIS, RCS_CENTER_POS); } // send blobs g_blobs->getBlobs(&blobs, &numBlobs, &ccBlobs, &numCCBlobs); cprintf("chaseLoop"); cc_sendBlobs(g_chirpUsb, blobs, numBlobs, ccBlobs, numCCBlobs); cc_setLED(); return 0; }
int blobsLoop() { BlobA *blobs; BlobB *ccBlobs; uint32_t numBlobs, numCCBlobs; // create blobs g_blobs->blobify(); // handle received data immediately handleRecv(); // send blobs g_blobs->getBlobs(&blobs, &numBlobs, &ccBlobs, &numCCBlobs); cc_sendBlobs(g_chirpUsb, blobs, numBlobs, ccBlobs, numCCBlobs); ser_getSerial()->update(); cc_setLED(); // deal with any latent received data until the next frame comes in while(!g_qqueue->queued()) handleRecv(); return 0; }
int ptLoop() { int32_t panError, tiltError; uint16_t x, y; BlobA *blob, *blobs; BlobB *ccBlobs; uint32_t numBlobs, numCCBlobs; // create blobs g_blobs->blobify(); blob = g_blobs->getMaxBlob(); if (blob) { x = blob->m_left + (blob->m_right - blob->m_left)/2; y = blob->m_top + (blob->m_bottom - blob->m_top)/2; panError = X_CENTER-x; tiltError = y-Y_CENTER; g_panLoop.update(panError); g_tiltLoop.update(tiltError); } // send blobs g_blobs->getBlobs(&blobs, &numBlobs, &ccBlobs, &numCCBlobs); cc_sendBlobs(g_chirpUsb, blobs, numBlobs, ccBlobs, numCCBlobs); cc_setLED(); return 0; }
void ButtonMachine::ledPipe() { uint8_t r, g, b; BlobA blob(m_index, (CAM_RES2_WIDTH-BT_CENTER_SIZE)/2, (CAM_RES2_WIDTH+BT_CENTER_SIZE)/2, (CAM_RES2_HEIGHT-BT_CENTER_SIZE)/2, (CAM_RES2_HEIGHT+BT_CENTER_SIZE)/2); cc_sendBlobs(g_chirpUsb, &blob, 1); getColor(&r, &g, &b); saturate(&r, &g, &b); led_setRGB(r, g, b); }
int blobsLoop() { BlobA *blobs; uint32_t numBlobs; // create blobs g_blobs->blobify(); // send blobs g_blobs->getBlobs(&blobs, &numBlobs); cc_sendBlobs(g_chirpUsb, blobs, numBlobs); ser_getSerial()->update(); cc_setLED(); return 0; }
int32_t cc_setSigPoint(const uint32_t &type, const uint8_t &model, const uint16_t &x, const uint16_t &y, Chirp *chirp) { RectA region; int result; char id[32]; ColorModel cmodel; if (model<1 || model>NUM_MODELS) return -1; cc_setBounds(type); if (g_rawFrame.m_pixels==NULL) { cprintf("No raw frame in memory!\n"); return -2; } result = g_blobs->generateLUT(model, g_rawFrame, Point16(x, y), &cmodel, ®ion); if (result<0) { cprintf("Color saturation isn't high enough!\n"); return result; } if (chirp) { BlobA blob(model, region.m_xOffset, region.m_xOffset+region.m_width, region.m_yOffset, region.m_yOffset+region.m_height); cc_sendBlobs(chirp, &blob, 1, RENDER_FLAG_FLUSH | RENDER_FLAG_BLEND_BG); } cmodel.m_type = type; // save to flash sprintf(id, "signature%d", model); prm_set(id, INTS8(sizeof(ColorModel), &cmodel), END); prm_setDirty(false); // prevent reload (because we don't want to load the lut (yet) and lose our frame cprintf("Success!\n"); return result; }
int blobsLoop() { #if 1 BlobA *blobs; BlobB *ccBlobs; uint32_t numBlobs, numCCBlobs; static uint32_t drop = 0; // create blobs if (g_blobs->blobify()<0) { DBG("drop %d\n", drop++); return 0; } // handle received data immediately handleRecv(); // send blobs g_blobs->getBlobs(&blobs, &numBlobs, &ccBlobs, &numCCBlobs); cc_sendBlobs(g_chirpUsb, blobs, numBlobs, ccBlobs, numCCBlobs); ser_getSerial()->update(); // if user isn't controlling LED, set it here, according to biggest detected object if (!g_ledSet) cc_setLED(); // deal with any latent received data until the next frame comes in while(!g_qqueue->queued()) handleRecv(); #endif #if 0 Qval qval; static int i = 0; while(1) { if (g_qqueue->dequeue(&qval) && qval.m_col==0xffff) { cprintf("%d\n", i++); break; } } #endif #if 0 BlobA *blobs; BlobB *ccBlobs; uint32_t numBlobs, numCCBlobs; static uint32_t drop = 0; // create blobs if (g_blobs->blobify()<0) { DBG("drop %d\n", drop++); return 0; } g_blobs->getBlobs(&blobs, &numBlobs, &ccBlobs, &numCCBlobs); cc_sendBlobs(g_chirpUsb, blobs, numBlobs, ccBlobs, numCCBlobs); #endif return 0; }