<< return to Pixycam.com

User Tools

Site Tools


wiki:v2:building_the_libpixyusb_example_on_linux

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
wiki:v2:building_the_libpixyusb_example_on_linux [2018/06/27 22:46]
pixycam
wiki:v2:building_the_libpixyusb_example_on_linux [2019/06/12 16:08]
jfrench added virtual machine warning
Line 1: Line 1:
-====== Building libpixyusb on Linux ====== 
  
  
-We're sorry, we're working on releasing the new version of libpixyusb. ​ It is simpler to use, simpler to compile, and it is fully compatible with the Arduino API.  Libpixyusb2 will be ready on or before June 29, 2018.  ​ 
  
-/*+====== 1.0. Introduction ======
  
 +The libpixyusb2 library provides a software application programming interface (API) for communicating\\
 +with Pixy2 over USB. This allows you to write software that interfaces with Pixy2 like the PixyMon application.
  
 +The following procedure will outline the steps required for building the libpixyusb2 library and some example projects using the library. This procedure assumes the following:
  
- +  ​* Your system has Linux (Mint or similar) ​installed
-====== 1. Introduction ====== +
- +
-The libpixyusb library provides a software application programming interface (API) for communicating\\ +
-with Pixy over USB. This allows you to write software that interfaces with Pixy like the PixyMon application. +
- +
-The following procedure will outline the steps required for building the libpixyusb library and some example projects using the library. This procedure assumes the following:​ +
- +
-  ​* Your system has Linux Mint-17 installed +
-  * Pixy firmware has been updated to 2.0.8+
   * Your system is connected to the internet   * Your system is connected to the internet
-  * libpixyusb version is 0.3 
-  * libusb version 1.0.9 
  
-The Mint-17 distribution of Linux can be downloaded here: http://​www.linuxmint.com+The Mint-18 distribution of Linux can be downloaded here: http://​www.linuxmint.com
  
-Instructions for updating ​the Pixy firmware are here: [[wiki:​v2:​Uploading_New_Firmware|Uploading New Firmware]]+Although this procedure uses Linux Mint-18, it //should// work with any Linux distribution that uses the Debian package manager (e.g. Ubuntu).
  
-Although this procedure uses Linux Mint-17it //should// work with any Linux distribution that uses the Debian package manager (e.g. Ubuntu).+**IMPORTANT:​** due to USB conflictsattempting to use Pixy with a virtual machine of any kind is NOT recommended.
  
  
-====== 2. Procedure ======+====== 2.0. Procedure ======
  
- +===== 2.1. Install dependencies for building ​libpixyusb2 ​=====
-===== 2.1. Install dependencies for building ​libpixyusb ​=====+
  
 Start the terminal application:​ Start the terminal application:​
  
 {{wiki:​img:​78184a8b63cf10782c18339b791db9f85a0d8bc0.png?​400}} {{wiki:​img:​78184a8b63cf10782c18339b791db9f85a0d8bc0.png?​400}}
- 
- 
-==== 2.1.1. Install git ==== 
  
 In the terminal window type: In the terminal window type:
  
-''​%%sudo apt-get install git%%''​+''​%%sudo apt-get install git libusb-1.0-0-dev g++ build-essential%%''​
  
 +===== 2.2. Build libpixyusb2 =====
  
-==== 2.1.2. Install libusb-1.0-0-dev ​====+==== 2.2.1. ​Download Pixy2 source code ====
  
 In the terminal window type: In the terminal window type:
  
-''​%%sudo apt-get install libusb-1.0-0-dev%%''​ +''​%%git clone https://​github.com/​charmedlabs/​pixy2%%''​
- +
-{{wiki:​img:​da64e20cd40baefbd00b8bb4fce081a0f9b76abd.png?​400}} +
- +
- +
-==== 2.1.3. Install g++ (compiler) ==== +
- +
-In the terminal window type: +
- +
-''​%%sudo apt-get install g++%%''​ +
- +
-{{wiki:​img:​208f77c0feb60df1b578d0a67c31972a6e32e285.png?​400}} +
- +
- +
-==== 2.1.4. Install libboost ==== +
- +
-In the terminal window type: +
- +
-''​%%sudo apt-get install libboost-all-dev%%''​ +
- +
-This step will take some time. Time for a refreshing drink? +
- +
- +
-==== 2.1.5. Install cmake ==== +
- +
-In the terminal window type: +
- +
-''​%%sudo apt-get install cmake%%''​ +
- +
-{{wiki:​img:​3ee2278e34e6576a7ff030e21718e71c9da9b447.png?​400}} +
- +
- +
-===== 2.2. Build and install libpixyusb ===== +
- +
- +
-==== 2.2.1 Download Pixy source code ==== +
- +
-In the terminal window type: +
- +
-''​%%git clone https://​github.com/​charmedlabs/​pixy.git%%''​ +
- +
-{{wiki:​img:​dcf634a40148751c2a5f59668335e326013c2183.png?​400}} +
  
 +{{:​wiki:​v2:​git_clone.png?​400|}}
 ==== 2.2.2. Build the library ==== ==== 2.2.2. Build the library ====
  
 In the terminal window type: In the terminal window type:
  
-''​%%cd ​pixy/scripts%%''​\\ +''​%%cd ​pixy2/​scripts ​&& ​./build_libpixyusb2.sh%%''​
-''​%%./build_libpixyusb.sh%%''​+
  
-{{wiki:img:a636c182eec2a7d020e836738a7d629fa4b5bb13.png?400}}+{{:undefined:build_libpixyusb2.png?400|}}
  
 +====== 2.3. Example projects ======
  
-==== 2.2.3. Install ​the library ====+Before trying ​the examples below, connect Pixy2 to your Linux system using a USB Micro-B cable:
  
-Installing the library files requires root privileges.+{{wiki:​v2:​img_5268_result.jpg?400|}}
  
-In the terminal window type: +===== 2.3.1. Color Identification ​Example ​(GetBlocksCPPDemo) ​=====
- +
-''​%%sudo ./​install_libpixyusb.sh%%''​ +
- +
-{{wiki:​img:​d35f59500541f5c21f6aa117ae10b1ecb6af8fba.png?​400}} +
- +
- +
-====== 3Example projects ====== +
- +
-Before trying the examples below, connect Pixy to your Linux system using a USB Mini cable: +
- +
-{{wiki:​img:​e0e66b6f1b2c5231027c1d03c811e16207772021.jpg?​400}} +
- +
- +
-===== 3.1. hello_pixy: A Simple IO Example =====+
  
 The example does the following: The example does the following:
  
-  - Connects to Pixy using USB +  - Connects to Pixy2 using USB 
-  - Displays firmware version installed on Pixy +  - Displays firmware version installed on Pixy2 
-  - Block information is displayed (as shown in the image above) if color signatures have been set and if the signatures are currently being detected by Pixy.+  - Block information is displayed (as shown in the image above) if color signatures have been set and if the signatures are currently being detected by Pixy2.
  
- +==== Build the 'get_blocks_cpp_demo' example ====
-==== 3.1.1. ​Build the 'hello_pixy' example ====+
  
 In the terminal window type: In the terminal window type:
  
-''​%%/​pixy/​scripts/​build_hello_pixy.sh%%''​+''​%%./build_get_blocks_cpp_demo.sh%%''​
  
-{{wiki:img:b08075eeb1c7200e464a5706b435b2f896f0bdc8.png?400}}+{{:wiki:v2:build_get_blocks.png?400|}}
  
 +==== Start the example ====
  
-==== 3.1.2. Start the example ==== +To start the get blocks ​example, run 'get\_blocks\_cpp\_demo' as root.
- +
-To start the libpixyusb ​example, run 'hello_pixy' as root.+
  
 In the terminal window type: In the terminal window type:
  
-''​%%cd ​/pixy/build/hello_pixy%%''​\\ +''​%%cd ​../build/get_blocks_cpp_demo/​%%''​\\ 
-''​%%sudo ./hello_pixy%%''​+''​%%sudo ./get_blocks_cpp_demo%%''​
  
-{{wiki:img:41f4b477ad456027832c83c4cb90c9b695a29b2e.png?400}}+{{:wiki:v2:get_blocks_demo.png?400|}}
  
-Block data received from Pixy is displayed in stdout.+Block data received from Pixy2 is displayed in stdout.
  
- +===== 2.3.2. Line Identification ​Example ​(GetLinesCPPDemo) ​=====
-===== 3.2. pan_tilt: An Object Tracking ​Example =====+
  
 This example does the following: This example does the following:
  
-  - Connects to Pixy using USB +  - Connects to Pixy2 using USB 
-  - Pixy will track objects with color signature '​0'​+  - Configures Pixy2 for line feature identification
  
-Before starting the tracking demo, make sure you've set color signature '​0'​. Look here: [[wiki:​v2:​Teach_Pixy_an_Object_2|Teach_Pixy_an_Object_2]] +==== Build the 'get_lines_cpp_demo' example ====
- +
- +
-==== 3.2.1. ​Build the 'pan_tilt' example ====+
  
 In the terminal window type: In the terminal window type:
  
-''​%%/​pixy/scripts/build_pantilt_c_demo.sh%%''​ +''​%%./pixy2/scripts/build_get_lines_cpp_demo.sh%%''​
- +
- +
-==== 3.2.2. Start the example ==== +
- +
-To start the pan_tilt demo, run '​pan_tilt'​ as root. +
- +
-''​%%cd ../​build/​pantilt_in_c%%''​\\ +
-''​%%sudo ./​pantilt_c%%''​ +
- +
-{{wiki:​img:​ecd3c47f5b3959e279d1678becdfbbbc9854009c.jpg?​400}} +
- +
-Pixy should track objects that have color signature '​0'​ programmed. If the tracking is not smooth try the following:​ +
- +
-  * Use Pixymon to verify that Pixy is getting a good lock on the object. +
-  * Try making adjustments to the ambient lighting. +
- +
-Note: If this example freezes, make sure that your version of libusb is at least 1.0.9.+
  
 +==== Start the example ====
  
-====== 3Comments ======+To start the get_lines demo, run '​get\_lines\_cpp\_demo'​ as root.
  
-We welcome your thoughts and feedback! Please let us know how we can improve.+''​%%cd ​./​pixy2/​build/​get_lines_cpp_demo%%''​\\ 
 +''​%%sudo ./​get_lines_cpp_demo%%''​
  
 +{{:​wiki:​v2:​get_lines_demo.png?​400|}}
  
 +====== 3.0. Comments ======
  
-*/+We welcome your thoughts and feedback! Please let us know how we can improve...
  
  
  
wiki/v2/building_the_libpixyusb_example_on_linux.txt · Last modified: 2019/06/12 16:09 by jfrench