Python

The Finch currently supports Python in two ways. We have a native Python library and we also have access to Finch's Java libraries through Jython, a variant of Python that allows easy access and importation of Java libraries.

Python

Python is a popular programming language, written on C. Its syntax allows programmers to write in fewer lines of code, and is easy for new programmers to learn.  

This Python library is brought to you by the efforts of Jay Jin, Justas Sadzevicius, and others.

Visit the Downloads page to download the Python Finch package for your OS.

Documentation

Documentation for the Python API is available at Python API Documentation.

After you have downloaded the Finch Python package, follow the various instructions for compiling and running programs.

Important Files and Folders

The following files and folders are common to all Python downloads:

finch.py - The Finch API source file.

finchconnection.py - Used by finch.py for sending/receiving data over USB

hidapi32/64.dll (Windows), libhidapi.dylib (Mac), libhidapi32/64.so (Linux) - Contains the HIDAPI library.

Various example programs written:

  • musicexample.py - Plays from a list of three songs
  • racedriver.py - Drives around in a square 
  • lapswimmer.py - Moves the robot forwards until an obstacle is detected, then backwards
  • alarm.py - Beeps until Finch is placed on its tail
  • testfinchfunctions.py - Tests all Finch sensors and outputs

Finch Python API Description.pdf - A local copy of the Finch API documentation

Version Information

Version 1.10 of the Finch Python package is now available and has been successfully tested on Windows XP 32-bit, Windows 7/8 64-bit, Mac OS 10.6, and Ubuntu 12.04 with Python 3.3.1 and Python 2.7.5. 

Known Issues

We have not included 32-bit support for Mac. If you are in need of this, please contact us.

The library will not run on Windows XP 64-bit with a 64-bit version of Python. Please use a 32-bit version of Python if running Windows XP 64-bit.

Jython

Download

Visit the Downloads page to choose the Finch package appropriate to your IDE and OS.

Documentation

As Jython Finch programs simply import the Finch Java libraries, the Finch Javadocs describe the methods that can be used in Jython.  The docs cover the methods used to control the Finch, read Finch sensor data, read data from RSS feeds, grab image data from webcams, and control computer speakers.  

We also provide tutorials of how to compile, create, and run programs for the Finch in several different IDEs.  

IDE & OS Support

A version of JES (the Jython Environment for Students) has been created which includes the Finch software package. This is probably the easiest way to use Jython with the Finch. We also have instructions for using the Finch with command line Jython, Eclipse, and Netbeans. Instructions for creating, compiling, and running programs for all of these environments are available.

Example files

Three examples demonstrate the functionality of the Finch in Jython.  These examples specifically cover how to control the Finch's wheels, buzzer, and LED; how to read obstacle sensor data, and how to use data from an RSS feed.  A more complete example set is available in the Java software package.  

Structure of the Software Package

The software package folder has three top-level folders:

SourceFiles - Location of the finch.jar library, examples (in the "Code" subfolder), and libraries for webcam support

Javadocs - Location of the documentation

Licenses - Licensing information for the download and for third-party libraries

In the case of IDE-specific downloads, additional folders may exist containing data for the IDE project files.  

Known Issues

LTI-Civil, the third-party library used to grab image data from webcams, does not work in a 64-bit OS.