<< return to Pixycam.com

Two objects in function

Hi everyone,
I have two objects running in table, pixy doing very well, I am able to read coordinates for two objects
Normally, one of object sometime could be jump out of table.
Under this condition, I want to make a behavior when one of object disappears in frame, for example, stop motor running.
If I have one object only, perhaps I could use below function.
getBlocks() return 0 if there are no objects
But I have 2 objects when one is missing, another object still remain in frame, above function may not appropriate for this situation.
Can someone possible give me a help, how I to make a code for Arduino?

Thank you
Jacky

Hello Jacky,
You are saying that when there is 1 object present, getBlocks() still returns 2 (instead of 1)? Sometimes Pixy will mistake 1 object for 2 objects under low lighting or when the color signature is slightly off. You can try to re-teach or “tune” the signatures. This page describes how to adjust (tune) the signatures.

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

Let me know what you find.

Edward

Hi Edward

Many thanks for your reply.
Sorry make confusion for you.
Please see below that is my purpose.


Normally robot will track ball as you can see in video.
My problem, when ball jump out of table, robot lose control.
I expect that when ball missing in frame of pixy that Arduino able to detect it and stop stepper motor running.
I would like to thank you in advance for your help.

Jacky

jacky chen wrote:

Hi everyone,
I have two objects running in table, pixy doing very well, I am able to read coordinates for two objects
Normally, one of object sometime could be jump out of table.
Under this condition, I want to make a behavior when one of object disappears in frame, for example, stop motor running.
If I have one object only, perhaps I could use below function.
getBlocks() return 0 if there are no objects
But I have 2 objects when one is missing, another object still remain in frame, above function may not appropriate for this situation.
Can someone possible give me a help, how I to make a code for Arduino?

Thank you
Jacky

Hello Jacky,

Nice video! :slight_smile:

So when you call getBlocks(), the value it returns is the number of detected objects. I would do this: when the result of getBlocks() is 0, I would stop the stepper motors.

Hope this helps!

Edward