ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

How to get the Pixy camera working on ROS ?

asked 2014-05-15 07:33:07 -0600

updated 2014-05-16 04:05:31 -0600

I'm trying to get the Pixy camera working with ROS (Hydro) on Ubuntu 12.04 x64.


If you haven't heard about the Pixy yet, it's a camera with embedded vision processing that does mainly fast blob tracking.

It is provided with a software and a GUI written in C++ and Qt, called PixyMon. So I thought it could be great to convert it to a ROS package ! Of course I could connect the Pixy to an Arduino and get some data from a serial link, but I'd like to use the direct USB link to the Pixy, no arduino, and have all the capability of PixyMon within ROS. PixyMon allows you to interact with the Pixy, change its parameters (lightness, contrast...), get the camera image, detected blobs position/size, record new I'd like to have a ROS wrapper for all of this.

Explanation of the issue

So far I can build and link and execute PixyMon as a ROS package, it detects my Pixy but cannot connect to it, PixyMon terminal shows :

Pixy detected.
error: Unable to connect to device.

and the terminal from where I execute the node shows :

libusb_bulk_write -7
libusb_bulk_write -7
interpreter finished
destroying interpreter...
libusb_bulk_write -7
libusb_bulk_write -7

And they all repeat. A click on Parameters button give a segmentation fault and crash. So somewhere something is not using the right libraries, or not the right Qt version, or the different parts of the project are not linked properly I suspect.

Here are the steps I followed to convert PixyMon into a ROS package

So I basically created an empty Qt package, and paste PixyMon (that means common and host folders) inside src folder. My package.xml contains this for Qt project :


My CMakeLists.xml is as follow (I removed all comments) :

cmake_minimum_required(VERSION 2.8.9)

find_package(catkin REQUIRED COMPONENTS qt_build roscpp)
find_package(Qt4 COMPONENTS QtCore QtGui QtWidgets)



add_executable(pixymon ${QT_SOURCES} ${QT_RESOURCES_CPP} ${QT_FORMS_HPP} ${QT_MOC_HPP})
add_library(chirp src/common/chirp.cpp)
add_library(qqueue src/common/qqueue.cpp)
add_library(blob src/common/blob.cpp)
add_library(blobs src/common/blobs.cpp)
target_link_libraries(blobs blob)
target_link_libraries(pixymon ${QT_LIBRARIES} ${catkin_LIBRARIES} chirp qqueue blobs /usr/lib/x86_64-linux-gnu/

I can build and execute the normal Pixymon project provided for the Pixy and it workd well, it is building using Qt5 with the .pro file. But it seems ... (more)

edit retag flag offensive close merge delete



This looks sort of reasonable. Without hacking on it a lot, it's hard to say for sure. I suspect most of your build process is fine, or you would have symbol errors at link time or at startup. Have you tried running your node in gdb? Does it have a debug mode that you can enable?

ahendrix gravatar image ahendrix  ( 2014-05-16 06:39:51 -0600 )edit

Thank you for your reply. Yes I agree the build process should be ok. I tried to run the node in gdb but it doesn't give me more information. Actually, all the error written in the terminal are written by qDebug calls. The error "libusb_bulk_write -7" cause the problem, I'll try to trace it back.

Cyril Jourdan gravatar image Cyril Jourdan  ( 2014-05-20 22:51:25 -0600 )edit

3 Answers

Sort by ยป oldest newest most voted

answered 2014-08-22 15:45:14 -0600

mjstn gravatar image

I too am very interested and have approached this in a 'hack' sort of way as my 1st cut but hope to implement a true ROS node with Pixy as my next step. I am not suggesting this is clean, I am only putting it forth as an unclean alternative that some may benefit from till a clean solution is devised.

My solution is that I have hacked the linux (Raspberry PI) hello code to stuff it's results to shared memory segment. My current ROS node then inspects this shared memory with both processes only accessing the shared memory segment using a system V semaphore so it is safe for the producer (hello code) and consumer (ROS node). My ROS node then inspects memory and passes what it finds over via a ROS topic to my main node which is the end consumer of the Pixy object recognition data. All this then means the pixy.h and pixydef.h includes and a definition of the named shared memory segment of my own .h file are all the ROS node need see as it compiles. This works but I agree is a bit of a 'hack' if you will as I have to start the pixy converted 'hello' process outside of my roslaunch config file.

Just a thought and maybe it will be a reasonable short term solution for others in the mean time as we strive to get the code to operate as a true ROS node which of course is the 'right' way to deal with this issue.

edit flag offensive delete link more

answered 2014-11-06 09:35:08 -0600

jeskesen gravatar image

Hi, I've taken the recently released libpixyusb from Charmed Labs' pixy repository & made a ROS node around it. At the time of this writing, it only supports USB streaming of plain signiture & color-code block data. It will also subscribe to a servo command topic and move the servos for pan-tilt... though I don't have any demo for that (yet).

Here is a link to my source code. I welcome any feedback and/or collaboration from interested users. I've already created a to-do list on the github page of features I'd like to add. Please feel free to add suggestions there.

edit flag offensive delete link more

answered 2015-04-15 11:41:30 -0600

You might check out libpixyusb, which makes direct communictation with Pixy over USB fairly easy ---

I'm not sure if you're running Windows or Linux. Linux is well-tested. Windows isn't so much (for libpixyusb).

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2014-05-15 07:33:07 -0600

Seen: 3,763 times

Last updated: Nov 06 '14