|
Re: Camera problem Serial Port 2 Inserting Extra Null Bytes?
Max,
We are using KW's virtual_window() routine. For the data I included in the first post the code was not sending any VW commands because there were no targets in view. The code segment that cycles through the windows is below. This code is inserted after a T-packet is received. Right now CAMERA_POLL (the camera is in polled mode) is defined and CAMERA_NORMAL is not. The pending flags are used so that subsequent ACKs from the camera trigger the transmission of Tracking packet command after the VW command is acked and also to try to re-send the VW command if it is NCK'd. If the camera does not respond for 1000ms the KickCamera() routine runs which tries to recover the serial link (with limited success). The camera is working great and we have very accurate angles to both targets until the RC transmit serial port hickups - that is where we need the help, with the serial port. Are you looking for more information on how to use the VW command or did you think that we might be having trouble with its format?
Thanks,
Greg
if((((T_Packet_Data.confidence > CONFIDENCE_THRESHOLD_DEFAULT)&&(T_Packet_Data.conf idence < TWO_TARGET_CONFIDENCE_THRESHOLD))&&camera_window == W_FULL)|| camera_window != W_FULL )// Two targets are in view or they were the last T-packet
{
if(camera_window == W_FULL) // Take a look at the left side
{
// camera_window = W_LEFT;
#ifndef CAMERA_NORMAL
mx_full = T_Packet_Data.mx;
Virtual_Window(T_Packet_Data.mx, 1, 159, 239); // LEFT HALF
vw_cmd_pending = 1;
DEBUG(("VW_LEFT\r"));
#endif
#ifdef CAMERA_POLL
t_packet_waiting_for_ack = 1;
camera_window = W_LEFT;
#else
expecting_window = W_LEFT;
#endif
DEBUG(("\r\nCamera: Left Window\r\n"));
}
else if(camera_window == W_LEFT) // Take a look at the right side
{
//camera_window = W_RIGHT;
#ifndef CAMERA_NORMAL
Virtual_Window(1, 1, mx_full/*T_Packet_Data.mx*/, 239); // RIGHT HALF
vw_cmd_pending = 1;
ScheduleEventTimer(KickCamera,1000,0);
DEBUG(("VW_RIGHT\r"));
#endif
#ifdef CAMERA_POLL
camera_window = W_RIGHT;
t_packet_waiting_for_ack = 1;
#else
expecting_window = W_RIGHT;
#endif
DEBUG(("\r\nCamera: Right Window\r\n"));
}
else if(camera_window == W_RIGHT) // Take a look at the full frame again
{
#ifndef CAMERA_NORMAL
Virtual_Window(1, 1, 159, 239); // FULL
vw_cmd_pending = 1;
ScheduleEventTimer(KickCamera,1000,0);
DEBUG(("VW_FULL\r"));
#endif
#ifdef CAMERA_POLL
camera_window = W_FULL;
t_packet_waiting_for_ack = 1;
#else
expecting_window = W_FULL;
#endif
DEBUG(("\r\nCamera: Full Window\r\n"));
}
}
else // One or no targets detected this time
|