<< return to Pixycam.com

Pixy2 with arduino for football robot

Recently i want to use the pixy2 to kick a ball,but the facility always keeps a distance from the ball.(using the code zumo demo_chase).I am wondering how the pixy2 judge the distance between the ball and itself? and how can i shorten the distance between the ball and the facility so that the zumo can touch the ball?

I would be appreciate if you can help me.Thank you for reading this letter!

Hello,
If Pixy is looking slightly downward and in front of it, a ball in front of it (on the ground) will appear lower in the image the closer it is to Pixy. You can make a look-up table that provides the distance to the ball given the y-coordinate of the detected ball. There are other messages on this forum that discuss this – search for “ground plane”.

e.g. https://forum.pixycam.com/t/new-pixy-2-do-something-when-signature-x-approach/5675/5

Hope this helps!

Edward

Thank you for your reply and it helps a lot.
If a have made a look-up table that provides the distance to the ball given the y-coordinate of the detected ball,then how can i shorten the distance between the ball and my robot?
What is the principle that pixy2 keep a distance from an object now?

Also i am wondering if i can just delete the code that keeps the distance from an object so that my robot can keep going straight and touch the ball when he detects it.Will that be simple?

Hello,
I’m not sure what you are want to achieve, but the ‘ccc_zumo_chase’ demo might help.

It’s part of the Arduino library.

Edward