|
@@ -69,7 +69,7 @@ public class o0MagneticCalibraterSimple//默认在无磁干扰环境下,有磁
|
|
|
{
|
|
{
|
|
|
get
|
|
get
|
|
|
{
|
|
{
|
|
|
- return Min != default && Max != default;
|
|
|
|
|
|
|
+ return Min != new Vector3(float.MaxValue, float.MaxValue, float.MaxValue) && Max != new Vector3(float.MinValue, float.MinValue, float.MinValue);
|
|
|
}
|
|
}
|
|
|
set
|
|
set
|
|
|
{
|
|
{
|
|
@@ -398,7 +398,7 @@ public class o09Axis
|
|
|
if (this.TimeGapOld <= 0)
|
|
if (this.TimeGapOld <= 0)
|
|
|
return Last.Qua;
|
|
return Last.Qua;
|
|
|
States.Add(new State());
|
|
States.Add(new State());
|
|
|
- if (States.Count > 2)
|
|
|
|
|
|
|
+ if (States.Count > 200)
|
|
|
States.RemoveAt(0);
|
|
States.RemoveAt(0);
|
|
|
var state = States.Last();
|
|
var state = States.Last();
|
|
|
state.Acc = Acc;
|
|
state.Acc = Acc;
|
|
@@ -445,4 +445,18 @@ public class o09Axis
|
|
|
States.Last().Qua = Quaternion.identity;
|
|
States.Last().Qua = Quaternion.identity;
|
|
|
States.Last().Variance = 0.0000001;
|
|
States.Last().Variance = 0.0000001;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ public void SetIdentityAccordingToRecords()
|
|
|
|
|
+ {
|
|
|
|
|
+ AccIdentity = Vector3.zero;
|
|
|
|
|
+ foreach (var i in States)
|
|
|
|
|
+ AccIdentity += i.Acc;
|
|
|
|
|
+ AccIdentity /= States.Count;
|
|
|
|
|
+ MagIdentity = Vector3.zero;
|
|
|
|
|
+ foreach (var i in States)
|
|
|
|
|
+ MagIdentity += i.Mag;
|
|
|
|
|
+ MagIdentity /= States.Count;
|
|
|
|
|
+ States.Last().Qua = Quaternion.identity;
|
|
|
|
|
+ States.Last().Variance = 0.0000001;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|