<< return to Pixycam.com

Can pixy detect a fast ball in ping-pong game?

Hi,

I am trying to use a pixy camera to detect a moving ball in a ping-pong game. But, apparently, it doesn’t get any samples or isn’t abel to track the ball with a decent enough speed that one would expect in a ping-pong game. I was wondering if there is any configuration variable which can be tuned or any other way to achieve this? Or is it a limitation of Pixy Cam.

Thanks!

Hello Priyanka,
Pixy can definitely track a ping pong ball. Are you running the hello_world example for Arduino? Note, that this example only prints the detected blocks for every 50th frame. We do this because printing the information about every frame slows down the Arduino (and it’s a lot of information). But you are welcome to remove the line “if (i%50==0)” (see below)

Could this be why you think Pixy isn’t fast enough?

Edward

    // do this (print) every 50 frames because printing every
    // frame would bog down the Arduino
    if (i%50==0)
    {
      sprintf(buf, "Detected %d:\n", blocks);

Hello Edward,

Thanks for your reply.

We had actually tested with if condition as (i%1==0) in which we are essentially collecting all samples. Also, we used PixyMon’s raw mode to see if it actually sees a fast bouncing ping-pong ball, but it doesn’t see it in the raw mode as well. Is this due to Pixy’s limitations?

Any suggestions?

Thanks!

Hello Priyanka,
It doesn’t detect it in cooked mode (I think you mean to say). If there is low light and fast motion, the colors can shift because of motion blur. You might either choose conditions with more light or try adjusting the signature range to be more inclusive. There is more information here on adjusting the ranges. See the video clip:

http://cmucam.org/projects/cmucam5/wiki/Teach_Pixy_an_Object_2

Edward

Hi,

Actually, I am using the Pixy in the default program run mode. We had tried to increase the signature range to be more inclusive. However, even in decent light settings, if we increase the signature range it tends to detect more false positives. Is there anything else that we can try?

Thanks!

Hello Priyanka,
Also keep in mind that if your Arduino program prints anything through the serial port (for debugging, etc), it will really slow things down. Make sure you aren’t doing anything in your program that would cause Pixy to skip frames (like printing). (that’s why we put the (i%50==0) in the example code.)

You should benchmark your program and make sure that you are receiving all 50 frames per second and acting on them. It may require that you put in a “low overhead” print statement, like the if (i%50==0) then Serial.println(…) to verify this.

Hope this helps!

Edward