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
}