|
Re: Moving robot while tracking with camera questions...
1. You might want to #include camera.h which will give the autonomous code access to the T_Packet_Data (camera) variables.
2. You are correct. The tracking code automatically moves the servos to get the target in the center of the camera's field of view. The variables that the camera gives you are T_Packet_Data.mx, T_Packet_Data.my, T_Packet_Data.x1, T_Packet_Data.x2, T_Packet_Data.y1, T_Packet_Data.y2, T_Packet_Data.pixels, T_Packet_Data.confidence. mx and my are the coordinates of the center mass of the target. x1, y1, x2, and y2 are the coordinates for the bounding rectangle of the target. pixels is the blob size, and confidence relates to how close the actual target color is to the pre-programmed target color. The servo positions are accessed via PWM. You can use the constants PAN_SERVO and TILT_SERVO to get the positions.
3. If you map your drive train PWM's to the joysticks and don't mess with the PWM's that control the 2 servos, then you won't have any problems.
4. See #2 for the variables.
|