This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
wiki:v2:building_the_libpixyusb_example_on_linux2 [2018/06/29 05:15] hohenheim [2.2.1 Download Pixy2 source code] |
wiki:v2:building_the_libpixyusb_example_on_linux2 [2018/06/29 15:23] (current) hohenheim |
||
|---|---|---|---|
| Line 4: | Line 4: | ||
| ====== 1. Introduction ====== | ====== 1. Introduction ====== | ||
| - | The libpixyusb library provides a software application programming interface (API) for communicating\\ | + | 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. | 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 libpixyusb 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-18 installed |
| * Your system is connected to the internet | * Your system is connected to the internet | ||
| - | 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-17, it //should// work with any Linux distribution that uses the Debian package manager (e.g. Ubuntu). | + | |
| ====== 2. Procedure ====== | ====== 2. Procedure ====== | ||
| - | + | ===== 2.1. Install dependencies for building libpixyusb2 ===== | |
| - | ===== 2.1. Install dependencies for building libpixyusb ===== | + | |
| Start the terminal application: | Start the terminal application: | ||
| Line 31: | Line 28: | ||
| ''%%sudo apt-get install git libusb-1.0-0-dev g++%%'' | ''%%sudo apt-get install git libusb-1.0-0-dev g++%%'' | ||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
| ===== 2.2. Build libpixyusb2 ===== | ===== 2.2. Build libpixyusb2 ===== | ||
| - | |||
| ==== 2.2.1 Download Pixy2 source code ==== | ==== 2.2.1 Download Pixy2 source code ==== | ||
| Line 51: | Line 42: | ||
| In the terminal window type: | In the terminal window type: | ||
| - | ''%%cd pixy/scripts%%''\\ | + | ''%%./pixy2/scripts/build_libpixyusb2.sh%%'' |
| - | ''%%./build_libpixyusb2.sh%%'' | + | |
| {{:undefined:build_libpixyusb2.png?400|}} | {{:undefined:build_libpixyusb2.png?400|}} | ||
| - | |||
| - | |||
| - | ==== 2.2.3. Install the library ==== | ||
| - | |||
| - | Installing the library files requires root privileges. | ||
| - | |||
| - | In the terminal window type: | ||
| - | |||
| - | ''%%sudo ./install_libpixyusb.sh%%'' | ||
| - | |||
| - | {{wiki:img:d35f59500541f5c21f6aa117ae10b1ecb6af8fba.png?400}} | ||
| - | |||
| ====== 3. Example projects ====== | ====== 3. Example projects ====== | ||
| - | Before trying the examples below, connect Pixy to your Linux system using a USB Mini cable: | + | Before trying the examples below, connect Pixy2 to your Linux system using a USB Micro-B cable: |
| - | {{wiki:img:e0e66b6f1b2c5231027c1d03c811e16207772021.jpg?400}} | + | {{:undefined:connect_pixy_usb.png?400|}} |
| - | + | ===== 3.1. Color Identification Example (GetBlocksCPPDemo) ===== | |
| - | ===== 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. |
| - | + | ==== 3.1.1. 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%%'' | + | ''%%./pixy2/scripts/build_get_blocks_cpp_demo.sh%%'' |
| - | + | ||
| - | {{wiki:img:b08075eeb1c7200e464a5706b435b2f896f0bdc8.png?400}} | + | |
| + | {{:wiki:v2:build_get_blocks.png?400|}} | ||
| ==== 3.1.2. Start the example ==== | ==== 3.1.2. Start the example ==== | ||
| - | To start the libpixyusb 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 /pixy/build/hello_pixy%%''\\ | + | ''%%cd ./pixy2/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. |
| - | + | ===== 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]] | + | ==== 3.2.1. 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 ==== | ==== 3.2.2. Start the example ==== | ||
| - | To start the pan_tilt demo, run 'pan_tilt' as root. | + | To start the pan_tilt demo, run 'get_lines_cpp_demo' 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. | + | ''%%cd ./pixy2/build/get_lines_cpp_demo%%''\\ |
| + | ''%%sudo ./get_lines_cpp_demo%%'' | ||
| + | {{:wiki:v2:get_lines_demo.png?400|}} | ||
| ====== 3. Comments ====== | ====== 3. Comments ====== | ||