<< return to Pixycam.com

Incorporating Pixy with ROS.

Hi, I want to know how to let Pixy incorporate with Robot Operating Systems (ROS).

Which variables in the “Hello World” arduino codes do I use to let ROS output the detected objects?

I want it to show what it has detected when I rostopic echo

Hi,

I’m not familiar with ROS, so I’ll do what I can to help you understand the Pixy side of things. In the “hello_world” example the @blocks@ array contains @block@ structs that have the following data:

@uint16_t signature;
uint16_t x;
uint16_t y;
uint16_t width;
uint16_t height;@

Is this what you were looking for?

Scott

*Hi Scott,

Can you explain what the following code does ?

struct Block
{
void print()
{
char buf[64];

sprintf(buf, "sig: %d x: %d y: %d width: %d height: %d\n", signature, x, y, width, height);
Serial.print(buf);  

}
uint16_t signature;
uint16_t x;
uint16_t y;
uint16_t width;
uint16_t height;
};*

Hi,

The @print@ function handles printing the details of a @Block@ struct over the serial port on Arduino. This is good for debugging, and can be found being used “here”:https://github.com/charmedlabs/pixy/blob/master/arduino/libraries/Pixy/examples/hello_world/hello_world.ino. The rest of the Block struct defines the data contained in a Block, which is detailed below:

signature: the signature that this block belongs to
x: the x coordinate of the block
y: the y coordinate of the block
width: the width of the block
height: the height of the block

This data is sent to your Arduino from Pixy that describes detected objects.

Scott