Camera Programming

I was wondering, does anybody have some code that they used to get the robot to respond to the cameras values? Last year we got our camera to track but we couldn’t figure out a way to use those values to make some code that would work. Any help is greatly appreciated.

I’ve used Kevin’s code the last two years, modifying this year’s code to set the camera to autotrack and report servo values.

To handle the camera, you need to:

  • Call the initialization function, Initialize_Camera(), in User_Initialize()
  • call Camera_Handler() on a regular basis (the slow loop works)

The data is dumped into the variable T_Packet_Data. It contains (by default):

  • The upper left and lower right points of the bounding box of the color blob (x1, y1, x2, y2)
  • The median of the color blob (mx, my)
  • The number of pixels in the blob
  • A “confidence” value (which is proportional to the number of pixels)

See camera.h for details.

If you have done all this, and are having problems getting the robot to “respond”, you will have to go into more detail.

Thanks, I’ll try that and see what happens