Getracht de acceleratie normalisatie van wiigee te benaderen. Dit lukt redelijk, maar niet goed genoeg om zonder de filters te hoeven tunen direct goede herkenning te krijgen.
This commit is contained in:
@@ -17,6 +17,8 @@ import pm.macro.event.Press;
|
||||
import pm.macro.event.Release;
|
||||
|
||||
import wiiusej.Wiimote;
|
||||
import wiiusej.values.Acceleration;
|
||||
import wiiusej.values.Calibration;
|
||||
import wiiusej.values.RawAcceleration;
|
||||
import wiiusej.wiiusejevents.physicalevents.MotionSensingEvent;
|
||||
import wiiusej.wiiusejevents.physicalevents.WiimoteButtonsEvent;
|
||||
@@ -27,8 +29,8 @@ public class WiimoteDevice extends Device implements GestureListener {
|
||||
protected static WiimoteService wiimoteService;
|
||||
|
||||
protected Wiimote wiimote;
|
||||
protected Calibration calibration;
|
||||
protected GestureDevice gestureDevice;
|
||||
|
||||
protected int gestureId = 0;
|
||||
|
||||
static {
|
||||
@@ -109,13 +111,13 @@ public class WiimoteDevice extends Device implements GestureListener {
|
||||
}
|
||||
|
||||
public void onMotionSensingEvent(MotionSensingEvent event) {
|
||||
if (calibration == null) {
|
||||
calibration = wiimote.getCalibration();
|
||||
}
|
||||
RawAcceleration rawAcceleration = event.getRawAcceleration();
|
||||
System.out.println(event);
|
||||
double[] vector = new double[] {
|
||||
rawAcceleration.getX(),
|
||||
rawAcceleration.getY(),
|
||||
rawAcceleration.getZ()};
|
||||
gestureDevice.add(vector);
|
||||
Acceleration acceleration = calibration.getAcceleration(rawAcceleration);
|
||||
//System.out.println(event);
|
||||
gestureDevice.add(acceleration.toArray());
|
||||
}
|
||||
|
||||
public void gestureReceived(GestureEvent event) {
|
||||
|
||||
@@ -22,7 +22,7 @@ import wiiusej.wiiusejevents.wiiuseapievents.NunchukRemovedEvent;
|
||||
import wiiusej.wiiusejevents.wiiuseapievents.StatusEvent;
|
||||
|
||||
public class WiimoteService extends WiiUseApiManager implements WiimoteListener {
|
||||
protected final boolean RUMBLE = true;
|
||||
protected final boolean RUMBLE = false;
|
||||
|
||||
protected ArrayList<Integer> wiimoteList;
|
||||
protected Wiimote[] wiimoteArray;
|
||||
@@ -75,7 +75,6 @@ public class WiimoteService extends WiiUseApiManager implements WiimoteListener
|
||||
|
||||
public void onStatusEvent(StatusEvent event) {
|
||||
if (event.isConnected()) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ public class GestureDevice extends Device /*implements AccelerationListener */{
|
||||
}
|
||||
|
||||
public void add(double[] vector) {
|
||||
//System.out.printf("%f %f %f\n", vector[0], vector[1], vector[2]);
|
||||
fireAccelerationEvent(vector);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user