<< return to Pixycam.com

User Tools

Site Tools


wiki:v3:building_a_libpixyusb_python_module_on_linux

Building a libpixyusb Python module on Linux

Introduction

The libpixyusb library provides a software application programming interface (API) for communicating
with Pixy over USB. The following procedure will outline the steps to build libpixyusb as a Python module.

This procedure assumes the following:

  • Your system is Linux (with Debian package manager)
  • Pixy firmware has been update to 1.0.2
  • Your system is connected to the internet

Instructions for updating the Pixy firmware are here: Uploading New Firmware

2. Procedure

2.1. Install dependencies for building Python SWIG module

Start a terminal application.

2.1.1. Install SWIG

In a terminal window type:

# sudo apt-get install swig

2.1.2. Install libusb-1.0-0-dev

In the terminal window type:

sudo apt-get install libusb-1.0-0-dev

2.1.3. Install g++ (compiler)

In the terminal window type:

sudo apt-get install g++

2.1.4. Install libboost

In the terminal window type:

sudo apt-get install libboost-all-dev

2.2. Build the libpixyusb Python module

2.2.1 Download Pixy source code

In the terminal window type:

git clone https://github.com/charmedlabs/pixy.git

2.2.2. Build the Python module

In the terminal window type:

cd pixy/scripts
./build_libpixyusb_swig.sh

2.3. Try it out!

Make sure your Pixy is connected to a USB port on your computer. Then in the terminal window type:

cd ../build/libpixyusb_swig
python get_blocks.py

If all goes well, you should see blocks:

Pixy Python SWIG Example -- Get Blocks
[BLOCK_TYPE=0 SIG=1 X=220 Y= 17 WIDTH= 43 HEIGHT= 35]
[BLOCK_TYPE=0 SIG=1 X=220 Y= 23 WIDTH= 42 HEIGHT= 47]
[BLOCK_TYPE=0 SIG=1 X=220 Y= 23 WIDTH= 42 HEIGHT= 47]
[BLOCK_TYPE=0 SIG=1 X=220 Y= 23 WIDTH= 42 HEIGHT= 47]
[BLOCK_TYPE=0 SIG=1 X=220 Y= 23 WIDTH= 42 HEIGHT= 46]
[BLOCK_TYPE=0 SIG=1 X=220 Y= 23 WIDTH= 45 HEIGHT= 46]
[BLOCK_TYPE=0 SIG=1 X=219 Y= 23 WIDTH= 43 HEIGHT= 46]

wiki/v3/building_a_libpixyusb_python_module_on_linux.txt · Last modified: 2018/09/19 21:05 by jfrench