Log in

View Full Version : Camera locked on


railerobotics
08-02-2006, 17:02
I have searched forever in the code but I cannot find a variable that says if the camera is or isn't locked on to the target. In atonomous I have trying to make our cannon fire once that the camera is locked on the the target.

kaszeta
08-02-2006, 17:09
I have searched forever in the code but I cannot find a variable that says if the camera is or isn't locked on to the target. In atonomous I have trying to make our cannon fire once that the camera is locked on the the target.

Look in terminal.c in Kevin's camera code. Basically, you can check the value of T_Packet_Data.my, T_Packet_Data.pixels, or T_Packet_Data.confidence.

railerobotics
08-02-2006, 17:15
Thanks

Greg Ross
08-02-2006, 17:20
Look in terminal.c in Kevin's camera code. Basically, you can check the value of T_Packet_Data.my, T_Packet_Data.pixels, or T_Packet_Data.confidence.
Be careful about using T_Packet_Data.my. Kevin's code uses it extensively for distinguishing when the target is or is not in its view. Unfortunately, T_Packet_Data.my does not get cleared when the camera loses the target. I found that this would cause the camera to get stuck pointing off into space sometimes, so I changed all those references to use T_Packet_Data.confidence instead.

Keith Watson
08-02-2006, 19:47
Look in terminal.c in Kevin's camera code. Basically, you can check the value of T_Packet_Data.my, T_Packet_Data.pixels, or T_Packet_Data.confidence.The tracking code also uses PAN_ALLOWABLE_ERROR_DEFAULT and TILT_ALLOWABLE_ERROR_DEFAULT to determine whether the camera is locked or not. Search_Target() already has most (but not all) of the logic. It was simple to modify our code to report the tracking state (searching/tracking/locked) and the target centroid location.

Keith Watson
08-02-2006, 19:50
Be careful about using T_Packet_Data.my. Kevin's code uses it extensively for distinguishing when the target is or is not in its view. Unfortunately, T_Packet_Data.my does not get cleared when the camera loses the target. I found that this would cause the camera to get stuck pointing off into space sometimes, so I changed all those references to use T_Packet_Data.confidence instead.Thanks for pointing this out!