Installation

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.

Download & Install

Click on the link corresponding with your operating system to download Python:

Windows

Mac OSX

Linux (Ubuntu)

Important Notes: For Mac, install 64-bit Python. For Windows, install 32-bit Python (even if you have a 64-bit version of Windows). If you choose to use Linux, we recommend using Ubuntu with our robots. You are welcome to use another version of Linux, but we are only able to provide technical support for Ubuntu.

Documentation

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

After you have downloaded the Finch Python package, follow the 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 and Troubleshooting

We only support 64-bit Python for Mac.

We only support 32-bit Python for Windows, but you can use the library on 64-bit versions of Windows so long as you install a 32-bit version of Python.

Issue: You run a correctly compiled program and it hangs after “Connecting to Finch”.  The LED stays in color fading mode.

Possible Causes:

  • The Finch is already connected to another program. For example, if the Finch is connected to the Birdbrain Robot Server, Python will not be able to connect to it.
  • On a Mac, you must search for the libhidapi64.dylib and libhidapi32.dylib libraries and copy them into the Mac’s /usr/local/lib directory. To find this directory, select Go/Go to Folder in the Finder. If the directory does not exist, you can create it in Terminal with the following command: sudo mkdir /usr/local/lib
  • The computer went to sleep when the Finch was plugged in and did not properly register Finch upon wakeup. Unplugging the Finch and plugging it back in will solve the issue.