Added Fast Reset button that resets only Yaw of the trackers

This commit is contained in:
Eiren Rain committed 2021-08-04 07:48:54 +03:00
1 parent fa66c94ec3
commit 467e79d1c0
8 files changed
+80 -2

No files matched your search

@@ -91,6 +91,15 @@ public class VRServerGUI extends JFrame {
}
});
}});
add(Box.createHorizontalStrut(10));
add(new JButton("Fast Reset") {{
addMouseListener(new MouseInputAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
resetFast();
}
});
}});
add(Box.createHorizontalGlue());
add(new JButton("GUI Zoom (x" + StringUtils.prettyNumber(zoom, 2) + ")") {{
addMouseListener(new MouseInputAdapter() {
@@ -234,6 +243,11 @@ public class VRServerGUI extends JFrame {
}
}
@AWTThread
private void resetFast() {
server.resetTrackersYaw();
}
@AWTThread
private void reset() {
ButtonTimer.runTimer(resetButton, 3, "RESET", server::resetTrackers);
+1 -1
View File
@@ -7,7 +7,7 @@ import io.eiren.util.logging.LogManager;
public class Main {
public static String VERSION = "0.0.13 Test 3";
public static String VERSION = "0.0.13 Test 4";
public static VRServer vrServer;
+6
View File
@@ -234,6 +234,12 @@ public class VRServer extends Thread {
});
}
public void resetTrackersYaw() {
queueTask(() -> {
humanPoseProcessor.resetTrackersYaw();
});
}
public int getTrackersCount() {
return trackers.size();
}
@@ -126,4 +126,10 @@ public class HumanPoseProcessor {
if(skeleton != null)
skeleton.resetTrackersFull();
}
@VRServerThread
public void resetTrackersYaw() {
if(skeleton != null)
skeleton.resetTrackersYaw();
}
}
@@ -325,4 +325,35 @@ public class HumanSekeletonWithLegs extends HumanSkeleonWithWaist {
this.rightFootTracker.resetFull(referenceRotation);
}
}
@Override
@VRServerThread
public void resetTrackersYaw() {
// Each tracker uses the tracker before it to adjust iteself,
// so trackers that don't need adjustments could be used too
super.resetTrackersYaw();
// Start with waist, it was reset in the parent
Quaternion referenceRotation = new Quaternion();
this.waistTracker.getRotation(referenceRotation);
this.leftLegTracker.resetYaw(referenceRotation);
this.rightLegTracker.resetYaw(referenceRotation);
this.leftLegTracker.getRotation(referenceRotation);
this.leftAnkleTracker.resetYaw(referenceRotation);
this.leftAnkleTracker.getRotation(referenceRotation);
if(this.leftFootTracker != null) {
this.leftFootTracker.resetYaw(referenceRotation);
}
this.rightLegTracker.getRotation(referenceRotation);
this.rightAnkleTracker.resetYaw(referenceRotation);
this.rightAnkleTracker.getRotation(referenceRotation);
if(this.rightFootTracker != null) {
this.rightFootTracker.resetYaw(referenceRotation);
}
}
}
@@ -236,4 +236,18 @@ public class HumanSkeleonWithWaist extends HumanSkeleton {
this.waistTracker.resetFull(referenceRotation);
}
@Override
@VRServerThread
public void resetTrackersYaw() {
// Each tracker uses the tracker before it to adjust iteself,
// so trackers that don't need adjustments could be used too
Quaternion referenceRotation = new Quaternion();
server.hmdTracker.getRotation(referenceRotation);
this.chestTracker.resetYaw(referenceRotation);
this.chestTracker.getRotation(referenceRotation);
this.waistTracker.resetYaw(referenceRotation);
}
}
@@ -24,4 +24,7 @@ public abstract class HumanSkeleton {
@VRServerThread
public abstract void resetTrackersFull();
@VRServerThread
public abstract void resetTrackersYaw();
}
@@ -52,7 +52,7 @@ public class ReferenceAdjustedTracker<E extends Tracker> implements Tracker {
gyroFix.mult(sensorRotation, sensorRotation);
attachmentFix.set(sensorRotation).inverseLocal();
resetYaw(reference);
fixYaw(reference);
}
/**
@@ -64,6 +64,10 @@ public class ReferenceAdjustedTracker<E extends Tracker> implements Tracker {
*/
@Override
public void resetYaw(Quaternion reference) {
fixYaw(reference);
}
private void fixYaw(Quaternion reference) {
// Use only yaw HMD rotation
Quaternion targetTrackerRotation = new Quaternion(reference);
float[] angles = new float[3];