AttitudeJson_SDK.cs 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. using System.Collections.Generic;
  2. using Newtonsoft.Json.Linq;
  3. using o0.IMU;
  4. using o0.Geometry;
  5. using o0;
  6. namespace SmartBowSDK
  7. {
  8. public class AttitudeJson_SDK : CustomJson_SDK
  9. {
  10. public AttitudeJson_SDK() : base()
  11. {
  12. InitJsonClass<_9AxisPreProcessor>(() => new _9AxisPreProcessor(),
  13. "AccByteIndex",
  14. "GyrByteIndex",
  15. "MagByteIndex",
  16. "ByteToAcc",
  17. "ByteToGyr",
  18. "ByteToMag",
  19. "GyrCalibrater",
  20. "MagCalibrater",
  21. "ByteReverseMS"
  22. );
  23. InitJsonClass<MagnetometerAutoCalibrater>(() => new MagnetometerAutoCalibrater(),
  24. "CountPerLength",
  25. "EllipsoidFitting",
  26. "FitCountLeft",
  27. "FitThreshold",
  28. "LastTimestamp",
  29. "Lock",
  30. "MaxCount",
  31. "NewBlock",
  32. "NewBlockAccumulation",
  33. "Variance",
  34. "VectorByBlock"
  35. );
  36. InitJsonClass<ByteToShorts>(() => new ByteToShorts(3),
  37. "ByteToShort"
  38. );
  39. InitJsonClass<ByteToShort>(() => new ByteToShort(null),
  40. "MinCount",
  41. "Reverse",
  42. "Short"
  43. );
  44. InitJsonClass<MeanMaintainer<Vector<double>>>(() => new MeanMaintainer<Vector<double>>(),
  45. "Count",
  46. "Mean"
  47. );
  48. InitJsonClass<ByteToShortByVariance>(() => new ByteToShortByVariance(),
  49. "Count",
  50. "Reverse",
  51. "Short",
  52. "ThresholdRate"
  53. );
  54. InitJsonClass<EllipsoidFitting>(() => new EllipsoidFitting(default, null, default),
  55. "Center",
  56. "CorrectMatrixArray",
  57. "Radius"
  58. );
  59. InitJsonClass<Dictionary<Vector<int>, Vector<double>>>(
  60. o => JToken.FromObject(o),
  61. jt =>
  62. {
  63. var o = new Dictionary<Vector<int>, Vector<double>>();
  64. foreach (JProperty item in jt)
  65. o[ParseByExporter<Vector<int>>(JArray.Parse(item.Name))]
  66. = ParseByExporter<Vector<double>>(item.Value);
  67. return o;
  68. }
  69. );
  70. InitJsonClass<Vector<int>>(
  71. o => JToken.FromObject(o),
  72. jt => new Vector<int>(jt.ToObject<int[]>())
  73. );
  74. InitJsonClass<Vector<double>>(
  75. o => JToken.FromObject(o),
  76. jt => new Vector<double>(jt.ToObject<double[]>())
  77. );
  78. }
  79. }
  80. }