Difference between revisions of "ECE497 Notes on Kinect"

From eLinux.org
Jump to: navigation, search
(Undo revision 223058 by Larmorgs (talk))
(2 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
{{YoderHead}}
 
{{YoderHead}}
  
[http://rakarrack.sourceforge.net/ Rakarrack] is an open source effects processor that emulates a guitar effects pedal board.  
+
[http://www.xbox.com/en-US/kinect Microsoft's Kinect] sensor has created great interest in the Beagle Community.
  
Rakarrack can be run easily in Ubuntu on the BeagleBone. Below is the installation process for use with the [http://circuitco.com/support/index.php?title=BeagleBone_Audio BeagleBone Audio Cape].  
+
Here are notes on installing the third party drivers from [http://www.omekinteractive.com/ Omek].
  
*The following is tested on Ubuntu 12.10 running version 3.2.33-psp26 of the kernel.
+
== Downloading ==
  
 +
I got the 4 files from [http://support.omekinteractive.com/index.php?/TI/managedownloads/Download/View/19/7/beagleboard-xm-installation-and-documentation here].  Here's the files I have
  
== Ubuntu Installation ==
+
host$ '''ls -sh'''
 +
<pre>
 +
total 65M
 +
4.0K beagle-omek
 +
54M beckon-image-2.4.16175.tar.gz
 +
4.0K Beckon-SDK-2.4.16236
 +
11M beckon-sdk-2.4.16236.tar.gz
 +
4.0K create_sd.txt
 +
4.0K mkcard.sh
 +
1.1M omek beckon sdk, ti dm3730 edition -- developer guide.pdf
 +
4.0K readme
 +
4.0K UsersGuide
 +
</pre>
  
To install Ubuntu on the BeagleBone follow the instructions found on the [http://elinux.org/BeagleBoardUbuntu BeagleBoardUbuntu elinux site].
+
== Installing ==
  
login: ubuntu
+
I'm getting this error.
password: temppwd
+
  
 +
host$  '''sudo bash mkcard.sh /dev/mmcblk0 beagle-omek/'''
 +
<pre>
 +
Using image beagle-omek/
 +
using device /dev/mmcblk0
 +
.
 +
You are about to totaly erase the device, are you sure (yes/no) ?yes
 +
1024+0 records in
 +
1024+0 records out
 +
1048576 bytes (1.0 MB) copied, 0.382056 s, 2.7 MB/s
 +
Disk /dev/mmcblk0 doesn't contain a valid partition table
 +
DISK SIZE - 8010072064 bytes
 +
CYLINDERS - 973
 +
Checking that no-one is using this disk right now ...
 +
OK
  
=== ALSA ===
+
Disk /dev/mmcblk0: 973 cylinders, 255 heads, 63 sectors/track
  
In Ubuntu, to get ALSA to work with the BeagleBone Audio cape, the following modules need to be specified in '/etc/modules'
+
sfdisk: ERROR: sector 0 does not have an msdos signature
 +
/dev/mmcblk0: unrecognized partition table type
 +
Old situation:
 +
No partitions found
 +
New situation:
 +
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0
  
   snd_soc_tlv320aic3x
+
  Device Boot Start    End   #cyls    #blocks   Id  System
   snd_soc_davinci
+
/dev/mmcblk0p1   *      0+      8      9-    72261    c  W95 FAT32 (LBA)
   snd_soc_davinci_mcasp
+
/dev/mmcblk0p2          9    972    964    7743330   83  Linux
   snd_soc_evm
+
/dev/mmcblk0p3          0      -      0          0    0  Empty
 +
/dev/mmcblk0p4          0      -      0          0    0  Empty
 +
Successfully wrote the new partition table
  
You can test the audio by running `speaker-test`. Also running `aplay -l` will show a list of available sound cards. If the sound card is not shown, run `lsmod` and `dmesg` and make sure the kernel modules above have loaded without errors.
+
Re-reading the partition table ...
  
 +
If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)
 +
to zero the first 512 bytes:  dd if=/dev/zero of=/dev/foo7 bs=512 count=1
 +
(See fdisk(8).)
 +
done partitioning.
 +
Cant find boot partition  /dev/mmcblk01
 +
Cant find rootfs partition in  /dev/mmcblk02
 +
mount: special device /dev/mmcblk01 does not exist
 +
</pre>
 +
Failed to mount /dev/mmcblk0'''1'''.
  
== Rakarrack Installation ==
+
The problem is it's looking for /dev/mmcblk0'''1''' and on my Ubuntu 10.4 it appears at /dev/mmcblk0'''p1'''.
  
Rakarrack uses the [http://jackaudio.org/ Jack Audio Connection Kit] to route audio between applications.
+
I modified '''mkcard.sh''' to add the '''p''' and after a little fussing it worked!
  
 +
== Running ==
  
=== JACK ===
+
It booted up and runs fine. There is no X windows, rather the one demo uses QT embedded.  QT embedded writes straight to the framebuffer and doesn't need X.
  
Start by installing jackd2. This requires a patch for the current version (jackd-1.9.10) on ARM (see [http://jack-audio.10948.n7.nabble.com/Jack-Devel-jack2-on-ARM-patch-td15962.html this forum post]). Run the recipe below (copied from that post with a couple modifications).
+
== Porting ==
  
  wget http://jack-audio.10948.n7.nabble.com/attachment/15962/0/jack2_armel.diff
+
I'm now in the process of seeing if I can copy the demos over to an SD card that I've been doing other development on.  My SD isn't set up for QT embedded, so I'm trying:
  apt-get source jackd2
+
  cd jackd2-1.9.8~dfsg.4+20120529git007cdc37
+
  patch -p1 -i ../jack2_armel.diff
+
  dpkg-buildpackage -rfakeroot -uc -b
+
  cd ..
+
  sudo dpkg -i libjack-jackd2-0_1.9.8~dfsg.4+20120529git007cdc37-2ubuntu1_armhf.deb jackd2_1.9.8~dfsg.4+20120529git007cdc37-2ubuntu1_armhf.deb
+
  
 +
beagle$ '''opkg update'''
 +
beagle$ '''opgk install qt4-embedded-tools'''  # 5  minutes
 +
beagle$ '''opgk install qt4-embedded-static''' # 2.5 minutes
 +
beagle$ '''opgk install qt4-embedded-fonts'''  # 2.5 minutes
  
=== Rakarrack ===
+
These times running on a rather slow network at home. I don't know if the 'static' needs to be installed.
  
Then install Rakarrack by running the following:
+
Next I went to the SD that was working with the Kinect and copied /usr/lib/libOpenNI.* to /usr/lib on the target SD card.  I now get the following error.
  
  sudo apt-get install rakarrack
+
beagle$ '''./QtTracking -qws'''
 
+
Error creating sensor.
The installation should install jackd as a dependency. To check the installed jack packages run the following:
+
Failed to initialize tracking !
  
  dpkg --get-selections | grep jack
+
I'm guess I don't have the DSP stuff setup right.
 
+
You should see something like this:
+
  
  ubuntu@arm:~$ dpkg --get-selections | grep jack
+
[http://youngindiafellowship.academia.edu/JatinSharma/Blog/48864/OpenNI-on-Beagle-Board-XM This] might help with the openNI port.
  jack                                            deinstall
+
  jackd                                          install
+
  jackd1                                          deinstall
+
  jackd2                                          install
+
  libjack-jackd2-0:armhf                          install
+
  libjack0:armhf                                  deinstall
+
  qjackctl                                        deinstall
+
  
 
+
{{YoderFoot}}
== System Configuration ==
+
 
+
Before running anything we need to make sure that the BeagleBone is running at its maximum clock speed. To do this run the following:
+
 
+
  sudo cpufreq-set -f 720MHz
+
  sudo cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq
+
 
+
The output of that last command should be '720000'
+
 
+
 
+
=== JACK Configuration ===
+
 
+
Next, start JACK by running the following:
+
 
+
  jackd -d alsa -p 256 -n 16 -S
+
 
+
This tells JACK that we wan to use alsa with a 16 period 256 samples/period buffer in 16-bit mode. This should be enough delay to not cause too many XRuns in JACK but not too big to be noticeable. The output should look somethings like the following:
+
 
+
  ubuntu@arm:~$ jackd -d alsa -p 256 -n 16 -S
+
  jackdmp 1.9.10
+
  Copyright 2001-2005 Paul Davis and others.
+
  Copyright 2004-2013 Grame.
+
  jackdmp comes with ABSOLUTELY NO WARRANTY
+
  This is free software, and you are welcome to redistribute it
+
  under certain conditions; see the file COPYING for details
+
  JACK server starting in realtime mode with priority 10
+
  creating alsa driver ... hw:0|hw:0|256|16|48000|0|0|nomon|swmeter|-|16bit
+
  control device hw:0
+
  configuring for 48000Hz, period = 256 frames (5.3 ms), buffer = 16 periods
+
  ALSA: final selected sample format for capture: 16bit little-endian
+
  ALSA: use 16 periods for capture
+
  ALSA: final selected sample format for playback: 16bit little-endian
+
  ALSA: use 16 periods for playback
+
 
+
 
+
=== Rakarrack Configuration ===
+
 
+
Now you should be able to run the rakarrack GUI. Use `ssh -X ubuntu@192.168.0.XXX` to connect to the BeagleBone with X11 forwarding and then run `rakarrack`.
+
 
+
*Note that this version of the kernel does not have a working USB gadget module so ethernet over USB does not work so the BeagleBone needs to be connected to the network.
+
 
+
The program should be able to find jackd by itself. If not kill the JACK processes and rerun the configuration. One way to do this is run `ps -AL | grep jack`, and then run `kill -9` with the pid number.
+
 
+
When Rakarrack opens, it may warn you that your CPU is not fast enough to run some of the audio effects (e.g. convolutron). Don't worry about this too much.
+
 
+
In Rakarrack go to 'Settings->Preferences->Audio' and lower all the downsample rates to '4000' and change all the down and up sampling types to 'Linear'.
+
 
+
== Conclusion ==
+
 
+
With these settings we are able to run any single effect in Rakarrack without causing XRuns in JACK. Some effects can be chained together, but others are just to computationally complex.
+
 
+
== Future Work ==
+
 
+
An interesting follow up project would be to see if another embedded Linux board (e.g. BeagleBoard xM, PandaBoard, etc.) could run Rakarrack at its default settings (or maybe its maximum settings?).
+
 
+
*Note on multicore systems JACK may require some special setup for [http://jackaudio.org/linux_rt_config realtime processing]
+

Revision as of 06:09, 23 February 2013

thumb‎ Embedded Linux Class by Mark A. Yoder


Microsoft's Kinect sensor has created great interest in the Beagle Community.

Here are notes on installing the third party drivers from Omek.

Downloading

I got the 4 files from here. Here's the files I have

host$ ls -sh
total 65M
4.0K beagle-omek
 54M beckon-image-2.4.16175.tar.gz
4.0K Beckon-SDK-2.4.16236
 11M beckon-sdk-2.4.16236.tar.gz
4.0K create_sd.txt
4.0K mkcard.sh
1.1M omek beckon sdk, ti dm3730 edition -- developer guide.pdf
4.0K readme
4.0K UsersGuide

Installing

I'm getting this error.

host$  sudo bash mkcard.sh /dev/mmcblk0 beagle-omek/
Using image beagle-omek/
using device /dev/mmcblk0
.
You are about to totaly erase the device, are you sure (yes/no) ?yes
1024+0 records in
1024+0 records out
1048576 bytes (1.0 MB) copied, 0.382056 s, 2.7 MB/s
Disk /dev/mmcblk0 doesn't contain a valid partition table
DISK SIZE - 8010072064 bytes
CYLINDERS - 973
Checking that no-one is using this disk right now ...
OK

Disk /dev/mmcblk0: 973 cylinders, 255 heads, 63 sectors/track

sfdisk: ERROR: sector 0 does not have an msdos signature
 /dev/mmcblk0: unrecognized partition table type
Old situation:
No partitions found
New situation:
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start     End   #cyls    #blocks   Id  System
/dev/mmcblk0p1   *      0+      8       9-     72261    c  W95 FAT32 (LBA)
/dev/mmcblk0p2          9     972     964    7743330   83  Linux
/dev/mmcblk0p3          0       -       0          0    0  Empty
/dev/mmcblk0p4          0       -       0          0    0  Empty
Successfully wrote the new partition table

Re-reading the partition table ...

If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)
to zero the first 512 bytes:  dd if=/dev/zero of=/dev/foo7 bs=512 count=1
(See fdisk(8).)
done partitioning.
Cant find boot partition  /dev/mmcblk01
Cant find rootfs partition in  /dev/mmcblk02
mount: special device /dev/mmcblk01 does not exist
Failed to mount /dev/mmcblk01.

The problem is it's looking for /dev/mmcblk01 and on my Ubuntu 10.4 it appears at /dev/mmcblk0p1.

I modified mkcard.sh to add the p and after a little fussing it worked!

Running

It booted up and runs fine. There is no X windows, rather the one demo uses QT embedded. QT embedded writes straight to the framebuffer and doesn't need X.

Porting

I'm now in the process of seeing if I can copy the demos over to an SD card that I've been doing other development on. My SD isn't set up for QT embedded, so I'm trying:

beagle$ opkg update
beagle$ opgk install qt4-embedded-tools  # 5   minutes
beagle$ opgk install qt4-embedded-static # 2.5 minutes
beagle$ opgk install qt4-embedded-fonts  # 2.5 minutes

These times running on a rather slow network at home. I don't know if the 'static' needs to be installed.

Next I went to the SD that was working with the Kinect and copied /usr/lib/libOpenNI.* to /usr/lib on the target SD card. I now get the following error.

beagle$ ./QtTracking -qws
Error creating sensor.
Failed to initialize tracking !

I'm guess I don't have the DSP stuff setup right.

This might help with the openNI port.




thumb‎ Embedded Linux Class by Mark A. Yoder