<< 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
wiki:v2:building_the_libpixyusb_example_on_linux [2018/06/29 03:03]
pixycam
wiki:v2:building_the_libpixyusb_example_on_linux [2019/06/12 16:09] (current)
jfrench
Line 1: Line 1:
-====== Building libpixyusb2 on Linux ====== 
  
  
  
-====== 1. Introduction ======+====== 1.0. Introduction ======
  
 The libpixyusb2 library provides a software application programming interface (API) for communicating\\ The libpixyusb2 library provides a software application programming interface (API) for communicating\\
Line 10: Line 9:
 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: 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-17 installed+  * Your system has Linux (Mint or similar) ​installed
   * Your system is connected to the internet   * Your system is connected to the internet
-  * 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 Pixy2 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 is NOT recommended.
  
  
-====== 2. Procedure ====== +====== 2.0. Procedure ======
  
 ===== 2.1. Install dependencies for building libpixyusb2 ===== ===== 2.1. Install dependencies for building libpixyusb2 =====
Line 29: Line 26:
  
 {{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.2. Build and install libpixyusb2 ===== +
- +
- +
-==== 2.2.1 Download Pixy2 source code ==== +
- +
-In the terminal window type: +
- +
-''​%%git clone https://​github.com/​charmedlabs/​pixy2.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 pixy2/​scripts%%''​\\ +''​%%cd pixy2/​scripts ​&& ​./​build_libpixyusb2.sh%%''​
-''​%%./​build_libpixyusb2.sh%%''​+
  
-{{wiki:img:a636c182eec2a7d020e836738a7d629fa4b5bb13.png?400}}+{{:undefined:build_libpixyusb2.png?400|}}
  
 +====== 2.3. Example projects ======
  
-====== 3. Example projects ======+Before trying the examples below, connect Pixy2 to your Linux system using a USB Micro-B cable:
  
-Before trying the examples below, connect Pixy2 to your Linux system using a USB Mini cable.+{{wiki:​v2:​img_5268_result.jpg?400|}}
  
-===== 3.1. get_blocks: A Simple IO Example =====+===== 2.3.1. Color Identification ​Example ​(GetBlocksCPPDemo) ​=====
  
 The example does the following: The example does the following:
  
   - Connects to Pixy2 using USB   - Connects to Pixy2 using USB
 +  - 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 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 Pixy2.
  
- +==== Build the 'get_blocks_cpp_demo' example ====
-==== 3.1.1. ​Build the 'get_blocks' example ====+
  
 In the terminal window type: In the terminal window type:
  
-''​%%/​pixy2/​scripts/​build_get_blocks_cpp_demo.sh%%''​+''​%%./​build_get_blocks_cpp_demo.sh%%''​
  
 +{{:​wiki:​v2:​build_get_blocks.png?​400|}}
  
-==== 3.1.2. ​Start the example ====+==== Start the example ====
  
-To start the libpixyusb2 ​example, run 'hello_pixy' as root.+To start the get blocks ​example, run 'get\_blocks\_cpp\_demo' as root.
  
 In the terminal window type: In the terminal window type:
  
-''​%%cd ​/pixy2/build/hello_pixy%%''​\\ +''​%%cd ​../build/get_blocks_cpp_demo/​%%''​\\ 
-''​%%sudo ./hello_pixy%%''​+''​%%sudo ./get_blocks_cpp_demo%%''​
  
 +{{:​wiki:​v2:​get_blocks_demo.png?​400|}}
  
 Block data received from Pixy2 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 Pixy2 using USB   - Connects to Pixy2 using USB
-  - Pixy2 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:
  
-''​%%/​pixy2/​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}} +
- +
-Pixy2 should track objects that have color signature '​0'​ programmed. If the tracking is not smooth try the following:+
  
-  * Use Pixymon to verify that Pixy2 is getting a good lock on the object. +==== Start the example ====
-  * Try making adjustments to the ambient lighting.+
  
-Note: If this example freezesmake sure that your version of libusb is at least 1.0.9.+To start the get_lines demorun '​get\_lines\_cpp\_demo'​ as root.
  
 +''​%%cd ./​pixy2/​build/​get_lines_cpp_demo%%''​\\
 +''​%%sudo ./​get_lines_cpp_demo%%''​
  
-====== 3Comments ======+{{:​wiki:​v2:​get_lines_demo.png?400|}}
  
-We welcome your thoughts and feedback! Please let us know how we can improve. +====== 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.1530241393.txt.gz · Last modified: 2018/06/29 03:03 by pixycam