Re-Integrated the project 'Andgee' (wiigee port to Android) into wiigee. For those who don't need android support: Please remove the files to get wiigee compiled without the android SDK installed. I'm looking forward to find a practicable solution for a possible release version to run without modifications or not-needed SDKs installed. Additionally there was an uncommented line within the HMM implementation which should be commented for 'productivity' environments. This has been fixed. Thanks to all the hints given from the wiigee supporters!

git-svn-id: svn://svn.code.sf.net/p/wiigee/code/trunk@74 c7eff9ee-dd40-0410-8832-91a4d88773cf
This commit is contained in:
bepo23
2009-06-02 06:22:12 +00:00
parent 3b30923460
commit c36054596b
5 changed files with 193 additions and 6 deletions

View File

@@ -23,11 +23,13 @@ dist.dir=dist
dist.jar=${dist.dir}/wiigee-lib.jar
dist.javadoc.dir=${dist.dir}/javadoc
excludes=
file.reference.android.jar=../../../android-sdk-mac_x86-1.5_r2/platforms/android-1.5/android.jar
file.reference.bluecove-2.1.0.jar=lib/bluecove-2.1.0.jar
includes=**
jar.compress=false
javac.classpath=\
${file.reference.bluecove-2.1.0.jar}
${file.reference.bluecove-2.1.0.jar}:\
${file.reference.android.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false

View File

@@ -0,0 +1,108 @@
/*
* wiigee - accelerometerbased gesture recognition
* Copyright (C) 2007, 2008, 2009 Benjamin Poppinga
*
* Developed at University of Oldenburg
* Contact: benjamin.poppinga@informatik.uni-oldenburg.de
*
* This file is part of wiigee.
*
* wiigee is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package control;
import device.AndroidDevice;
import event.GestureListener;
import filter.Filter;
import util.Log;
/**
* This is for using wiigee on Android Smartphones. This port has been
* initiated by Maarten 'MrSnowflake' Krijn and updated by 'zl25drexel'
* under the pseudonym 'Andgee'.
*
* It has been re-integrated into wiigee on 29th May of 2009.
*
* @author Maarten 'MrSnowflake' Krijn
* @author zl25drexel
* @author Benjamin 'BePo' Poppinga
*/
public class AndroidWiigee {
protected static String version = "1.0 alpha";
protected static String releasedate = "20090529";
protected static AndroidWiigee instance;
private AndroidDevice device;
private AndroidWiigee() {
device = new AndroidDevice();
}
public static synchronized AndroidWiigee getInstance() {
Log.write("This is AndroidWiigee (Andgee) version "+version+" ("+releasedate+")");
Log.write("This is an Android adaptation of Wiigee (http://wiigee.sourceforge.net/)");
Log.write("So many thanks to the Wiigee team for their awsome recognition lib!");
if(instance == null) {
instance = new AndroidWiigee();
return instance;
} else {
return instance;
}
}
public void addGestureListener(GestureListener listener) {
device.addGestureListener(listener);
}
public void addFilter(Filter filter) {
device.addFilter(filter);
}
public AndroidDevice getDevice() {
return device;
}
/**
* Sets the Trainbutton for all wiimotes;
*
* @param b Button encoding, see static Wiimote values
*/
public void setTrainButton(int b) {
device.setTrainButton(b);
}
/**
* Sets the Recognitionbutton for all wiimotes;
*
* @param b Button encoding, see static Wiimote values
*/
public void setRecognitionButton(int b) {
device.setRecognitionButton(b);
}
/**
* Sets the CloseGesturebutton for all wiimotes;
*
* @param b Button encoding, see static Wiimote values
*/
public void setCloseGestureButton(int b) {
device.setCloseGestureButton(b);
}
}

View File

@@ -26,9 +26,6 @@ package control;
import java.io.IOException;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.bluetooth.BluetoothStateException;
import javax.bluetooth.DiscoveryAgent;
import javax.bluetooth.LocalDevice;

View File

@@ -0,0 +1,80 @@
/*
* wiigee - accelerometerbased gesture recognition
* Copyright (C) 2007, 2008, 2009 Benjamin Poppinga
*
* Developed at University of Oldenburg
* Contact: benjamin.poppinga@informatik.uni-oldenburg.de
*
* This file is part of wiigee.
*
* wiigee is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package device;
import android.hardware.SensorListener;
import android.hardware.SensorManager;
/**
* Android based device implementation
*
* @author liangj01
*
*/
public class AndroidDevice extends Device implements SensorListener {
private float x0, y0, z0, x1, y1, z1;
public AndroidDevice() {
// 'Calibrate' values
this.x0 = 0;
this.y0 = -SensorManager.STANDARD_GRAVITY;
this.z0 = 0;
this.x1 = SensorManager.STANDARD_GRAVITY;
this.y1 = 0;
this.z1 = SensorManager.STANDARD_GRAVITY;
}
@Override
public void onSensorChanged(int sensor, float[] values) {
if (this.accelerationEnabled() && sensor == SensorManager.SENSOR_ACCELEROMETER) {
double x, y, z;
float xraw, yraw, zraw;
/*
* calculation of acceleration vectors starts here. further
* information about normation exist in the public papers or
* the various www-sources.
*
*/
xraw = values[SensorManager.DATA_X];
yraw = values[SensorManager.DATA_Y];
zraw = values[SensorManager.DATA_Z];
x = (double) (xraw - x0) / (double) (x1 - x0);
y = (double) (yraw - y0) / (double) (y1 - y0);
z = (double) (zraw - z0) / (double) (z1 - z0);
this.fireAccelerationEvent(new double[] {x, y, z});
}
}
@Override
public void onAccuracyChanged(int arg0, int arg1) {
// TODO
}
}

View File

@@ -135,7 +135,7 @@ public class HMM {
double nenner=0;
for(int k=0; k<trainsequence.size(); k++) {
this.reset();
//this.reset();
int[] sequence = trainsequence.elementAt(k);
double[][] fwd = this.forwardProc(sequence);
@@ -165,7 +165,7 @@ public class HMM {
double nenner=0;
for(int k=0; k<trainsequence.size(); k++) {
this.reset();
//this.reset();
int[] sequence = trainsequence.elementAt(k);
double[][] fwd = this.forwardProc(sequence);