forked from CPL/Simulator
67 lines
1.3 KiB
C#
67 lines
1.3 KiB
C#
using System.Runtime.InteropServices;
|
|
|
|
namespace DroneData
|
|
{
|
|
public enum DataMode : ushort
|
|
{
|
|
None = 0, Response = 1, Request = 2
|
|
};
|
|
|
|
public enum DataType : ushort
|
|
{
|
|
None = 0, Head = 1,
|
|
|
|
// Output
|
|
DataIMU = 1001, DataPos = 1002,
|
|
|
|
// Input
|
|
DataMotor4 = 2001, DataMotor6 = 2002
|
|
};
|
|
|
|
public struct DataHead
|
|
{
|
|
public int Size;
|
|
|
|
public DataMode Mode;
|
|
public DataType Type;
|
|
|
|
static public int StrLen = Marshal.SizeOf(typeof(DroneData.DataHead));
|
|
}
|
|
|
|
public struct XYZ { public float X, Y, Z; }
|
|
|
|
public struct DataIMU
|
|
{
|
|
public DataHead Head;
|
|
public XYZ Acc, Gyr, Mag;
|
|
|
|
static public int StrLen = Marshal.SizeOf(typeof(DroneData.DataIMU));
|
|
}
|
|
|
|
public struct DataPos
|
|
{
|
|
public DataHead Head;
|
|
public XYZ Local; // Ëîêàëüíûå êîîðäèíàòû
|
|
public float LiDAR; // Äàò÷èê ïîñàäêè
|
|
|
|
static public int StrLen = Marshal.SizeOf(typeof(DroneData.DataPos));
|
|
}
|
|
|
|
public struct DataMotor4
|
|
{
|
|
public DataHead Head;
|
|
public ulong Count;
|
|
public float UL, UR, DL, DR;
|
|
|
|
static public int StrLen = Marshal.SizeOf(typeof(DroneData.DataMotor4));
|
|
}
|
|
|
|
public struct DataMotor6
|
|
{
|
|
public DataHead Head;
|
|
public ulong Count;
|
|
public float UL, UR, LL, RR, DL, DR;
|
|
|
|
static public int StrLen = Marshal.SizeOf(typeof(DroneData.DataMotor6));
|
|
}
|
|
} |