How to change the resting distance from Pixy Lens to Object.
Where in the Pixy library is the default distance coded? I looked in the TPixy.h file for the blocks width. But I could not figure out how to change the final resting distance from the camera to the object. I have tried to set the pixy.block[i].width to a minimal value of 230. That seems to have forced the camera to move closer to the object, but I am not sure this is the best/only option. Is this coded in firmware possibly?
RE: How to change the resting distance from Pixy Lens to Object. - Added by Jesse French 30 days ago
Hey Scott, I'm confused by your question. Pixy doesn't handle distance at all...you can physically move the camera closer, and manually focus the lens by screwing / unscrewing. You may need a different lens (zoom or macro) depending on your application. What exactly are you trying to do?
RE: How to change the resting distance from Pixy Lens to Object. - Added by scott monasee 29 days ago
Thx for responding. I was unclear. When you use the servo ports on the back of the Pixy you get the pan and tilt function. And the Pixy will actually track a bouncing ping pong ball. In fact, if you move the ball too close to the lens it will 'retreat' and if you pull the ball away from the lens it will 'advance' towards the ball/object.
How does it determine this? Does it measure the block area? X or Y width?
I want the same functionality using the PanTilt sketch on my Arduino Mega.
Hope this is more clear. Please let me know if it is not. I really appreciate all the help the support team offers!
RE: How to change the resting distance from Pixy Lens to Object. - Added by Jesse French 28 days ago
OK, that's more clear...I'm still confused when you say Pixy will "advance" and "retreat" towards the ball. Pixy and Pan/Tilt don't have any wheels or ability to move forward / back! What are you referring to, exactly?
It sounds like you might be thinking of the Pixy Pet from Adafruit - they do have Arduino code samples and a pretty good breakdown of the methods used to follow objects. Check that out here: https://learn.adafruit.com/pixy-pet-robot-color-vision-follower-using-pixycam/pixy-pet-code
Hope this helps!
RE: How to change the resting distance from Pixy Lens to Object. - Added by scott monasee 21 days ago
What I am doing is mounting the Pixy camera at the end of a robotic arm. I am using the camera to find objects randomly placed in a field. And once the object is found I want to move the arm forwards towards the object and stop at a predetermined distance.
I think I have figured out what to do. I will use the pixy.blocks[x].width command to test when the camera reaches a width value of ie 200. Then, stop.
I think the values of the pixy.blocks[x].width range from 1-319.
I have this working now...thanks for all your help! Scott
RE: How to change the resting distance from Pixy Lens to Object. - Added by Jesse French 21 days ago
I see - your solution sounds great! Glad it's working. Good luck and post a link to a video if you make one :) would love to see the results.