Yaw drift compensation (#436)

This commit is contained in:
Erimel authored and GitHub committed 2023-01-05 17:12:47 +03:00
1 parent 3c5dc4d8b5
commit ac6c7da1be
23 files changed
+808 -167

No files matched your search

@@ -0,0 +1,60 @@
package dev.slimevr.config;
import dev.slimevr.Main;
import dev.slimevr.vr.trackers.IMUTracker;
import dev.slimevr.vr.trackers.Tracker;
public class DriftCompensationConfig {
// Is drift compensation enabled
private boolean enabled = false;
// Amount of drift compensation applied
private float amount = 0.8f;
// Max resets for the calculated average drift
private int maxResets = 6;
public DriftCompensationConfig() {
}
public void updateTrackersDriftCompensation() {
for (Tracker t : Main.getVrServer().getAllTrackers()) {
Tracker tracker = t.get();
if (tracker instanceof IMUTracker imuTracker) {
imuTracker
.setDriftCompensationSettings(
getEnabled(),
getAmount(),
getMaxResets()
);
}
}
}
public boolean getEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public float getAmount() {
return amount;
}
public void setAmount(float amount) {
this.amount = amount;
}
public int getMaxResets() {
return maxResets;
}
public void setMaxResets(int maxResets) {
this.maxResets = maxResets;
}
}