Notice: MediaWiki has been updated. Report any rough edges to marcan@marcan.st

Difference between revisions of "Getting Started"

From OpenKinect
Jump to: navigation, search
(Modified the intro and gave it a header. Added 1-User contribs cue i.e. 2 links from mainpage 2-Power adapter issue 3-Suggestion of pastebin to avoid flooding the channel.)
m
Line 3: Line 3:
 
This page documents how to get started using OpenKinect. The libraries are very much in flux and this won't be the final process. This also means these instructions might be out of date with the latest commits. You may also take a look at the user contributed build/install guides.
 
This page documents how to get started using OpenKinect. The libraries are very much in flux and this won't be the final process. This also means these instructions might be out of date with the latest commits. You may also take a look at the user contributed build/install guides.
  
In order for the Kinect to work on your PC, it will need its own power source which is independent from the USB connection. The latest Xbox360 can power the Kinect directly but the older Xbox requires an adapter for that purpose. Therefore, the Kinect which is bundled with the Xbox360 doesn't include an adapter whereas the Kinect which is sold separately does. The adapter is sold [http://store.microsoft.com/microsoft/Kinect-Sensor-Power-Supply/product/9A4CFC08 here]. You will this adapter to use the Kinect on your PC with OpenKinect.
+
In order for the Kinect to work on your PC, it will need its own power source which is independent from the USB connection. The latest Xbox360 can power the Kinect directly but the older Xbox requires an adapter for that purpose. Therefore, the Kinect which is bundled with the Xbox360 doesn't include an adapter whereas the Kinect which is sold separately does. The adapter is sold [http://store.microsoft.com/microsoft/Kinect-Sensor-Power-Supply/product/9A4CFC08 here]. You will need this adapter to use the Kinect on your PC with OpenKinect.
  
 
For support requests in the IRC channel, please use a tool like [http://pastebin.com/ pastebin] to share your output! Thank you!
 
For support requests in the IRC channel, please use a tool like [http://pastebin.com/ pastebin] to share your output! Thank you!

Revision as of 07:40, 5 December 2010

Before you start

This page documents how to get started using OpenKinect. The libraries are very much in flux and this won't be the final process. This also means these instructions might be out of date with the latest commits. You may also take a look at the user contributed build/install guides.

In order for the Kinect to work on your PC, it will need its own power source which is independent from the USB connection. The latest Xbox360 can power the Kinect directly but the older Xbox requires an adapter for that purpose. Therefore, the Kinect which is bundled with the Xbox360 doesn't include an adapter whereas the Kinect which is sold separately does. The adapter is sold here. You will need this adapter to use the Kinect on your PC with OpenKinect.

For support requests in the IRC channel, please use a tool like pastebin to share your output! Thank you!

Linux

Binary Packages

Already compiled rpm and deb packages are available here: http://livingplace.informatik.haw-hamburg.de/blog/?p=228

Please note, that there are not udev generated devices for now, so you need to execute your programs as root (use sudo).

These packages are frequently updated, last time on Nov,19,2010

Ubuntu

An Ubuntu launchpad ppa for Lucid(10.04) and Maverick (10.10) is available at:

https://launchpad.net/~arne-alamut/+archive/freenect

to use it, open a console and execute:

$ sudo apt-add-repository ppa:arne-alamut/freenect

Resynchronize the list of packages from the repository:

$ sudo apt-get update

After that, you can use:

$ sudo apt-get install libfreenect

After that, you need to addyourself to the 'video' group and log back in.

$ sudo adduser YOURNAME video

You need to add following udev rules to allow non sudo users to access the kinect.

$ sudo vi /etc/udev/rules.d/51-kinect.rules

Add the following to this file, save and reboot.

# ATTR{product}=="Xbox NUI Motor"
SUBSYSTEM=="usb", ATTR{idVendor}=="045e", ATTR{idProduct}=="02b0", MODE="0666"

# ATTR{product}=="Xbox NUI Audio"
SUBSYSTEM=="usb", ATTR{idVendor}=="045e", ATTR{idProduct}=="02ad", MODE="0666"

# ATTR{product}=="Xbox NUI Camera"
SUBSYSTEM=="usb", ATTR{idVendor}=="045e", ATTR{idProduct}=="02ae", MODE="0666"

To start the OpenGL demo application:

$ glview

Manual build under linux

these instruction need more work, mostly taken from README.asciidoc

Install dependencies

For compiling, you need to have the following libs/programs installed:

* cmake
* libusb-1.0-0
* libusb-1.0-0-dev
* pkg-config
* libglut3
* libglut3-dev

Note that the above package names seem to be geared toward Ubuntu/Debian. For a non-developer install of RedHat/Fedora using yum/rpms, the following command should install all packages needed to retrieve, compile, & run the glview demo:

$ yum install git cmake gcc gcc-c++ libusb1 libusb1-devel libXi libXi-devel libXmu libXmu-devel freeglut freeglut-devel

clone the repo

$ git clone https://github.com/OpenKinect/libfreenect.git
$ cd libfreenect

cmake

$ mkdir build
$ cd build
$ cmake ..
$ make


Errors

If you run into into the following error:


$ CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
$ Please set them or make sure they are set and tested correctly in the CMake files:
$ GLUT_Xi_LIBRARY (ADVANCED)
$    linked by target "glview" in directory /home/user/libfreenect/examples
$ GLUT_Xmu_LIBRARY (ADVANCED)
$    linked by target "glview" in directory /home/user/libfreenect/examples

Then you need to install libxi-dev and libxmu-dev/libxmu-headers If you are using ubunto 10.04, type the command: sudo apt-get install libusb-1.0-0-dev

use as normal user (no sudo)

create a file: /etc/udev/rules.d/66-kinect.rules

#Rules for Kinect ####################################################
SYSFS{idVendor}=="045e", SYSFS{idProduct}=="02ae", MODE="0660",GROUP="video"
SYSFS{idVendor}=="045e", SYSFS{idProduct}=="02ad", MODE="0660",GROUP="video"
SYSFS{idVendor}=="045e", SYSFS{idProduct}=="02b0", MODE="0660",GROUP="video"
### END #############################################################

and add yourself to the video group as stated above

test

maybe you need to do this as root (or use sudo)

$ examples/glview

or

$ sudo bin/glview

OS X

It is best to install (at least the prerequisites) via a package manager. If you're not already using macports or fink), try Homebrew as we actually have a full package created for this.

MacPorts

Current versions of MacPorts need to support several different versions of libusb. We have added a special libusb-devel port that builds the patch libusb library required by the Kinect.

After installing MacPorts, issue the commands

 sudo port install git-core
 sudo port install libtool
 sudo port install libusb-devel

Then change to a working directory, and you're ready to

git clone https://github.com/OpenKinect/libfreenect.git

and continue as per the Manual Build under OSX section. The libusb found by cmake will be correct and already-patched, greatly simplifying the build process!

Homebrew

If you dont have Homebrew already, it is quite simple to install if not).

Note: Even if you already have homebrew, make sure to update your formulas (run `brew update`), before trying to install libfreenect as there has been a lot of bugfixing to cmake lately.

Get the formulas

Since the project is still so much in flux the packages are not yet in the official homebrew directory, so you will need to manually fetch them

cd /usr/local/Library/Formula
curl --insecure -O "https://github.com/OpenKinect/libfreenect/raw/master/platform/osx/homebrew/libfreenect.rb"
curl --insecure -O "https://github.com/OpenKinect/libfreenect/raw/master/platform/osx/homebrew/libusb-freenect.rb"

Install

brew install libfreenect

And thats it, you are done! A copy of glview demo should now be in your PATH so you can simply run

glview

to confirm everything worked out ok

Manual Build under OSX

Prerequisites:

  • git
  • cmake

Next create fetch the OpenKinect repository and libusb:

git clone https://github.com/OpenKinect/libfreenect.git
git clone git://git.libusb.org/libusb.git

You will need to patch libusb for OpenKinect like so:

cd libusb
./autogen.sh
patch -p1 < ../libfreenect/platform/osx/libusb-osx-kinect.diff
./configure LDFLAGS='-framework IOKit -framework CoreFoundation'
make
sudo make install

and configure OpenKinect:

cd ../libfreenect/
mkdir build
cd build
ccmake ..

Now press 'c' in ccmake to configure it. It will likely fail, because it cannot find libusb. Press 'e' to exit help and manually edit the path to libusb in the following screen to point to

/usr/local/include/libusb-1.0/

and continue

When you're done, build OpenKinect:

cmake ..
make

If you want to build OpenKinect as an Xcode project, instead do

cmake -G Xcode ..
make

And you're done! There now should be a program called 'glview' in libfreenect/c/build/examples. Connect your Kinect and start it!

(originally from http://www.spoofscript.com/blog/?p=327)

Parallel usage with pyusb

If you want to also use pyusb to play with the Kinect, you will need libusb-1.0.8 (it seems). Install it via homebrew and then define the _lib variable before finding the usb device:

from ctypes import *
import usb.core
import usb.utils

_lib = CDLL('/usr/local/Cellar/libusb/1.0.8/lib/libusb-1.0.dylib') # That's the location homebrew puts the libusb libraries
dev = usb.core.find(idVendor=0x045e, idProduct=0x02B0)

Windows

Getting Started in Windows Getting_Started_Windows. On this Site, frequently built binaries can be downloaded: ajaxorg.posterous.com

Dependencies

http://sourceforge.net/apps/trac/libusb-win32/wiki

ftp://sourceware.org/pub/pthreads-win32/dll-latest

http://www.xmission.com/~nate/glut.html

User contributions