2013年11月7日 星期四

Build OpenNI apk in Ubuntu shell

You should have AndroidManifest.xml in the APK root first and use the following command to generate build.xml

~/ADT/android-sdk-linux/tools/android update project --target android-18 -p .
Now you can build

 ant debug/release -Dsdk.dir=/home/stevenchiu/ADT/android-sdk-linux/

Easy~

To run OpenNI Simple Viewer wth Kinect in BeagleBone Black Android

 1. Build OpenNI
git clone git://github.com/OpenNI/OpenNI
git checkout -b 1.5.4.0 Unstable-1.5.4.0
 checkout to tag 1.5.4.0, only this tag works for me
cd Platform/Android/jni
${NDK_ROOT}/ndk-build
 You have to define your NDK_ROOT of course. I use NDK r7

 If you encountered cpu_set_t can not be recognized in  NiSkeletonBenchmark.cpp, simply ignore this behaviour

 -#if (XN_PLATFORM != XN_PLATFORM_MACOSX)       
+#if (XN_PLATFORM != XN_PLATFORM_MACOSX && XN_PLATFORM != XN_PLATFORM_ANDROID_ARM)      ^M
     //we want out benchmark application will be running only on one CPU core
     cpu_set_t mask;



 2. Build SensorKinect 
export NDK_MODULE_PATH=/path/to/openni/Platform/Android/jni
git clone git://github.com/avin2/SensorKinect.git
git checkout -b unstable origin/unstable
cd Platform/Android/jni
${NDK_ROOT}/ndk-build

 3. Upload your libraries and binary to Android
    Now we have to upload the libraries located in Platform/Android/libs/armeabi-v7a/*.so to android /system/libs. We have to upload OpenNI libraries first and then SensorKinect since some libraries should be replaced according to the HW.


i.e. Kinect in this case.
    
    Please remember to upload the Sample-SimpleRead binary to /system/bin/



 4. Mount USBFS to grant USB device permission
   mount -o devmode=0666 -t usbfs none /proc/bus/usb


 5. Push xmls to /Data/ni
     adb push SamplesConfig.xml /Data/ni
      adb push modules /Data/ni
      adb push GlobalDefaultskinect.ini /Data/ni
      adb push License.xml /Data/ni

6. Run Sample-Read under /Data/ni
    You should be able to see the middle point and frame rate

#Trouble shooting
    USB open fail => sudo rmmod  gpsca_kinect

2013年10月30日 星期三

To run Nite samples in Ubuntu 13.10 (Nite + OpenNI + SensorKinect)

1. Build OpenNI
git clone git://github.com/OpenNI/OpenNI
git checkout -b 1.5.4.0 Unstable-1.5.4.0
 checkout to tag 1.5.4.0, only this tag works for me
cd Platform/Linux/CreateRedist
./RedistMaker
cd ../Redist/$(Openni Version)/
In my case, it's OpenNI-Bin-Dev-Linux-x64-v1.5.4.0
sudo install.sh

2. Build SensorKinect
git clone git://github.com/avin2/SensorKinect.git
git checkout -b unstable origin/unstable
cd Platform/Linux/CreateRedist
./RedistMaker
 cd ../Redist/$(Sensor Kinect Version)/
In my case, it's  Sensor-Bin-Linux-x64-v5.1.2.1
sudo install.sh
It's that simple.

now you can download NITE-Bin-Dev-Linux-x64-v1.5.2.21.tar.zip and run samples under Samples/Bin/x64-Release

2013年10月28日 星期一

[BBB] memo of configuring BeagleBone Black network

manually add a gateway
route add default gw 192.168.1.1 dev eth0 => add default gateway 
 
 
The following configuration in /etc/network/interfaces does all above:
#iface eth0 inet dhcp
iface eth0 inet static
address 192.168.1.2
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
dns-nameservers 192.168.1.1 
 
Finally, add nameserver in /etc/resolf.conf
echo "nameserver 192.168.1.1" > /etc/resolv.conf 

Restart network now:
/etc/init.d/networking restart =>  restart network or 
ifdown eth0; ifup eth0
 
toolchain for BBB is arm-linux-gnueabihf


Problem solved! 
 
extract and cross compiled with CC=arm-linux-gnueabihf-gcc ./configue --target=arm-linux 


2013年10月21日 星期一

Build OpenCV from souce


sudo apt-get install libgtk2.0-dev
I only encounter this problem. please google the error message you see to get the corresponding solutions
git clone https://github.com/Itseez/opencv.git
cd opencv
git checkout 2.4.6.2 -b 2.4.6.2
default is master branch and I manually checkout to 2.4.6.2 tag.
mkdir build(whatever name you want)
cd build
cmake-gui ..
(to generate the configurations you want and generate make file. sudo apt-get install cmake-gui if you don't have it.)
make; sudo mak install

2013年7月24日 星期三

Generate patches for specific user

To generate my own patches by the following command:

for commit in `git log --author=XXX --pretty=oneline | awk '{print $1}'`; do git format-patch -1 "$commit"; done