RGBCameraStruct.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. using System;
  2. using System.Runtime.InteropServices;
  3. namespace Unity.XR.PICO.TOBSupport
  4. {
  5. // pico slam results
  6. [StructLayout(LayoutKind.Sequential)]
  7. public struct SixDof
  8. {
  9. public Int64 timestamp; // nanoseconds
  10. public double x; // position X
  11. public double y; // position Y
  12. public double z; // position Z
  13. public double rw; // rotation W
  14. public double rx; // rotation X
  15. public double ry; // rotation Y
  16. public double rz; // rotation Z
  17. public byte type; //1:6DOF 0:3DOF
  18. public byte confidence; //1:good 0:bad
  19. public PoseErrorType error;
  20. public double plane_height;
  21. public byte plane_status;
  22. public byte relocation_status;
  23. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)]
  24. public byte[] reserved;
  25. }
  26. [StructLayout(LayoutKind.Sequential)]
  27. public struct AlgoResult
  28. {
  29. public SixDof pose;
  30. public SixDof relocation_pose;
  31. public double vx, vy, vz; // linear velocity
  32. public double ax, ay, az; // linear acceleration
  33. public double wx, wy, wz; // angular velocity
  34. public double w_ax, w_ay, w_az; // angular acceleration
  35. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 48)]
  36. public byte[] reserved;
  37. }
  38. [StructLayout(LayoutKind.Sequential)]
  39. public struct FrameItem
  40. {
  41. public byte camera_id;
  42. public UInt32 width; // width
  43. public UInt32 height; // height
  44. public UInt32 format; // format - rgb24
  45. public UInt32 exposure_duration; // exposure duration:ns
  46. public UInt64 timestamp; // start of exposure time:ns (BOOTTIME)
  47. public UInt64 qtimer_timestamp; // nanoseconds in qtimer
  48. public UInt64 framenumber; // frame number
  49. public UInt32 datasize; // datasize
  50. public IntPtr data; // image data.
  51. }
  52. [StructLayout(LayoutKind.Sequential)]
  53. public struct FrameItemExt
  54. {
  55. public FrameItem frame;
  56. public bool is_rgb;
  57. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
  58. public double[] rgb_tsw_matrix;
  59. public bool is_anti_distortion;
  60. public AlgoResult six_dof_pose;
  61. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
  62. public byte[] reserved;
  63. }
  64. [StructLayout(LayoutKind.Sequential)]
  65. public struct Frame
  66. {
  67. public UInt32 width; // width
  68. public UInt32 height; // height
  69. public UInt64 timestamp; // start of exposure time:ns (BOOTTIME)
  70. public UInt32 datasize; // datasize
  71. public IntPtr data; // image data
  72. public UnityEngine.Pose pose; // The head Pose at the time of image production.(Right-handed coordinate system: X right, Y up, Z in)
  73. public int status; // sensor status(1:good 0:bad)
  74. }
  75. [StructLayout(LayoutKind.Sequential)]
  76. public struct SensorState
  77. {
  78. public UnityEngine.Pose pose; // Predict the head Pose at the screen up time.(Right-handed coordinate system: X right, Y up, Z in)
  79. public int status; // sensor status(1:good 0:bad)
  80. }
  81. [StructLayout(LayoutKind.Sequential)]
  82. public struct RGBCameraParams
  83. {
  84. // Intrinsics
  85. public double fx;
  86. public double fy;
  87. public double cx;
  88. public double cy;
  89. // Extrinsics
  90. public double x;
  91. public double y;
  92. public double z;
  93. public double rw;
  94. public double rx;
  95. public double ry;
  96. public double rz;
  97. }
  98. }