update
This commit is contained in:
@ -1,5 +1,7 @@
|
||||
using System.Diagnostics.Metrics;
|
||||
using DroneData;
|
||||
using System.Diagnostics.Metrics;
|
||||
using System.Drawing;
|
||||
using System.Numerics;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace DroneClient
|
||||
@ -15,6 +17,8 @@ namespace DroneClient
|
||||
public float LaserRange;
|
||||
public uint TimeRange;
|
||||
|
||||
public Vector2 OF = Vector2.Zero;
|
||||
|
||||
public float MotorUL, MotorUR, MotorDL, MotorDR;
|
||||
|
||||
public static byte[] getBytes(object data)
|
||||
@ -116,6 +120,16 @@ namespace DroneClient
|
||||
return new byte[0];
|
||||
}
|
||||
|
||||
private byte[]? RecvDataOF(byte[] data)
|
||||
{
|
||||
DroneData.DataOF of = (DroneData.DataOF)fromBytes(data, typeof(DroneData.DataOF));
|
||||
|
||||
OF.X = of.X;
|
||||
OF.Y = of.Y;
|
||||
|
||||
return new byte[0];
|
||||
}
|
||||
|
||||
private byte[]? ClientRequestResponse(DroneData.DataHead head, byte[] body)
|
||||
{
|
||||
byte[] zero = new byte[0];
|
||||
@ -186,6 +200,22 @@ namespace DroneClient
|
||||
}
|
||||
}
|
||||
|
||||
case DroneData.DataType.DataOF:
|
||||
{
|
||||
if (head.Mode == DroneData.DataMode.Request)
|
||||
{
|
||||
// Запрос данных
|
||||
// ... //
|
||||
//
|
||||
return zero;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Пришли данные
|
||||
return RecvDataOF(body);
|
||||
}
|
||||
}
|
||||
|
||||
case DroneData.DataType.DataMotor4:
|
||||
{
|
||||
if (head.Mode == DroneData.DataMode.Request)
|
||||
@ -271,12 +301,18 @@ namespace DroneClient
|
||||
local.Mode = DroneData.DataMode.Request;
|
||||
local.Type = DroneData.DataType.DataLocal;
|
||||
|
||||
DroneData.DataHead of = new DroneData.DataHead();
|
||||
of.Size = DroneData.DataHead.StrLen;
|
||||
of.Mode = DroneData.DataMode.Request;
|
||||
of.Type = DroneData.DataType.DataOF;
|
||||
|
||||
List<byte[]> list = new List<byte[]>();
|
||||
|
||||
list.Add(getBytes(acc));
|
||||
list.Add(getBytes(gyr));
|
||||
list.Add(getBytes(range));
|
||||
list.Add(getBytes(local));
|
||||
list.Add(getBytes(of));
|
||||
list.Add(SendDataMotor4());
|
||||
|
||||
int count = 0;
|
||||
|
Reference in New Issue
Block a user