Added unit tests for adjusted trackers rotation, another rotation correction alghorithm

Added version number to the title to reduce confusion
This commit is contained in:
Eiren Rain committed 2021-07-21 17:38:43 +03:00
1 parent 4a66128af5
commit c8ba9d62aa
7 files changed
+291 -206

No files matched your search

+19 -1
View File
@@ -102,6 +102,8 @@ public class TrackersList extends EJBox {
JLabel bat;
JLabel ping;
JLabel raw;
JLabel adj;
JLabel adjYaw;
@AWTThread
public TrackerRow(Tracker t) {
@@ -178,6 +180,13 @@ public class TrackersList extends EJBox {
add(bat = new JLabel("0"), c(3, 4, 0, GridBagConstraints.FIRST_LINE_START));
add(new JLabel("Raw:"), c(0, 5, 0, GridBagConstraints.FIRST_LINE_START));
add(raw = new JLabel("0 0 0 0"), s(c(1, 5, 0, GridBagConstraints.FIRST_LINE_START), 3, 1));
if(t instanceof ReferenceAdjustedTracker) {
add(new JLabel("Adj:"), c(0, 6, 0, GridBagConstraints.FIRST_LINE_START));
add(adj = new JLabel("0 0 0 0"), c(1, 6, 0, GridBagConstraints.FIRST_LINE_START));
add(new JLabel("AdjY:"), c(2, 6, 0, GridBagConstraints.FIRST_LINE_START));
add(adjYaw = new JLabel("0 0 0 0"), c(3, 6, 0, GridBagConstraints.FIRST_LINE_START));
}
setBorder(BorderFactory.createLineBorder(new Color(0x663399), 4, true));
TrackersList.this.add(this);
@@ -207,8 +216,17 @@ public class TrackersList extends EJBox {
if(t instanceof TrackerWithBattery)
bat.setText(StringUtils.prettyNumber(((TrackerWithBattery) t).getBatteryVoltage(), 1));
Tracker t2 = t;
if(t instanceof ReferenceAdjustedTracker)
if(t instanceof ReferenceAdjustedTracker) {
t2 = ((ReferenceAdjustedTracker<Tracker>) t).getTracker();
((ReferenceAdjustedTracker<Tracker>) t).adjustmentAttachment.toAngles(angles);
adj.setText(StringUtils.prettyNumber(angles[0] * FastMath.RAD_TO_DEG, 0)
+ " " + StringUtils.prettyNumber(angles[1] * FastMath.RAD_TO_DEG, 0)
+ " " + StringUtils.prettyNumber(angles[2] * FastMath.RAD_TO_DEG, 0));
((ReferenceAdjustedTracker<Tracker>) t).adjustmentYaw.toAngles(angles);
adjYaw.setText(StringUtils.prettyNumber(angles[0] * FastMath.RAD_TO_DEG, 0)
+ " " + StringUtils.prettyNumber(angles[1] * FastMath.RAD_TO_DEG, 0)
+ " " + StringUtils.prettyNumber(angles[2] * FastMath.RAD_TO_DEG, 0));
}
if(t2 instanceof IMUTracker)
ping.setText(String.valueOf(((IMUTracker) t2).ping));
t2.getRotation(q);
+2 -1
View File
@@ -6,6 +6,7 @@ import javax.swing.event.MouseInputAdapter;
import io.eiren.util.StringUtils;
import io.eiren.util.ann.AWTThread;
import io.eiren.vr.Main;
import io.eiren.vr.VRServer;
import io.eiren.vr.bridge.NamedPipeVRBridge;
@@ -31,7 +32,7 @@ public class VRServerGUI extends JFrame {
@AWTThread
public VRServerGUI(VRServer server) {
super("SlimeVR Server");
super("SlimeVR Server (" + Main.VERSION + ")");
//increaseFontSize();
this.server = server;
+5 -2
View File
@@ -8,7 +8,10 @@ import io.eiren.util.logging.LogManager;
public class Main {
@SuppressWarnings("unused")
public static String VERSION = "0.0.7 DEV 1";
public static VRServer vrServer;
public static void main(String[] args) {
System.setProperty("awt.useSystemAAFontSettings", "on");
System.setProperty("swing.aatext", "true");
@@ -21,7 +24,7 @@ public class Main {
}
try {
VRServer vrServer = new VRServer();
vrServer = new VRServer();
vrServer.start();
new VRServerGUI(vrServer);
} catch(Throwable e) {
@@ -46,9 +46,9 @@ public class ReferenceAdjustedTracker<E extends Tracker> implements Tracker {
public void resetFull(Quaternion reference) {
Quaternion sensorRotation = new Quaternion();
tracker.getRotation(sensorRotation);
float[] angles = new float[3];
sensorRotation.toAngles(angles);
sensorRotation.fromAngles(angles[0], 0, angles[2]);
//float[] angles = new float[3];
//sensorRotation.toAngles(angles);
//sensorRotation.fromAngles(angles[0], 0, angles[2]);
adjustmentAttachment.set(sensorRotation).inverseLocal();
resetYaw(reference);
@@ -71,7 +71,8 @@ public class ReferenceAdjustedTracker<E extends Tracker> implements Tracker {
Quaternion sensorRotation = new Quaternion();
tracker.getRotation(sensorRotation);
sensorRotation.multLocal(adjustmentAttachment);
adjustmentAttachment.mult(sensorRotation, sensorRotation);
//sensorRotation.multLocal(adjustmentAttachment);
sensorRotation.toAngles(angles);
sensorRotation.fromAngles(0, angles[1], 0);
@@ -82,7 +83,8 @@ public class ReferenceAdjustedTracker<E extends Tracker> implements Tracker {
}
protected void adjustInternal(Quaternion store) {
store.multLocal(adjustmentAttachment);
//store.multLocal(adjustmentAttachment);
adjustmentAttachment.mult(store, store);
adjustmentYaw.mult(store, store);
}