When the camera is on the bench, it tracks perfectly in LabView (after putting a jumper on the pins to flip the Pan). When we hook it into the robot via TTL and PWM 1 (Pan Servo) and 2 (Tilt Servo) it does not track properly. Once it locks on to the target, the camera pans/tilts the target out of the field of view of the camera (the Pan and Tilt Errors increase when they should be decreasing). :ahh:
We found the problem! In tracking.h we redefined PAN_ROTATION_SIGN_DEFAULT and TILT_ROTATION_SIGN_DEFAULT to the opposite values. Now it is tracking perfectly!
Yep, that’ll do it.
OBTW, that situation is covered in the Tracking.h file included in the code from Kevin Watson. It is well worth the time to walk through ALL of his code. He documents it very well.
Another thing to note is if you are using the ‘Bells & Whistles’ version of Kevin’s code that this parameter is also stored in EEPROM. What this means is if you change the #defines in the code, recompile, and download you will not actually see a change in the behavior. This is because the code is loading the last used values (previous defaults) from EEPROM. You have to use Kevin’s menu system to modify the value or alternatively (since you changed the default values) reset the configuration to default.
Yep. If the software finds a valid camera and/or tracking configuration in EEPROM it will use that information for configuration. To save values from the header file into EEPROM select load default values from the menu and then hit the save changes key. You can see where the software gets the configuration data by enabling debug messages in camera.h.
Yes, if you have any tracking problems, be sure to check these settings first! Kevin’s default values are wrong when used with the assembly instructions in the CMUcam workbook, and I spent 3 days changing every other setting before I finally found this post!
Sorry about the documentation problems. As I suspect you’ll get better tracking performance, you might consider rotating your camera 180 degrees because the best way to mount the camera is with the tilt axis extending through the camera module.