I am running the PanTilt sketch provided in the Pixy library on an Arduino Mega. The Pan portion controls a rotating base. Attached to the base is a one foot arm. At the end of the arm I have attached the Pixy camera and a servo to perform the Tilt function. Both the Pan and Tilt work fine. They track the object perfectly. Except…when the object is found and the Pan and Tilt function stop…the Pan portion of the camera is slightly LEFT of the object. The Pixymon viewer seems to have centered the object top to bottom but not left to right. I have tried the following code modification:
-
I have changed the following statements to:
panError= X_CENTER - pixy.blocks[0].x;
tiltError= Y_CENTER - pixy.blocks[0].y; //I know this is reversed. -
My setpoint of the screen is (159,99) so I did the following:
panError = (X_CENTER - pixy.blocks[0].x) + 30;
tiltError = (Y_CENTER - pixy.blocks[0].y) + 24;
This seemed to help but still does not center the block in the Pixymon viewer.
Does anyone have any ideas on how to fix this or is this a normal bias in the camera since the Pan and Tilt are offset by 12 inches?? Thx, Scott