From e2f20ab184059dc4a8b57d2f75f6f8cb0ddf963e Mon Sep 17 00:00:00 2001 From: Rik Veenboer Date: Sat, 18 Oct 2014 15:36:22 +0100 Subject: [PATCH] Migrate wiigee subproject to proper maven artifact --- java/mimis/build.gradle | 13 +- java/settings.gradle | 2 +- java/wiigee/.classpath | 7 - java/wiigee/.project | 18 - java/wiigee/build.gradle | 0 .../main/java/org/wiigee/control/Wiigee.java | 46 -- .../main/java/org/wiigee/device/Device.java | 245 ---------- .../org/wiigee/event/AccelerationEvent.java | 79 --- .../wiigee/event/AccelerationListener.java | 65 --- .../org/wiigee/event/ActionStartEvent.java | 84 ---- .../org/wiigee/event/ActionStopEvent.java | 44 -- .../java/org/wiigee/event/ButtonListener.java | 54 --- .../org/wiigee/event/ButtonPressedEvent.java | 80 ---- .../org/wiigee/event/ButtonReleasedEvent.java | 48 -- .../java/org/wiigee/event/GestureEvent.java | 71 --- .../org/wiigee/event/GestureListener.java | 47 -- .../java/org/wiigee/event/InfraredEvent.java | 70 --- .../org/wiigee/event/InfraredListener.java | 40 -- .../org/wiigee/event/MotionStartEvent.java | 63 --- .../org/wiigee/event/MotionStopEvent.java | 42 -- .../java/org/wiigee/event/RotationEvent.java | 66 --- .../org/wiigee/event/RotationListener.java | 43 -- .../org/wiigee/event/RotationSpeedEvent.java | 61 --- .../filter/DirectionalEquivalenceFilter.java | 70 --- .../main/java/org/wiigee/filter/Filter.java | 62 --- .../org/wiigee/filter/HighPassFilter.java | 71 --- .../org/wiigee/filter/IdleStateFilter.java | 86 ---- .../java/org/wiigee/filter/LowPassFilter.java | 67 --- .../org/wiigee/filter/MotionDetectFilter.java | 102 ---- .../filter/RotationThresholdFilter.java | 71 --- .../java/org/wiigee/logic/Classifier.java | 109 ----- .../main/java/org/wiigee/logic/Gesture.java | 156 ------ .../java/org/wiigee/logic/GestureModel.java | 206 -------- .../src/main/java/org/wiigee/logic/HMM.java | 315 ------------ .../java/org/wiigee/logic/PreciseHMM.java | 449 ------------------ .../java/org/wiigee/logic/ProcessingUnit.java | 72 --- .../main/java/org/wiigee/logic/Quantizer.java | 310 ------------ .../wiigee/logic/TriggeredProcessingUnit.java | 195 -------- .../src/main/java/org/wiigee/logic/XHMM.java | 85 ---- .../src/main/java/org/wiigee/util/FileIO.java | 234 --------- .../src/main/java/org/wiigee/util/Log.java | 43 -- 41 files changed, 12 insertions(+), 3979 deletions(-) delete mode 100644 java/wiigee/.classpath delete mode 100644 java/wiigee/.project delete mode 100644 java/wiigee/build.gradle delete mode 100644 java/wiigee/src/main/java/org/wiigee/control/Wiigee.java delete mode 100644 java/wiigee/src/main/java/org/wiigee/device/Device.java delete mode 100644 java/wiigee/src/main/java/org/wiigee/event/AccelerationEvent.java delete mode 100644 java/wiigee/src/main/java/org/wiigee/event/AccelerationListener.java delete mode 100644 java/wiigee/src/main/java/org/wiigee/event/ActionStartEvent.java delete mode 100644 java/wiigee/src/main/java/org/wiigee/event/ActionStopEvent.java delete mode 100644 java/wiigee/src/main/java/org/wiigee/event/ButtonListener.java delete mode 100644 java/wiigee/src/main/java/org/wiigee/event/ButtonPressedEvent.java delete mode 100644 java/wiigee/src/main/java/org/wiigee/event/ButtonReleasedEvent.java delete mode 100644 java/wiigee/src/main/java/org/wiigee/event/GestureEvent.java delete mode 100644 java/wiigee/src/main/java/org/wiigee/event/GestureListener.java delete mode 100644 java/wiigee/src/main/java/org/wiigee/event/InfraredEvent.java delete mode 100644 java/wiigee/src/main/java/org/wiigee/event/InfraredListener.java delete mode 100644 java/wiigee/src/main/java/org/wiigee/event/MotionStartEvent.java delete mode 100644 java/wiigee/src/main/java/org/wiigee/event/MotionStopEvent.java delete mode 100644 java/wiigee/src/main/java/org/wiigee/event/RotationEvent.java delete mode 100644 java/wiigee/src/main/java/org/wiigee/event/RotationListener.java delete mode 100644 java/wiigee/src/main/java/org/wiigee/event/RotationSpeedEvent.java delete mode 100644 java/wiigee/src/main/java/org/wiigee/filter/DirectionalEquivalenceFilter.java delete mode 100644 java/wiigee/src/main/java/org/wiigee/filter/Filter.java delete mode 100644 java/wiigee/src/main/java/org/wiigee/filter/HighPassFilter.java delete mode 100644 java/wiigee/src/main/java/org/wiigee/filter/IdleStateFilter.java delete mode 100644 java/wiigee/src/main/java/org/wiigee/filter/LowPassFilter.java delete mode 100644 java/wiigee/src/main/java/org/wiigee/filter/MotionDetectFilter.java delete mode 100644 java/wiigee/src/main/java/org/wiigee/filter/RotationThresholdFilter.java delete mode 100644 java/wiigee/src/main/java/org/wiigee/logic/Classifier.java delete mode 100644 java/wiigee/src/main/java/org/wiigee/logic/Gesture.java delete mode 100644 java/wiigee/src/main/java/org/wiigee/logic/GestureModel.java delete mode 100644 java/wiigee/src/main/java/org/wiigee/logic/HMM.java delete mode 100644 java/wiigee/src/main/java/org/wiigee/logic/PreciseHMM.java delete mode 100644 java/wiigee/src/main/java/org/wiigee/logic/ProcessingUnit.java delete mode 100644 java/wiigee/src/main/java/org/wiigee/logic/Quantizer.java delete mode 100644 java/wiigee/src/main/java/org/wiigee/logic/TriggeredProcessingUnit.java delete mode 100644 java/wiigee/src/main/java/org/wiigee/logic/XHMM.java delete mode 100644 java/wiigee/src/main/java/org/wiigee/util/FileIO.java delete mode 100644 java/wiigee/src/main/java/org/wiigee/util/Log.java diff --git a/java/mimis/build.gradle b/java/mimis/build.gradle index 761bf61..9f7a9bb 100644 --- a/java/mimis/build.gradle +++ b/java/mimis/build.gradle @@ -1,12 +1,21 @@ def mainClass = 'mimis.Main' +repositories { + maven { + //url 'C:/Users/Rik/Git/github/wiigee/.maven/' + url 'https://github.com/Boukefalos/wiigee/raw/mvn-repo/' + } + mavenCentral() +} + dependencies { compile project(':base') compile project(':itunescontroller') compile project(':wiiusej') - compile project(':wiigee') - //compile files('lib/jxinput.jar') + compile 'org.wiigee:wiigee:1.5.6' + + compile files('lib/jxinput.jar') compile fileTree(dir: 'libs', include: '*.jar') compile 'commons-collections:commons-collections:3.+' diff --git a/java/settings.gradle b/java/settings.gradle index 7d41c41..f17be55 100644 --- a/java/settings.gradle +++ b/java/settings.gradle @@ -1 +1 @@ -include "base", "mimis", "wiiusej", "wiigee", "itunescontroller", "sound" \ No newline at end of file +include 'base', 'mimis', 'wiiusej', 'itunescontroller', 'sound' \ No newline at end of file diff --git a/java/wiigee/.classpath b/java/wiigee/.classpath deleted file mode 100644 index 4589d57..0000000 --- a/java/wiigee/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/java/wiigee/.project b/java/wiigee/.project deleted file mode 100644 index 15e0368..0000000 --- a/java/wiigee/.project +++ /dev/null @@ -1,18 +0,0 @@ - - - java.wiigee - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.springsource.ide.eclipse.gradle.core.nature - org.eclipse.jdt.core.javanature - - diff --git a/java/wiigee/build.gradle b/java/wiigee/build.gradle deleted file mode 100644 index e69de29..0000000 diff --git a/java/wiigee/src/main/java/org/wiigee/control/Wiigee.java b/java/wiigee/src/main/java/org/wiigee/control/Wiigee.java deleted file mode 100644 index 41af532..0000000 --- a/java/wiigee/src/main/java/org/wiigee/control/Wiigee.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * wiigee - accelerometerbased gesture recognition - * Copyright (C) 2007, 2008, 2009 Benjamin Poppinga - * - * Developed at University of Oldenburg - * Contact: wiigee@benjaminpoppinga.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 org.wiigee.control; - -import org.wiigee.util.Log; - -/** - * The mother of all classes. :-) It's just used as parent class - * to print version information and later on maybe dynamic configuring - * of the whole wiimote system... detecting plugins and devices automatically - * maybe. :) - * - * @author Benjamin 'BePo' Poppinga - */ -public class Wiigee { - - protected static String version = "1.5.6"; - protected static String releasedate = "20090817"; - - protected Wiigee() { - Log.write("This is wiigee version "+version+" ("+releasedate+")"); - } - -} diff --git a/java/wiigee/src/main/java/org/wiigee/device/Device.java b/java/wiigee/src/main/java/org/wiigee/device/Device.java deleted file mode 100644 index 1559d8b..0000000 --- a/java/wiigee/src/main/java/org/wiigee/device/Device.java +++ /dev/null @@ -1,245 +0,0 @@ -/* - * wiigee - accelerometerbased gesture recognition - * Copyright (C) 2007, 2008, 2009 Benjamin Poppinga - * - * Developed at University of Oldenburg - * Contact: wiigee@benjaminpoppinga.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 org.wiigee.device; - -import java.io.IOException; -import java.util.Vector; - -import org.wiigee.event.AccelerationEvent; -import org.wiigee.event.AccelerationListener; -import org.wiigee.event.ButtonListener; -import org.wiigee.event.ButtonPressedEvent; -import org.wiigee.event.ButtonReleasedEvent; -import org.wiigee.event.GestureListener; -import org.wiigee.event.MotionStartEvent; -import org.wiigee.event.MotionStopEvent; -import org.wiigee.filter.DirectionalEquivalenceFilter; -import org.wiigee.filter.Filter; -import org.wiigee.filter.IdleStateFilter; -import org.wiigee.filter.MotionDetectFilter; -import org.wiigee.logic.ProcessingUnit; -import org.wiigee.logic.TriggeredProcessingUnit; - -/** - * Abstract representation of a device with very basic functionalities. This - * class should be derived from, if anybody plans to add a new class of devices, - * like Wiimote or AndroidDevice does. This class mainly consist of filter - * management, recognition control and core event control. - * - * @author Benjamin 'BePo' Poppinga - */ -public class Device { - - // Fixed number values. - public static final int MOTION = 0; - - // Buttons for action coordination - protected int recognitionbutton; - protected int trainbutton; - protected int closegesturebutton; - - // Functional - protected boolean accelerationEnabled; - - // Filters, can filter the data stream - protected Vector accfilters = new Vector(); - - // Listeners, receive generated events - protected Vector accelerationlistener = new Vector(); - protected Vector buttonlistener = new Vector(); - - // Processing unit to analyze the data - protected ProcessingUnit processingunit = new TriggeredProcessingUnit(); - - public Device(boolean autofiltering) { - if (autofiltering) { - this.addAccelerationFilter(new IdleStateFilter()); - this.addAccelerationFilter(new MotionDetectFilter(this)); - this.addAccelerationFilter(new DirectionalEquivalenceFilter()); - } - this.addAccelerationListener(this.processingunit); - this.addButtonListener(this.processingunit); - } - - /** - * Adds a Filter for processing the acceleration values. - * @param filter The Filter instance. - */ - public void addAccelerationFilter(Filter filter) { - this.accfilters.add(filter); - } - - /** - * Resets all the accfilters, which are resetable. - * Sometimes they have to be resettet if a new gesture starts. - */ - public void resetAccelerationFilters() { - for (int i = 0; i < this.accfilters.size(); i++) { - this.accfilters.elementAt(i).reset(); - } - } - - /** - * Adds an AccelerationListener to the Device. Everytime an acceleration - * on the Device is performed the AccelerationListener would receive - * an event of this action. - * - * @param listener The Listener. - */ - public void addAccelerationListener(AccelerationListener listener) { - this.accelerationlistener.add(listener); - } - - /** - * Adds a ButtonListener to the Device. Everytime a WorkerButton has been - * pressed or released, the Listener would be notified about this via - * the corresponding Events. - * - * @param listener The Listener. - */ - public void addButtonListener(ButtonListener listener) { - this.buttonlistener.add(listener); - } - - /** - * Adds a GestureListener to the Device. Everytime a gesture - * is performed the GestureListener would receive an event of - * this gesture. - * - * @param listener The Listener. - */ - public void addGestureListener(GestureListener listener) { - this.processingunit.addGestureListener(listener); - } - - public int getRecognitionButton() { - return this.recognitionbutton; - } - - public void setRecognitionButton(int b) { - this.recognitionbutton = b; - } - - public int getTrainButton() { - return this.trainbutton; - } - - public void setTrainButton(int b) { - this.trainbutton = b; - } - - public int getCloseGestureButton() { - return this.closegesturebutton; - } - - public void setCloseGestureButton(int b) { - this.closegesturebutton = b; - } - - public ProcessingUnit getProcessingUnit() { - return this.processingunit; - } - - public void setAccelerationEnabled(boolean enabled) throws IOException { - this.accelerationEnabled = enabled; - } - - public void loadGesture(String filename) { - this.processingunit.loadGesture(filename); - } - - public void saveGesture(int id, String filename) { - this.processingunit.saveGesture(id, filename); - } - - // ###### Event-Methods - /** Fires an acceleration event. - * @param vector Consists of three values: - * acceleration on X, Y and Z axis. - */ - public void fireAccelerationEvent(double[] vector) { - for (int i = 0; i < this.accfilters.size(); i++) { - vector = this.accfilters.get(i).filter(vector); - // cannot return here if null, because of time-dependent accfilters - } - - // don't need to create an event if filtered away - if (vector != null) { - // calculate the absolute value for the accelerationevent - double absvalue = Math.sqrt((vector[0] * vector[0]) + - (vector[1] * vector[1]) + (vector[2] * vector[2])); - - AccelerationEvent w = new AccelerationEvent(this, - vector[0], vector[1], vector[2], absvalue); - for (int i = 0; i < this.accelerationlistener.size(); i++) { - this.accelerationlistener.get(i).accelerationReceived(w); - } - } - - } // fireaccelerationevent - - /** Fires a button pressed event. - * @param button - * Integer value of the pressed button. - */ - public void fireButtonPressedEvent(int button) { - ButtonPressedEvent w = new ButtonPressedEvent(this, button); - for (int i = 0; i < this.buttonlistener.size(); i++) { - this.buttonlistener.get(i).buttonPressReceived(w); - } - - if (w.isRecognitionInitEvent() || w.isTrainInitEvent()) { - this.resetAccelerationFilters(); - } - } - - /** Fires a button released event. - */ - public void fireButtonReleasedEvent(int button) { - ButtonReleasedEvent w = new ButtonReleasedEvent(this, button); - for (int i = 0; i < this.buttonlistener.size(); i++) { - this.buttonlistener.get(i).buttonReleaseReceived(w); - } - } - - /** - * Fires a motion start event. - */ - public void fireMotionStartEvent() { - MotionStartEvent w = new MotionStartEvent(this); - for (int i = 0; i < this.accelerationlistener.size(); i++) { - this.accelerationlistener.get(i).motionStartReceived(w); - } - } - - /** - * Fires a motion stop event. - */ - public void fireMotionStopEvent() { - MotionStopEvent w = new MotionStopEvent(this); - for (int i = 0; i < this.accelerationlistener.size(); i++) { - this.accelerationlistener.get(i).motionStopReceived(w); - } - } -} diff --git a/java/wiigee/src/main/java/org/wiigee/event/AccelerationEvent.java b/java/wiigee/src/main/java/org/wiigee/event/AccelerationEvent.java deleted file mode 100644 index ea7edb4..0000000 --- a/java/wiigee/src/main/java/org/wiigee/event/AccelerationEvent.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * wiigee - accelerometerbased gesture recognition - * Copyright (C) 2007, 2008, 2009 Benjamin Poppinga - * - * Developed at University of Oldenburg - * Contact: wiigee@benjaminpoppinga.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 org.wiigee.event; - -import java.util.EventObject; - -import org.wiigee.device.Device; - -/** - * This Event would be generated if an acceleration has been detected. - * It contains information about the force applied to the device in each - * direction (x, y, z). Further it contains the absolute value of this - * vector and the source which generated this event (Device). - * - * @author Benjamin 'BePo' Poppinga - * - */ -public class AccelerationEvent extends EventObject { - - double X, Y, Z; - double absvalue; - - /** - * Create an AccelerationEvent with a specific source, - * all the three acceleration values and the calculated absolute - * value. - * - * @param source The source which has been accelerated (Wiimote). - * @param X The value of acceleration in the x direction. - * @param Y The value of acceleration in the y direction. - * @param Z The value of acceleration in the z direction. - * @param absvalue The absolute value of this acceleration vector. - */ - public AccelerationEvent(Device source, double X, double Y, double Z, double absvalue) { - super(source); - this.X=X; - this.Y=Y; - this.Z=Z; - this.absvalue=absvalue; - } - - public double getX() { - return X; - } - - public double getY() { - return Y; - } - - public double getZ() { - return Z; - } - - public double getAbsValue() { - return absvalue; - } -} diff --git a/java/wiigee/src/main/java/org/wiigee/event/AccelerationListener.java b/java/wiigee/src/main/java/org/wiigee/event/AccelerationListener.java deleted file mode 100644 index e70707a..0000000 --- a/java/wiigee/src/main/java/org/wiigee/event/AccelerationListener.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * wiigee - accelerometerbased gesture recognition - * Copyright (C) 2007, 2008, 2009 Benjamin Poppinga - * - * Developed at University of Oldenburg - * Contact: wiigee@benjaminpoppinga.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 org.wiigee.event; - -import java.util.EventListener; - -/** - * This interface has to be implemented if the application should react - * to pure acceleration data. This could be useful if you want to e.g. - * graphically display the acceleration data in your application. - * - * @author Benjamin 'BePo' Poppinga - */ -public interface AccelerationListener extends EventListener { - - /** - * This method would be called if a Device source has been accelerated. - * - * @param event The acceleration representation as an event. - */ - public abstract void accelerationReceived(AccelerationEvent event); - - /** - * This method would be called if a Device is in idle state and then a - * motion starts or if a Device is in motion and then the motion stops and - * the Device is in idle state. - * - * @param event This is the event which contains if the Wiimote is now - * in motion or not. - */ - public abstract void motionStartReceived(MotionStartEvent event); - - /** - * This method would be called if a Device is in motion and then the motion - * stops and the Device is in idle state. - * - * @param event This is the event which contains if the Device is now - * in motion or not. - */ - public abstract void motionStopReceived(MotionStopEvent event); - - -} diff --git a/java/wiigee/src/main/java/org/wiigee/event/ActionStartEvent.java b/java/wiigee/src/main/java/org/wiigee/event/ActionStartEvent.java deleted file mode 100644 index 9cdfab8..0000000 --- a/java/wiigee/src/main/java/org/wiigee/event/ActionStartEvent.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * wiigee - accelerometerbased gesture recognition - * Copyright (C) 2007, 2008, 2009 Benjamin Poppinga - * - * Developed at University of Oldenburg - * Contact: wiigee@benjaminpoppinga.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 org.wiigee.event; - -import java.util.EventObject; - -import org.wiigee.device.Device; - -/** - * An ActionStartEvent is an Event where other different events can - * be derived from, if they can be considered as an event actually starting - * a process like e.g. Training, Recognition, ... - * - * @author Benjamin 'BePo' Poppinga - */ -public class ActionStartEvent extends EventObject { - - protected boolean trainbutton; - protected boolean recognitionbutton; - protected boolean closegesturebutton; - - public ActionStartEvent(Device source) { - super(source); - } - - /** - * Is true if this button press has been done by the - * individual defined RecognitionButton which has to be - * set during initialization of a Wiimote. - * - * @return Is this button press initiated by the recognition button. - * @see device.Wiimote#setRecognitionButton(int) setRecognitionButton() - */ - public boolean isRecognitionInitEvent() { - return this.recognitionbutton; - } - - /** - * Is true if this button press has been done by the - * individual defined TrainButton which has to be - * set during initialization of a Wiimote. - * - * @return Is this button pres initiated by the training button. - * @see device.Wiimote#setTrainButton(int) setTrainButton() - */ - public boolean isTrainInitEvent() { - return this.trainbutton; - } - - /** - * Is true if this button press has been done by the - * individual defined CloseGestureButton which has to be - * set during initialization of a Wiimote. - * - * @return Is this button press initiated by the close gesture button. - * @see device.Wiimote#setCloseGestureButton(int) setCloseGestureButton() - */ - public boolean isCloseGestureInitEvent() { - return this.closegesturebutton; - } - -} diff --git a/java/wiigee/src/main/java/org/wiigee/event/ActionStopEvent.java b/java/wiigee/src/main/java/org/wiigee/event/ActionStopEvent.java deleted file mode 100644 index cfa7077..0000000 --- a/java/wiigee/src/main/java/org/wiigee/event/ActionStopEvent.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * wiigee - accelerometerbased gesture recognition - * Copyright (C) 2007, 2008, 2009 Benjamin Poppinga - * - * Developed at University of Oldenburg - * Contact: wiigee@benjaminpoppinga.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 org.wiigee.event; - -import java.util.EventObject; - -import org.wiigee.device.Device; - -/** - * An ActionStopEvent is an Event where other different events can - * be derived from, if they can be considered as an event actually stopping - * a process like e.g. Training, Recognition, ... - * - * @author Benjamin 'BePo' Poppinga - */ -public class ActionStopEvent extends EventObject { - - public ActionStopEvent(Device source) { - super(source); - } - -} diff --git a/java/wiigee/src/main/java/org/wiigee/event/ButtonListener.java b/java/wiigee/src/main/java/org/wiigee/event/ButtonListener.java deleted file mode 100644 index 296c6ae..0000000 --- a/java/wiigee/src/main/java/org/wiigee/event/ButtonListener.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * wiigee - accelerometerbased gesture recognition - * Copyright (C) 2007, 2008, 2009 Benjamin Poppinga - * - * Developed at University of Oldenburg - * Contact: wiigee@benjaminpoppinga.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 org.wiigee.event; - -import java.util.EventListener; - -/** - * This interface has to be implemented if the application should react - * to button press/releases. - * - * @author Benjamin 'BePo' Poppinga - */ -public interface ButtonListener extends EventListener { - - - /** - * This method would be called if a Device button has been pressed. - * - * @param event The button representation as an event. - */ - public abstract void buttonPressReceived(ButtonPressedEvent event); - - /** - * This method would be called if a Device button has been released. - * - * @param event This is actually a meta-event NOT containing which button - * has been released. - */ - public abstract void buttonReleaseReceived(ButtonReleasedEvent event); - - -} diff --git a/java/wiigee/src/main/java/org/wiigee/event/ButtonPressedEvent.java b/java/wiigee/src/main/java/org/wiigee/event/ButtonPressedEvent.java deleted file mode 100644 index 818ae1f..0000000 --- a/java/wiigee/src/main/java/org/wiigee/event/ButtonPressedEvent.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * wiigee - accelerometerbased gesture recognition - * Copyright (C) 2007, 2008, 2009 Benjamin Poppinga - * - * Developed at University of Oldenburg - * Contact: wiigee@benjaminpoppinga.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 org.wiigee.event; - -import org.wiigee.device.Device; - -/** - * - * This Event would be generated if a button on a wiimote has been - * pressed by user. It contains the source (wiimote) and an integer - * representation of which button has been pressed. Please note that - * there exist enumeration constants in the class, so you don't - * have to use this integer values directly. - * - * @author Benjamin 'BePo' Poppinga - */ -public class ButtonPressedEvent extends ActionStartEvent { - - // Fixed number values. - public static final int BUTTON_2 = 1; - public static final int BUTTON_1 = 2; - public static final int BUTTON_B = 3; - public static final int BUTTON_A = 4; - public static final int BUTTON_MINUS = 5; - public static final int BUTTON_HOME = 8; - public static final int BUTTON_LEFT = 9; - public static final int BUTTON_RIGHT = 10; - public static final int BUTTON_DOWN = 11; - public static final int BUTTON_UP = 12; - public static final int BUTTON_PLUS = 13; - - int button; - - /** - * Create a WiimoteButtonPressedEvent with the Wiimote source whose - * WorkerButton has been pressed and the integer representation of the button. - * - * @param source - * @param button - */ - public ButtonPressedEvent(Device source, int button) { - super(source); - this.button=button; - - if(source.getRecognitionButton()==button) { - this.recognitionbutton=true; - } else if(source.getTrainButton()==button) { - this.trainbutton=true; - } else if(source.getCloseGestureButton()==button) { - this.closegesturebutton=true; - } - } - - public int getButton() { - return this.button; - } - -} diff --git a/java/wiigee/src/main/java/org/wiigee/event/ButtonReleasedEvent.java b/java/wiigee/src/main/java/org/wiigee/event/ButtonReleasedEvent.java deleted file mode 100644 index cbe1eb0..0000000 --- a/java/wiigee/src/main/java/org/wiigee/event/ButtonReleasedEvent.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * wiigee - accelerometerbased gesture recognition - * Copyright (C) 2007, 2008, 2009 Benjamin Poppinga - * - * Developed at University of Oldenburg - * Contact: wiigee@benjaminpoppinga.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 org.wiigee.event; - -import org.wiigee.device.Device; - -/** - * - * This event would be generated if a button was released. - * contains: source (wiimote). - * - * @author Benjamin 'BePo' Poppinga - */ -public class ButtonReleasedEvent extends ActionStopEvent { - int button; - - public ButtonReleasedEvent(Device source, int button) { - super(source); - this.button = button; - } - - public int getButton() { - return this.button; - } - -} diff --git a/java/wiigee/src/main/java/org/wiigee/event/GestureEvent.java b/java/wiigee/src/main/java/org/wiigee/event/GestureEvent.java deleted file mode 100644 index e3465a7..0000000 --- a/java/wiigee/src/main/java/org/wiigee/event/GestureEvent.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * wiigee - accelerometerbased gesture recognition - * Copyright (C) 2007, 2008, 2009 Benjamin Poppinga - * - * Developed at University of Oldenburg - * Contact: wiigee@benjaminpoppinga.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 org.wiigee.event; - -import org.wiigee.logic.ProcessingUnit; - -/** - * This event would be generated if a gesture has been detected. - * It contains information about the gesture "name" or type, - * the accelerationstreamanalyzer which generated the event (source) - * and the probability calculated from the bayes classifier. - * - * @author Benjamin 'BePo' Poppinga - */ -public class GestureEvent { - - int id; - boolean valid; - double probability; - ProcessingUnit analyzer; - - /** Create a GestureEvent - * - * @param source The Source, which detected the gesture. - * @param id A gesture ID for identifying a gesture. - * @param probability The Bayes-Classifier calculated probability. - */ - public GestureEvent(ProcessingUnit source, boolean valid, int id, double probability) { - this.analyzer = source; - this.valid = valid; - this.id = id; - this.probability = probability; - } - - public int getId() { - return this.id; - } - - public boolean isValid() { - return this.valid; - } - - public double getProbability() { - return this.probability; - } - - public ProcessingUnit getSource() { - return this.analyzer; - } -} diff --git a/java/wiigee/src/main/java/org/wiigee/event/GestureListener.java b/java/wiigee/src/main/java/org/wiigee/event/GestureListener.java deleted file mode 100644 index f076ed9..0000000 --- a/java/wiigee/src/main/java/org/wiigee/event/GestureListener.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * wiigee - accelerometerbased gesture recognition - * Copyright (C) 2007, 2008, 2009 Benjamin Poppinga - * - * Developed at University of Oldenburg - * Contact: wiigee@benjaminpoppinga.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 org.wiigee.event; - -import java.util.EventListener; - -/** - * - * This is the GestureListener interface which has to be implemented - * by any application which should receive recognized gestures. - * - * @author Benjamin 'BePo' Poppinga - * - */ -public interface GestureListener extends EventListener { - - /** - * This method would be called if a gesture has been recognized. - * - * @param event The GestureEvent containing information about - * the recognized gesture. - */ - public abstract void gestureReceived(GestureEvent event); - -} diff --git a/java/wiigee/src/main/java/org/wiigee/event/InfraredEvent.java b/java/wiigee/src/main/java/org/wiigee/event/InfraredEvent.java deleted file mode 100644 index 50d449e..0000000 --- a/java/wiigee/src/main/java/org/wiigee/event/InfraredEvent.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * wiigee - accelerometerbased gesture recognition - * Copyright (C) 2007, 2008, 2009 Benjamin Poppinga - * - * Developed at University of Oldenburg - * Contact: wiigee@benjaminpoppinga.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 org.wiigee.event; - -import java.util.EventObject; - -import org.wiigee.device.Device; - -/** - * An infrared event consists of a set of coordinates, containing values - * from [0, 1024] in width to [0, 768] in height. for each point there is - * a given size and if the detected infrared spot is valid. - * - * @author Benjamin 'BePo' Poppinga - */ -public class InfraredEvent extends EventObject { - - protected int[][] coordinates; - protected int[] size; - protected boolean[] valid; - - public InfraredEvent(Device source, int[][] coordinates, int[] size) { - super(source); - this.coordinates=coordinates; - this.size=size; - this.valid = new boolean[4]; - for(int i=0; ireference[0]+this.sensivity || - vector[1]reference[1]+this.sensivity || - vector[2]reference[2]+this.sensivity) { - this.reference=vector; - return vector; - } else { - return null; - } - } - - public void setSensivity(double sensivity) { - this.sensivity=sensivity; - } - - public double getSensivity() { - return this.sensivity; - } - -} diff --git a/java/wiigee/src/main/java/org/wiigee/filter/Filter.java b/java/wiigee/src/main/java/org/wiigee/filter/Filter.java deleted file mode 100644 index e97d4a9..0000000 --- a/java/wiigee/src/main/java/org/wiigee/filter/Filter.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * wiigee - accelerometerbased gesture recognition - * Copyright (C) 2007, 2008, 2009 Benjamin Poppinga - * - * Developed at University of Oldenburg - * Contact: wiigee@benjaminpoppinga.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 org.wiigee.filter; - -/** - * Abstract class to give a definition for a general filter. - * - * @author Benjamin 'BePo' Poppinga - */ -public abstract class Filter { - - /*** - * The actual called method to filter anything. It checks if the vector is - * already set to NULL by another filter and won't process it anymore. If it's - * not NULL it would be forwarded to the actual implemented method - filterAlgorithm(). - * @param vector The acceleration vector, encoding: 0/x, 1/y, 2/z - * @return a new, filtered acceleration vector, encoded the same way - */ - public double[] filter(double[] vector) { - if(vector==null) { - return null; - } else { - return filterAlgorithm(vector); - } - } - - /*** - * A filter receives a triple of acceleration values within the variable 'vector'. - * It's encoded as vector[0]=x, vector[1]=y, vector[2]=z. This is not an object since the - * processing of the filter should be really fast, since every acceleration of the wiimote - * passes the filter. - * @param vector - * @param absvalue - * @return - */ - abstract public double[] filterAlgorithm(double[] vector); - - abstract public void reset(); - -} diff --git a/java/wiigee/src/main/java/org/wiigee/filter/HighPassFilter.java b/java/wiigee/src/main/java/org/wiigee/filter/HighPassFilter.java deleted file mode 100644 index 54a6946..0000000 --- a/java/wiigee/src/main/java/org/wiigee/filter/HighPassFilter.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * wiigee - accelerometerbased gesture recognition - * Copyright (C) 2007, 2008, 2009 Benjamin Poppinga - * - * Developed at University of Oldenburg - * Contact: wiigee@benjaminpoppinga.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 org.wiigee.filter; - -/** - * - * This filter removes every acceleration that happens slowly or - * steadily (like e.g. gravity). Remember: It _passes_ acceleration - * with a big variety. - * - * @author Benjamin 'BePo' Poppinga - */ -public class HighPassFilter extends Filter { - - private double factor; - private double[] prevAcc; - - public HighPassFilter() { - super(); - this.factor = 0.1; - this.reset(); - } - - public HighPassFilter(double factor) { - super(); - this.factor = factor; - this.reset(); - } - - @Override - public void reset() { - this.prevAcc = new double[] {0.0, 0.0, 0.0}; - } - - @Override - public double[] filterAlgorithm(double[] vector) { - double[] retVal = new double[3]; - prevAcc[0] = vector[0] * this.factor + this.prevAcc[0] * (1.0 - this.factor); - prevAcc[1] = vector[1] * this.factor + this.prevAcc[1] * (1.0 - this.factor); - prevAcc[2] = vector[2] * this.factor + this.prevAcc[2] * (1.0 - this.factor); - - retVal[0] = vector[0] - prevAcc[0]; - retVal[1] = vector[1] - prevAcc[1]; - retVal[2] = vector[2] - prevAcc[2]; - - return retVal; - } - -} diff --git a/java/wiigee/src/main/java/org/wiigee/filter/IdleStateFilter.java b/java/wiigee/src/main/java/org/wiigee/filter/IdleStateFilter.java deleted file mode 100644 index b816e0b..0000000 --- a/java/wiigee/src/main/java/org/wiigee/filter/IdleStateFilter.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * wiigee - accelerometerbased gesture recognition - * Copyright (C) 2007, 2008, 2009 Benjamin Poppinga - * - * Developed at University of Oldenburg - * Contact: wiigee@benjaminpoppinga.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 org.wiigee.filter; - -/** - * Filters if the wiimote is not moved in any way. Be careful in using - * this filter together with a HighPassFilter. - * - * @author Benjamin 'BePo' Poppinga - */ -public class IdleStateFilter extends Filter { - - private double sensivity; - - /** - * Since an acceleration sensor usually provides information even - * if it doesn't move, this filter removes the data if it's in the - * idle state. - */ - public IdleStateFilter() { - super(); - this.sensivity = 0.1; - } - - @Override - public void reset() { - // not needed - } - - @Override - public double[] filterAlgorithm(double[] vector) { - // calculate values needed for filtering: - // absolute value - double absvalue = Math.sqrt((vector[0]*vector[0])+ - (vector[1]*vector[1])+(vector[2]*vector[2])); - - // filter formulaes and return values - if(absvalue > 1+this.sensivity || - absvalue < 1-this.sensivity) { - return vector; - } else { - return null; - } - } - - /** - * Defines the absolute value when the wiimote should react to acceleration. - * This is a parameter for the first of the two filters: idle state - * filter. For example: sensivity=0.2 makes the wiimote react to acceleration - * where the absolute value is equal or greater than 1.2g. The default value 0.1 - * should work well. Only change if you are sure what you're doing. - * - * @param sensivity - * acceleration data values smaller than this value wouldn't be detected. - */ - public void setSensivity(double sensivity) { - this.sensivity = sensivity; - } - - public double getSensivity() { - return this.sensivity; - } - -} diff --git a/java/wiigee/src/main/java/org/wiigee/filter/LowPassFilter.java b/java/wiigee/src/main/java/org/wiigee/filter/LowPassFilter.java deleted file mode 100644 index 2c3e012..0000000 --- a/java/wiigee/src/main/java/org/wiigee/filter/LowPassFilter.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * wiigee - accelerometerbased gesture recognition - * Copyright (C) 2007, 2008, 2009 Benjamin Poppinga - * - * Developed at University of Oldenburg - * Contact: wiigee@benjaminpoppinga.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 org.wiigee.filter; - -/** - * - * This filter removes every acceleration that happens fast or - * suddenly (like e.g. a short hit). Remember: It _passes_ acceleration - * with a slight variety. - * - * @author Benjamin 'BePo' Poppinga - */ -public class LowPassFilter extends Filter { - - private double factor; - private double[] prevAcc; - - public LowPassFilter() { - super(); - this.factor = 0.01; - this.reset(); - } - - public LowPassFilter(double factor) { - super(); - this.factor = factor; - this.reset(); - } - - @Override - public void reset() { - this.prevAcc = new double[] {0.0, 0.0, 0.0}; - } - - @Override - public double[] filterAlgorithm(double[] vector) { - double[] retVal = new double[3]; - retVal[0] = vector[0] * this.factor + this.prevAcc[0] * (1.0 - this.factor); - retVal[1] = vector[1] * this.factor + this.prevAcc[1] * (1.0 - this.factor); - retVal[2] = vector[2] * this.factor + this.prevAcc[2] * (1.0 - this.factor); - this.prevAcc = retVal; - return retVal; - } - -} diff --git a/java/wiigee/src/main/java/org/wiigee/filter/MotionDetectFilter.java b/java/wiigee/src/main/java/org/wiigee/filter/MotionDetectFilter.java deleted file mode 100644 index b13124a..0000000 --- a/java/wiigee/src/main/java/org/wiigee/filter/MotionDetectFilter.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * wiigee - accelerometerbased gesture recognition - * Copyright (C) 2007, 2008, 2009 Benjamin Poppinga - * - * Developed at University of Oldenburg - * Contact: wiigee@benjaminpoppinga.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 org.wiigee.filter; - -import org.wiigee.device.Device; - -/** - * This filter uses time to determine if the wiimote actually is in motion - * or not. This filter only works together with the IdleStateFilter. - * - * @author Benjamin 'BePo' Poppinga - */ -public class MotionDetectFilter extends Filter { - - private int motionchangetime; - private boolean nowinmotion; - private long motionstartstamp; - private Device device; - - /*** - * Detects wheather the wiimote receives acceleration or not and - * raises an event, if the device starts or stops. This is actual a - * null filter, not manipulating anything. But looks pretty good in - * this datatype since it could be removed easily. - * - * @param wiimote The Wiimote object which is controlled by the filter. - */ - public MotionDetectFilter(Device device) { - super(); - this.device=device; - this.reset(); - } - - public void reset() { - this.motionstartstamp=System.currentTimeMillis(); - this.nowinmotion=false; - this.motionchangetime=190; - } - - @Override - public double[] filter(double[] vector) { - - if(this.nowinmotion && - (System.currentTimeMillis()-this.motionstartstamp)>= - this.motionchangetime) { - this.nowinmotion=false; - this.device.fireMotionStopEvent(); - } // fi - - return filterAlgorithm(vector); - } - - public double[] filterAlgorithm(double[] vector) { - if(vector!=null) { - this.motionstartstamp=System.currentTimeMillis(); - if(!this.nowinmotion) { - this.nowinmotion=true; - this.motionstartstamp=System.currentTimeMillis(); - this.device.fireMotionStartEvent(); - } - } - - return vector; - } - - /** - * Defines the time the wiimote has to be in idle state before a new motion change - * event appears. The default value 500ms should work well, only change it if you are sure - * about what you're doing. - * @param time Time in ms - */ - public void setMotionChangeTime(int time) { - this.motionchangetime=time; - } - - public int getMotionChangeTime() { - return this.motionchangetime; - } - -} diff --git a/java/wiigee/src/main/java/org/wiigee/filter/RotationThresholdFilter.java b/java/wiigee/src/main/java/org/wiigee/filter/RotationThresholdFilter.java deleted file mode 100644 index 972ff58..0000000 --- a/java/wiigee/src/main/java/org/wiigee/filter/RotationThresholdFilter.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * wiigee - accelerometerbased gesture recognition - * Copyright (C) 2007, 2008, 2009 Benjamin Poppinga - * - * Developed at University of Oldenburg - * Contact: wiigee@benjaminpoppinga.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 org.wiigee.filter; - -/** - * Removes rotation events which are for all axis - * under a defined threshold value (which default is 2.0 degrees - * per second TBD). - * - * @author Benjamin 'BePo' Poppinga - */ -public class RotationThresholdFilter extends Filter { - - private double threshold; - - public RotationThresholdFilter() { - super(); - this.threshold = 2.0; - } - - public RotationThresholdFilter(double threshold) { - super(); - this.threshold = threshold; - } - - @Override - public void reset() { - // nothing to reset here - } - - public double[] filterAlgorithm(double[] vector) { - if(Math.abs(vector[0])>threshold || - Math.abs(vector[1])>threshold || - Math.abs(vector[2])>threshold) { - return vector; - } else { - return new double[] { 0.0, 0.0, 0.0 }; - } - } - - public void setSensivity(double sensivity) { - this.threshold=sensivity; - } - - public double getSensivity() { - return this.threshold; - } - -} diff --git a/java/wiigee/src/main/java/org/wiigee/logic/Classifier.java b/java/wiigee/src/main/java/org/wiigee/logic/Classifier.java deleted file mode 100644 index a8f1b5a..0000000 --- a/java/wiigee/src/main/java/org/wiigee/logic/Classifier.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * wiigee - accelerometerbased gesture recognition - * Copyright (C) 2007, 2008, 2009 Benjamin Poppinga - * - * Developed at University of Oldenburg - * Contact: wiigee@benjaminpoppinga.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 org.wiigee.logic; - -import java.util.Vector; - -public class Classifier { - - private Vector gesturemodel; // each gesturetype got its own - // gesturemodel in this vector - private double lastprob; - - public Classifier() { - this.gesturemodel=new Vector(); - this.lastprob=0.0; - } - - /** - * This method recognize a specific gesture, given to the procedure. - * For classification a bayes classification algorithm is used. - * - * @param g gesture to classify - */ - public int classifyGesture(Gesture g) { - //Log.write("Recognizing gesture..."); - - // Wert im Nenner berechnen, nach Bayes - double sum = 0; - for(int i=0; irecogprob) { - probgesture=tmpgesture; - probmodel=tmpmodel; - recogprob=((tmpmodel*tmpgesture)/sum); - recognized=i; - } - } - - // a gesture could be recognized - if(recogprob>0 && probmodel>0 && probgesture>0 && sum>0) { - this.lastprob=recogprob; - return recognized; - } else { - // no gesture could be recognized - return -1; - } - - } - - public double getLastProbability() { - return this.lastprob; - } - - public void addGestureModel(GestureModel gm) { - this.gesturemodel.add(gm); - } - - public GestureModel getGestureModel(int id) { - return this.gesturemodel.elementAt(id); - } - - public Vector getGestureModels() { - return this.gesturemodel; - } - - public int getCountOfGestures() { - return this.gesturemodel.size(); - } - - public void clear() { - this.gesturemodel = new Vector(); - } - - -} diff --git a/java/wiigee/src/main/java/org/wiigee/logic/Gesture.java b/java/wiigee/src/main/java/org/wiigee/logic/Gesture.java deleted file mode 100644 index a381fcf..0000000 --- a/java/wiigee/src/main/java/org/wiigee/logic/Gesture.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * wiigee - accelerometerbased gesture recognition - * Copyright (C) 2007, 2008, 2009 Benjamin Poppinga - * - * Developed at University of Oldenburg - * Contact: wiigee@benjaminpoppinga.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 org.wiigee.logic; - -import java.util.Vector; - -import org.wiigee.event.AccelerationEvent; - -/** - * This class represents ONE movement trajectory in a - * concrete instance. - * - * @author Benjamin 'BePo' Poppinga - */ - -public class Gesture implements Cloneable { - - /** Min/MaxAcceleration setup manually? */ - private boolean minmaxmanual; - private double minacc; - private double maxacc; - - /** The complete trajectory as WiimoteAccelerationEvents - * as a vector. It's a vector because we don't want to - * loose the chronology of the stored events. - */ - private Vector data; - - /** - * Create an empty Gesture. - */ - public Gesture() { - this.data = new Vector(); - } - - /** - * Make a deep copy of another Gesture object. - * - * @param original Another Gesture object - */ - public Gesture(Gesture original) { - this.data = new Vector(); - Vector origin = original.getData(); - for (int i = 0; i < origin.size(); i++) { - this.add((AccelerationEvent) origin.get(i)); - } - } - - - /** - * Adds a new acceleration event to this gesture. - * - * @param event The WiimoteAccelerationEvent to add. - */ - public void add(AccelerationEvent event) { - this.data.add(event); - } - - /** - * Returns the last acceleration added to this gesture. - * - * @return the last acceleration event added. - */ - public AccelerationEvent getLastData() { - return (AccelerationEvent) this.data.get(this.data.size() - 1); - } - - /** - * Returns the whole chronological sequence of accelerations as - * a vector. - * - * @return chronological sequence of accelerations. - */ - public Vector getData() { - return this.data; - } - - /** - * Removes the first element of the acceleration queue of a gesture - */ - public void removeFirstData() { - this.data.remove(0); - } - - public int getCountOfData() { - return this.data.size(); - } - - public void setMaxAndMinAcceleration(double max, double min) { - this.maxacc = max; - this.minacc = min; - this.minmaxmanual = true; - } - - public double getMaxAcceleration() { - if(!this.minmaxmanual) { - double maxacc = Double.MIN_VALUE; - for(int i=0; i maxacc) { - maxacc=Math.abs(this.data.get(i).getX()); - } - if(Math.abs(this.data.get(i).getY()) > maxacc) { - maxacc=Math.abs(this.data.get(i).getY()); - } - if(Math.abs(this.data.get(i).getZ()) > maxacc) { - maxacc=Math.abs(this.data.get(i).getZ()); - } - } - return maxacc; - } else { - return this.maxacc; - } - } - - public double getMinAcceleration() { - if(!this.minmaxmanual) { - double minacc = Double.MAX_VALUE; - for(int i=0; i