Add variable or stretch factors

This commit is contained in:
glax 2023-12-03 02:10:03 +01:00
parent bd767fc056
commit c7f4a96a0d

View File

@ -18,6 +18,8 @@ public class OSCCollar
double radius = jObject.GetValue("radius")?.ToObject<double>() ?? 100;
double calibrationX = jObject.GetValue("calibrationX")?.ToObject<double>() ?? 0;
double calibrationY = jObject.GetValue("calibrationY")?.ToObject<double>() ?? 0;
double walkStretchDeadzone = jObject.GetValue("walkStretchDeadzone")?.ToObject<double>() ?? 0.1;
double runStretch = jObject.GetValue("runStretch")?.ToObject<double>() ?? 0.4;
bool skipSetup = jObject.GetValue("skipSetup")?.ToObject<bool>() ?? 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);