I’m looking to track two lights to be able to center the robot between them, but I am clueless.
If I tell the camera to use a VW, will it go back to using a full window in the next loop? Will I still be able to use the pan/tilt angles as printed by the default camera code? Where will I find the coordinate values of the bounding box? If I create two VWs in one loop of autonomous code (for two lights), how can I get the coordinates of the bounding box for each?
Also, I’m assuming I don’t need to change the camera to Raw Mode because the initialization function does that.
Basically, as is very clear, I’m new to using the camera. Any help is appreciated.
The Virtual Window command tells the camera to ignore information outside the window you specify in the command. If the camera is streaming t-packets, you’ll need to call the Camera_Idle( ) function first, wait for an ACK, then call Virtual_Window( ), wait for another ACK, then call Track_Color( ) if needed. There are two global variables in camera.c that count the number of ACKs and NCKs the camera has sent. When they increment, you know the camera has acknowledged (or not acknowledged) your command. You’ll need to add these lines to camera.h before they’ll be visable to other source code files:
extern unsigned int camera_acks;
extern unsigned int camera_ncks;
The new virtual window is persistent until the camera is reset, at which point the camera will revert back to using the full frame.
You do not need to call Raw_Mode( ) again.
The coordinant frame is discussed in the command dictionary, which is available at http://kevin.org/frc. If you mounted the camera using the instructions in the workbook, pixel 1,1 in in the upper left corner, otherwise it’s located in the lower right corner.
Today we just got it (somewhat) working, and we found it helpful to call Pole Mode (as mentioned by JT250 in the sticky) which is a command that causes the camera to only return 1 packet when track color is called.
So basically, after calling camera idle the we first put the camera in pole mode, and then get out of it after we are done splitting and checking our virtual windows.