<< return to Pixycam.com

Is the pixy.h editable

For my project i am using the pixy cam, and i wanted to change a few things in the pixy.h (/home/pi/pixy/src/host/libpixyusb/include ) but none of my changes are taken into account. On the other hand i have made changes on the hello_pixy.cpp and that working fine, there for i wanted to know if it is possible to do the same with pixy.h? what i want to do is where it writes the signature,the x,the y,the width and the lengh, i want it to right it only for a certain position(x and y) of the object.

thank you for your time

Hello Julien,
You can edit pixy.h :slight_smile: You can find it in your Documents/Arduino/libraries/Pixy directory.

Hope this helps!

Edward

i am using a raspberry pi,so i guess it different?

Hi Julien,
That’s correct, the Raspberry PI works best with USB communications and libpixyusb. Here is some more information:

http://cmucam.org/projects/cmucam5/wiki/Building_the_libpixyusb_example_on_Linux
http://charmedlabs.github.io/pixy/pixy_8h.html

Hope this helps!

Edward

Hello, thanks for your time.

Sorry for so many questions, but our project is due soon.

We are using a Rasperri Pi connected to the pixy cam via USB.
When compiling the file (make) after the changes were made to pixy.h, such as deleting the void print function (just to test), there was no change or error when printing the information of the signature caught by the pixy. It still printed those values even after deleting the print function in pixy.h

We are wanting to change the format in which the information for the pixy is printed (we thought editing pixy.h would solve the problem)
Any changes made to hello_pixy.cpp are successful, but when editing pixy.h (src/host/libpixyusb/include) there seems to be no effect even after compiling.

Hello Julien,
I’m not sure how you want the printed information to change, but I believe you probably want to edit hello_pixy.cpp, particularly where it calls printf. What are you trying to change in pixy.h?

Edward

Hello Julien,
I’m not sure how you want the printed information to change, but I believe you probably want to edit hello_pixy.cpp, particularly where it calls printf. What are you trying to change in pixy.h?

Edward

here is what i want to change from pixy.h:
struct Block
{
void print(char *buf)
{
int i, j;
char sig[6], d;
bool flag;
if (type==PIXY_BLOCKTYPE_COLOR_CODE)
{
// convert signature number to an octal string
for (i=12, j=0, flag=false; i>=0; i-=3)
{
d = (signature>>i)&0x07;
if (d>0 && !flag)
flag = true;
if (flag)
sig[j++] = d + ‘0’;
}
sig[j] = ‘\0’;
sprintf(buf, “CC block! sig: %s (%d decimal) x: %d y: %d width: %d height: %d angle %d”, sig, signature, x, y, width, height, angle);
}
else // regular block. Note, angle is always zero, so no need to print
sprintf(buf, “sig: %d x: %d y: %d width: %d height: %d”, signature, x, y, width, height);
}

to this function i want to add something but too complicated to send it so let just say for X reason i just want the “x” and the"y" of the block.
What i will do is simply in the the pixy.h ,i will change : sprintf(buf, “sig: %d x: %d y: %d width: %d height: %d”, signature, x, y, width, height);
to sprintf(buf, "sig: %d x: %d y: %d);
I know it stupid, but it just an example,and doing that doesn’t change a thing. When i compile (make) and launch hello_pixy it will still write the “x”, “y”,“width”,“height”… which i don’t want.

An other way to solve my problem that will allow me not to touch the pixy.h but only pixy.cpp which works perfectly is: is there a function in pixy.h that i can call in pixy.cpp that returns the “x” and the “y” of the block.

Hello Julien,
I don’t have a linux machine I can use to test, but the makefile has made another copy of pixy.h and is using that instead, so when you edit the main copy and rerun “make”, nothing has actually changed. If you do a file search on pixy.h, in your hello_pixy directory, you should find it.

Hope this helps!

Edward

i’ll try it when i get the chance, thank your for you time!