Cynix
23-01-2007, 21:59
We're using Kevin Watson's camera, tracking and pwm libraries from the streamlined version with our camera to calculate the distance between the robot and the base of the rack. These libraries have been manually added to the default 2007 code which we have been working on, so we're not using his included user_routine.c or user_routine_fast.c files. We're using mplab to do the programming. Our camera is currently mounted according to the official instructions (not Kevin's instructions) but we have switched the proper values in the header file to reflect this. We have also increased the max tilt pwm value to 244 (one step of 50 above the default) in order to give our camera the ability to track the light at a greater angle. So we have 4 levels at which we track instead of the default 3.
The camera is able to track the light perfectly after it detects it, but we are having some issues with the camera detecting the light when the light needs to be detected on the third (second-highest) or fourth (highest) search level. When the light can be detected on the first or second level it works fine and we can then move the light up/down, left/right and it tracks fine.
However, if we uncover the light at a height where only the third/fourth level search can detect it while the camera is currently searching at levels 1 or 2, the camera will move along, then when it comes to the end of level 2 it will sweep across back to the starting position at level 3 and it will pause for a second as if it detected something, then resets back to level 1 and starts searching again without locking on and without completing the search of levels 3 or 4.
However, if we allow the camera to begin searching level 3 (ie: it moves to the second pan value of the third level) and then uncover the light it will detect it and lock on without resetting the search.
I have a theory but I havn't had a chance to test it, I'm just posting it here to see if anyone can give me a reason why it is dead wrong and I should not bother any testing. This is the first time I've ever programmed in c, but I have a lot of experience in other languages.
My theory is that as the camera moves from the last pan value of the 2nd level to the first pan value of the 3rd level it sweeps across diagonally and detects the light; then when the move is finished the camera thinks the light is in the view because it saw it while it was doing the move across so it trys to adjust the servos to target the light, but the light isn't in its view anymore so it loses it and (this is the part I'm making major assumptions on) the tracking code resets the search back to the first pan value of the first tilt level since it lost the target. I guess my biggest questions are a) could the camera be confused if it detected the light while moving the pan value from the finishing side to the starting side while moving up a level and then not finding it anymore once the move is complete, and b) does the tracking code reset to pan value 0, tilt value 0 when the light is lost and it has to being searching again?
Any comments or suggestions at all are very much appreciated. I tried to keep my terminology straight as I typed it but if I muddled any section please let me know.
I have one more question that I'm just curious: is there any reason, besides having the lense as low as possible for maximum possible tilt angle, which makes mounting the camera upside down advantageous?
The camera is able to track the light perfectly after it detects it, but we are having some issues with the camera detecting the light when the light needs to be detected on the third (second-highest) or fourth (highest) search level. When the light can be detected on the first or second level it works fine and we can then move the light up/down, left/right and it tracks fine.
However, if we uncover the light at a height where only the third/fourth level search can detect it while the camera is currently searching at levels 1 or 2, the camera will move along, then when it comes to the end of level 2 it will sweep across back to the starting position at level 3 and it will pause for a second as if it detected something, then resets back to level 1 and starts searching again without locking on and without completing the search of levels 3 or 4.
However, if we allow the camera to begin searching level 3 (ie: it moves to the second pan value of the third level) and then uncover the light it will detect it and lock on without resetting the search.
I have a theory but I havn't had a chance to test it, I'm just posting it here to see if anyone can give me a reason why it is dead wrong and I should not bother any testing. This is the first time I've ever programmed in c, but I have a lot of experience in other languages.
My theory is that as the camera moves from the last pan value of the 2nd level to the first pan value of the 3rd level it sweeps across diagonally and detects the light; then when the move is finished the camera thinks the light is in the view because it saw it while it was doing the move across so it trys to adjust the servos to target the light, but the light isn't in its view anymore so it loses it and (this is the part I'm making major assumptions on) the tracking code resets the search back to the first pan value of the first tilt level since it lost the target. I guess my biggest questions are a) could the camera be confused if it detected the light while moving the pan value from the finishing side to the starting side while moving up a level and then not finding it anymore once the move is complete, and b) does the tracking code reset to pan value 0, tilt value 0 when the light is lost and it has to being searching again?
Any comments or suggestions at all are very much appreciated. I tried to keep my terminology straight as I typed it but if I muddled any section please let me know.
I have one more question that I'm just curious: is there any reason, besides having the lense as low as possible for maximum possible tilt angle, which makes mounting the camera upside down advantageous?