ECE497 Project: Kinect

Team members: Yue Zhang, Xinyu Cheng, Xia Li.

Grading Template
I'm using the following template to grade. Each slot is 10 points. 0 = Missing, 5=OK, 10=Wow!

 00 Executive Summary 00 Installation Instructions 00 User Instructions 00 Highlights 00 Theory of Operation 00 Work Breakdown 00 Future Work 00 Conclusions 00 Demo 00 Late Comments:

Score: 00/100

(Inline Comment)

Executive Summary
I believe that almost every college students have played a game called "Greedy Snake" in our childhood. At that time, we played it on the cellphone, on the computer or on the PSP. However, we are always using the keyboard to control the games we played. Now, our final project could bring you something new, that is a "Gesture Controlled Greedy Snake". It means that, using the gesture, the keyboard is never required to play the game. Amazing? Read the following wiki to know how we make it happens!

Basically, we are using the kinect from Microsoft and the Beagle Board XM from Texas Instrument to accomplish our gesture game. The program for the game is programmed on the QT-Linux. Besides, we use the cross compiling to compile the program to make the game run on the beagle board.

After our previous work, our "Gesture Greedy Snake" is completed, and works pretty good. The snake can be controlled by our gestures smoothly. The game reminds us a different style of childhood memory.

Installation Instructions
Hardware

1 x Kinect

1 x BeagleBoard xM

1 x Keyboard

1 x Mouse

1 x DVI to HDMI wire

1 x Power Supply

1 x Monitor

We are using the drivers provided by Omek. The driver files can be found at the Beckon™ SDK 2.4 – BeagleBoard-xM Edition installation page, and a developer's guide is provided at the documentation page. (You may need to register first.) Instructions in this blog are also very useful.

Although the developer's guide introduces how to do the installation and configuration, we have found that it takes much longer than we originally thought and errors came out occationally. It seems that the developer's guide is not very well organized and not detailed enought anyway. So we arranged our instruction and configuration procedures as below:

1. Download the image package and burn it into the SD card

Download the image package Beckon-Image-2.4.19872.tar.gz as mentioned above onto your Linux PC. Then extract it by entering

host$ tar -xvzf 

Run the following command to make sure you have bash installed.

host$ sudo apt-get install bash

Insert your SD card using a card reader/writer. Run the following command:

host$ sudo bash mkcard.sh /dev/ beagle-omek

''Note: This action will wipe out and rewrite the SD card so make sure the files in it are backed up. The name of the SD card can be viewed in Disk Utility. If you mistakenly use the main OS device name this script can erase your entire OS.''

2. Run the sample application

Plug the sensor into the BeagleBoard-xM USB port. Ensure the mouse and keyboard are connected to the BeagleBoard-xM USB port. Connect the BeagleBoard-xM to the monitor with an HDMI cable. Connect the BeagleBoard-xM power supply and wait for the boot process to reach the login prompt, login as user root (no password is required). Now it's ready to run the sample applications on the BeagleBoard-xM.

''Note: Details about running the samples can be found in the developer's guide from page 9 to 11. The Kinect will react properly only if the player is within an appropriate distance (about 1m - 5m). ''

3. Setting up your Linux development PC

Download Beckon-SDK-2.4.19872.tar.gz and extract it onto your host PC (this is the actual SDK which contains headers, libraries, documentation, makefiles, etc...) The SDK provides the tools to develop a motion-tracking and gesture-based application that can run on the BeagleBoard-xM. After developing the application, cross-compile it onto the Linux PC and then copy the image onto the BeagleBoard-xM via external USB storage.

1) Download the Linux ARM cross toolchain:

For 32-bit Ubuntu you will want to download this file: http://www.angstrom-distribution.org/toolchains/angstrom-2011.03-i686-linux-armv7a-linux-gnueabi-toolchain-qte-4.6.3.tar.bz2

For 64-bit Ubuntu you will want to download this file: http://www.angstrom-distribution.org/toolchains/angstrom-2011.03-x86_64-linux-armv7a-linux-gnueabi-toolchain-qte-4.6.3.tar.bz2

Extract the downloaded archive into your system root directory:

host$ sudo tar -xvjf  -C /

Note: If you extract the archive into a different directory, you should adjust the following instructions as well as the samples' makefiles accordingly.

2) Install the Qt embedded SDK for Angstrom/BeagleBoard:

Now that you have your cross compiler installed, you can compile Qt with it. First thing to do is to install zlib library:

host$ sudo apt-get install zlib1g-dev

Then download the Open Source LGPL version of Qt libraries 4.6.2 for Embedded Linux here.

''Note: Newest version of Qt libraries can be found here. We didn't test it since the 4.6.2 version works fine.''

Extract the file you just downloaded:

host$ tar -xvzf 

You need to create a new make.conf. Run the following line to make a new mkspecs directory for the BeagleBoard Processor.

host$ cp -R /mkspecs/qws/linux-arm-g++/ /mkspecs/qws/linux-DM3730-g++/

Edit the qmake.conf file found in /mkspecs/qws/linux-DM3730-g++/ and overwrite it with the following lines.


 * 1) qmake configuration for building with arm-linux-g++
 * 1) qmake configuration for building with arm-linux-g++

include(../../common/g++.conf) include(../../common/linux.conf) include(../../common/qws.conf)


 * 1) modifications to g++.conf
 * 2) Toolchain

QMAKE_CFLAGS_RELEASE =  -O3 -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp QMAKE_CXXFLAGS_RELEASE = -O3 -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp
 * 1) Compiler Flags to take advantage of the ARM architecture

QMAKE_CC = /usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/bin/gcc QMAKE_CXX = /usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/bin/g++ QMAKE_LINK = /usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/bin/g++ QMAKE_LINK_SHLIB = /usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/bin/g++

QMAKE_AR = /usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/bin/ar cqs QMAKE_OBJCOPY = /usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/bin/objcopy QMAKE_STRIP = /usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/bin/strip
 * 1) modifications to linux.conf

load(qt_config)

Now run the configure command (see this website for more details if needed):

host$ cd 

For 32-bit Ubuntu:

host$ ./configure -opensource -confirm-license -prefix /opt/qt-arm -no-qt3support -embedded arm -little-endian -xplatform qws/linux-DM3730-g++ -qtlibinfix E

For 64-bit Ubuntu:

host$ ./configure -opensource -confirm-license -prefix /opt/qt-arm -no-qt3support -embedded arm -little-endian -platform qws/linux-x86_64-g++ -xplatform qws/linux-DM3730-g++ -qtlibinfix E

Once this is complete you can run make and make install (make may take some hours):

host$ make host$ sudo make install

3) Install and set up Qt Creator:

Go to http://qt-project.org/downloads to download Qt. Get the latest version of Qt for Linux/X11; be sure to get the appropriate 32bit or 64bit version. Once downloaded go to the download directory and execute the following using your download file name:

host$ chmod u+x  host$ ./

Update:The free version Qt Creator can not be used in this project since it doesn't have cross-compile option with it.

After Qt Creator is successfully installed, start Qt Creator. Go to: Tools > Options > Build & Run > Tool Chains, select Add -> GCC and insert the full compiler path below:

/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/bin/g++

Then go to: Tools > Options > Build & Run > Qt Versions, select Add and provide the following full path to qmake

/opt/qt-arm/bin/qmake

Press Apply and OK.

4. Setting up the BeagleBoard-xM

All of the Qt files that you need to move to the BeagleBoard can be found in the /opt/qt-arm/lib directory on your Linux Build System. Copy all the files out of your build system's /opt/qt-arm/lib directory and put those into the BeagleBoard-xM's /opt/qt-arm/lib directory. You can get the files to the Beagleboard by either networking, using a usb drive or plug the SD card into your Linux Build System.


 * Include your github path as a link like this: https://github.com/MarkAYoder/gitLearn.
 * Include any additional packages installed via opkg.
 * Include kernel mods.
 * If there is extra hardware needed, include links to where it can be obtained.

User Instructions
To build QtTracking Sample:

1. Start Qt Creator.

2. Go to: File > Open File or Project, select the QtTracking-SDK.pro project (from Beckon-SDK-{version}/samples/QtTracking) and click Open. Select Embedded Linux instead of Desktop.

3. Click Finish.

4. Go to Projects tab (on the left), In Qt version select Qt [4.x.x (qt-arm)]/.

5. Run Build -> Build Project command.

The result executable can be found in the Beckon-SDK-{version}/bin directory.

To run the QtTracking Sample:

1. Mount or copy the bin directory to the BeagleBoard.

Note: Run the reset.sh script inside the "bin" folder of the SDK before each sample run, to reset the DSP.

Run the following:

beagle$ ./QtTracking-SDK –qws

Note: Developer's guide has more instructions on running the sample

Others are coming soon.

Highlights
Coming soon.

Theory of Operation
We are using the kinect as the sensor of our project. The provided algorithm of the kinect make it possible for us to get the coordinate of many joints of the body. In this case, we can judge the position and the motion of our hands or any other joints. Then, we can use the direction we get from the previous judgement to control the Greedy Snake. Our project is running with the idea.

Tenically, we can use QT to design our program and then cross-complie our project to the beagle-board. The Greedy Snake is an open-source QT game, and the tracking of the joint can be accomplished from modifying the Omek SDK. We have to modify both of their codes to connect the two parts together.

Work Breakdown
 Yue Zhang   Xinyu Cheng   Xia Li 
 * Previous Work Breakdown:
 * Researched how to Burn the correct Image to the Beagle Board.
 * Configure the Beagle Board to control the kinect.
 * Implemented the motion based algorithm which makes the application runs more smoothly.
 * Programmed for the part of motion algorithm.
 * Researched how to configure the QT programming environment.
 * Accomplished the cross-compiling on QT.
 * Programming for the connection between the Snake Game and the Kinect SDK.
 * Designed and Implemented the coordinate based algorithm.
 * Researched how to run the provided SDK demo.
 * Speed up for the demo.
 * Designed the motion based algorithm.
 * Programmed to improved the accuracy and speed of the game.

Future Work
Now, our game can work pretty good and smoothly. The future work for the project will mainly about how to improve the user interface and the game rules. We can also improve our algorithm for the direction judgement.

Conclusions
Conculsionly, our project works pretty good. Our Greedy Snake game runs very good and brings a lot of fun for us. During the develop process, we met lots of difficulties, we tried to solve them one by one. Finally, we solved almost all the problems and end up with a nice project.