I know what it feels like to work so many roles. I'm the eletriction, programming, and website guy on our team. Let's see if I can help you any:
Have you tested your code at all or are you just trying this out?
I have found that the CAMERA_ON_TARGET state doesn't work to well. Even if the camera has located the target and its pointing directly at the target, it will modulate and will toggle off and on within state which won't even turn on a relay. Do something like:
Code:
if(Get_Camera_State())
{ // You don't need the 1. Anything positive will trigger it.
if((Get_Tracking_State() != SEARCHING && (Find_Distance() > set closest range))
{
pwm01 = desired forward velocity;
pwm02 = same forward velocity;
Switch3_LED = 1;
}else if((Get_Tracking_State() != SEARCHING) && (Find_Distance() <= set closest range)) {
pwm01 = 127;
pwm02 = 127;
Camera_Idle(); //Sets Camera in OFF mode so manual mode can continue.
Switch3_LED = 0;
} else {
Switch3_LED = 0;
}
}
This routine is running continously so the camera will update its distance and will stop once in the proper range. I'm not sure how to answer your CAMERA_IDLE and reset questions. Atonomous mode is only 15 seconds so I'm not going to bother with disabling the camera. If you have it running during gameplay that's another story..
The switch leds are really unessicary. Those turn on LEDs on the OI when the camera is on target. I took then out because we won't be looking down too much during the game.
When you start getting down to coding the specifics of the routine, post again and we'll help.