forked from CPL/Simulator
update
This commit is contained in:
@ -4,6 +4,8 @@ using System.Windows.Forms;
|
||||
using static System.Net.Mime.MediaTypeNames;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
using System.Security.Policy;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.CodeDom;
|
||||
|
||||
namespace DroneSimulator
|
||||
{
|
||||
@ -21,7 +23,7 @@ namespace DroneSimulator
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void ClientConnectionCallback(object o)
|
||||
private int ClientConnectionCallback(object o)
|
||||
{
|
||||
NetServerClients.ConnectData data = (NetServerClients.ConnectData)o;
|
||||
|
||||
@ -52,9 +54,11 @@ namespace DroneSimulator
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return Marshal.SizeOf(typeof(DroneData.DataHead));
|
||||
}
|
||||
|
||||
private void ClientReceiveCallback(object o)
|
||||
private int ClientReceiveCallback(object o)
|
||||
{
|
||||
NetServerClients.ReceiveData data = (NetServerClients.ReceiveData)o;
|
||||
|
||||
@ -67,16 +71,18 @@ namespace DroneSimulator
|
||||
break;
|
||||
}
|
||||
|
||||
if (drone == null) return;
|
||||
if (drone == null) return 0;
|
||||
|
||||
Drone.DataIn id = (Drone.DataIn)Drone.fromBytes(data.Buffer, typeof(Drone.DataIn));
|
||||
int size=drone.RecvDataStream(data.Buffer);
|
||||
|
||||
drone.SetQadroPow(id.MotorUL, id.MotorUR, id.MotorDL, id.MotorDR);
|
||||
|
||||
Drone.DataOut od = drone.GetDataOut();
|
||||
|
||||
try { data.Client.Send(Drone.getBytes(od)); }
|
||||
try
|
||||
{
|
||||
data.Client.Send(drone.SendDataStream(DroneData.StructType.DataIMU));
|
||||
data.Client.Send(drone.SendDataStream(DroneData.StructType.DataPos));
|
||||
}
|
||||
catch { }
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
private void button_Client_Start_Click(object sender, EventArgs e)
|
||||
|
Reference in New Issue
Block a user