Handle computed trackers better and handle tracker status in data collection

This commit is contained in:
ButterscotchVanilla committed 2021-09-14 04:01:10 -04:00
1 parent d92ea0a39e
commit 63e259689f
8 files changed
+43 -3

No files matched your search

@@ -3,9 +3,11 @@ package dev.slimevr.vr.poserecorder;
import java.util.List;
import io.eiren.util.collections.FastList;
import io.eiren.vr.processor.ComputedHumanPoseTracker;
import io.eiren.vr.processor.TrackerBodyPosition;
import io.eiren.vr.trackers.ComputedTracker;
import io.eiren.vr.trackers.Tracker;
import io.eiren.vr.trackers.TrackerStatus;
import io.eiren.vr.trackers.TrackerUtils;
public final class PoseFrame {
@@ -30,7 +32,7 @@ public final class PoseFrame {
for (Tracker tracker : trackers) {
// Ignore computed trackers if they aren't requested
if (!includeComputed && tracker.getClass().equals(ComputedTracker.class)) {
if (!includeComputed && tracker.isComputed()) {
continue;
}
@@ -58,14 +58,20 @@ public final class TrackerFrame implements Tracker {
return null;
}
// If the tracker is not ready
if (tracker.getStatus() != TrackerStatus.OK && tracker.getStatus() != TrackerStatus.OCCLUDED) {
return null;
}
Quaternion rotation = null;
if (tracker.hasRotation()) {
rotation = new Quaternion();
tracker.getRotation(rotation);
}
// If the tracker is occluded, don't get the position
Vector3f position = null;
if (tracker.hasPosition()) {
if (tracker.hasPosition() && tracker.getStatus() != TrackerStatus.OCCLUDED) {
position = new Vector3f();
tracker.getPosition(position);
}
@@ -168,5 +174,10 @@ public final class TrackerFrame implements Tracker {
public boolean hasPosition() {
return hasData(TrackerFrameData.POSITION);
}
@Override
public boolean isComputed() {
return true;
}
//#endregion
}
@@ -101,4 +101,9 @@ public class ComputedTracker implements Tracker {
public boolean hasPosition() {
return hasPosition;
}
@Override
public boolean isComputed() {
return true;
}
}
@@ -21,4 +21,9 @@ public class HMDTracker extends ComputedTracker implements TrackerWithTPS {
public void dataTick() {
timer.update();
}
@Override
public boolean isComputed() {
return false;
}
}
@@ -238,4 +238,9 @@ public class IMUTracker implements Tracker, TrackerWithTPS, TrackerWithBattery {
public boolean hasPosition() {
return false;
}
@Override
public boolean isComputed() {
return false;
}
}
@@ -156,4 +156,9 @@ public class ReferenceAdjustedTracker<E extends Tracker> implements Tracker {
public boolean hasPosition() {
return tracker.hasPosition();
}
}
@Override
public boolean isComputed() {
return tracker.isComputed();
}
}
@@ -26,4 +26,9 @@ public class SteamVRTracker extends ComputedTracker implements TrackerWithTPS {
public boolean userEditable() {
return true;
}
@Override
public boolean isComputed() {
return false;
}
}
@@ -36,4 +36,6 @@ public interface Tracker {
public boolean hasRotation();
public boolean hasPosition();
public boolean isComputed();
}