private void RecieveData() { while (true) { ip = new IPEndPoint(IPAddress.Any, 0); var bytes = UdpPlatform.Instance.RecieveData(ref ip); var length = bytes.Length; if (length == StructHelper.GetStructSize <AngleWithLocation>()) { var angleAndLocation = StructHelper.BytesToStruct <AngleWithLocation>(bytes); var pitchRad = StructHelper.Deg2Rad((float)angleAndLocation.Pitch); var rollRad = StructHelper.Deg2Rad((float)angleAndLocation.Roll); var yawRad = StructHelper.Deg2Rad((float)angleAndLocation.Yaw); var ipstr = ip.ToString(); if (ipstr.StartsWith("192.168.0.131") == false && ipstr.StartsWith("192.168.0.136") == false) { this.angleWithLocation = angleAndLocation; this.angle.Pitch = -pitchRad; this.angle.Roll = -rollRad; this.angle.Yaw = yawRad; if (this.IsSend == true) { UdpPlatform.Instance.SendData(this.angleWithLocation, TeachIp); } } else { this.otherAngleWithLocation = angleAndLocation; this.otherAngle.Pitch = pitchRad; this.otherAngle.Roll = rollRad; this.otherAngle.Yaw = yawRad; } } if (length == StructHelper.GetStructSize <TeachingCommand>()) { command = StructHelper.BytesToStruct <TeachingCommand>(bytes); this.IsSendFromTeachingPlatform = command.IsStart == 1; } } }