Quote:
|
Originally Posted by Kruuzr
Hi Brad...
I started coding up our full application using WPILib but I ran across a big difference between the documentation and what I assume are new functions. In the userAPI.h file, there are two camera functions:
void InitCamera(unsigned char cameraInitIndex);
void CaptureTrackingData(
unsigned char *centerX,
unsigned char *centerY,
unsigned char *x1,
unsigned char *y1,
unsigned char *x2,
unsigned char *y2,
unsigned char *regionSize,
unsigned char *confidence,
unsigned char *pan,
unsigned char *tilt);
The first is obviously a changed version of InitializeCamera() and the second must be new. Could you give a quick rundown of how they work, especially the 'cameraInitIndex' parameter of InitCamera() ? And how do we set camera parameters as there is no place to set up a CameraInitializationData struct.
Thanks
|
You caught me! I just put up a new version with the function definition included in the BuiltIns.h file.
There are a few functions in WPILib which are hard for programmers to use, but easy for EasyC to automatically generate. These are two of those functions.
The function:
InitializeCamera(CameraInitializationData *c);
that you can call passing the address of the camera initialization structure. This is probably easiest for you to use. The other function:
InitCamera(unsigned char cameraInitIndex);
was intended for EasyC. It assumes that there is an array of those structs and the argument is the index to the one you want to use.
My suggestion is to initialize a structure with the camera parameters you want to use and call InitializeCamera. It's actually called from inside of InitCamera anyway.
The other functions to use the camera data are:
CaptureTrackingData(...) - this is the one you described
and
TPacket *CopyTrackingData(void);
Is the function that I intended hand-coding programmers to use. This returns a pointer to a static structure containing a TPacket inside of WPILib. When you call the function, it turns off interrupts, grabs the most recent packet, and puts it into the static structure - then returns its address.
Then you can write code like this:
TPacket t = CopyTrackingData();
conf = t->confidence;
which seemed to be pretty convenient.