From c7f4a96a0d216a3944b96deb70bc87f42038d70e Mon Sep 17 00:00:00 2001 From: glax Date: Sun, 3 Dec 2023 02:10:03 +0100 Subject: [PATCH] Add variable or stretch factors --- OSCCollar/OSCCollar.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/OSCCollar/OSCCollar.cs b/OSCCollar/OSCCollar.cs index 8330135..18733b4 100644 --- a/OSCCollar/OSCCollar.cs +++ b/OSCCollar/OSCCollar.cs @@ -18,6 +18,8 @@ public class OSCCollar double radius = jObject.GetValue("radius")?.ToObject() ?? 100; double calibrationX = jObject.GetValue("calibrationX")?.ToObject() ?? 0; double calibrationY = jObject.GetValue("calibrationY")?.ToObject() ?? 0; + double walkStretchDeadzone = jObject.GetValue("walkStretchDeadzone")?.ToObject() ?? 0.1; + double runStretch = jObject.GetValue("runStretch")?.ToObject() ?? 0.4; bool skipSetup = jObject.GetValue("skipSetup")?.ToObject() ?? true; var _ = new OSCCollar(ip, portReceive, portSend, radius, calibrationX, calibrationY, skipSetup); }else @@ -37,7 +39,7 @@ public class OSCCollar private static readonly TimeSpan ConsoleUpdateInterval = TimeSpan.FromMilliseconds(100); private static readonly TimeSpan UpdateInterval = TimeSpan.FromMilliseconds(10); private static readonly TimeSpan MessageMinInterval = TimeSpan.FromMilliseconds(400); - private readonly double _radius; + private readonly double _radius, _walkStretch, _runStretch; private GPS GPS1 { get; init; } private GPS GPS2 { get; init; } private GPS GPS3 { get; init; } @@ -50,8 +52,10 @@ public class OSCCollar private double GPSConstantD { get; init; } private double GPSConstantE { get; init; } - private OSCCollar(string ip = "127.0.0.1", int portReceive = 9001, int portSend = 9000, double radius = 100, double calibrationX = 0, double calibrationY = 0, bool skipSetup = true) + private OSCCollar(string ip = "127.0.0.1", int portReceive = 9001, int portSend = 9000, double radius = 100, double calibrationX = 0, double calibrationY = 0, double walkStretch = 0.1, double runStretch = 0.4, bool skipSetup = true) { + this._walkStretch = walkStretch; + this._runStretch = runStretch; this._radius = radius; this.GPS1 = new(0, -radius); this.GPS2 = new(-(radius * 0.866), radius / 2);