コード例 #1
0
    void OnNewReceiveUdpServerEvent(object sender, NewEventReceiveUDPServerArgs e)
    {
        try
        {
            _sensorCalibration.Push(e.ReceiveUDPServerMessage);

            GyroQuaternion gyroQuaternionInverse           = GyroQuaternion.Inverse(e.ReceiveUDPServerMessage);
            GyroQuaternion gyroQuaternionCalibrationResult = _sensorCalibration.GetCalibrationResult(e.ReceiveUDPServerMessage.sensorName);

            if (gyroQuaternionCalibrationResult != null)
            {
                GyroQuaternion gyroQuaternion = GyroQuaternion.Multiply(gyroQuaternionInverse, gyroQuaternionCalibrationResult);

                gyroQuaternion = GetSettingsAxis(gyroQuaternion);

                if (_senderUdpClient.UdpSocket != null && _senderUdpClient.UdpSocket.Connected)
                {
                    _senderUdpClient.Send(gyroQuaternion);
                }

                if (e.ReceiveUDPServerMessage.sensorName == GetSelectorSensorValue())
                {
                    gyroQuaternion = _filterQuaternion.Filter(gyroQuaternion);

                    Cube3DRender(gyroQuaternion);
                }
            }
        }
        catch (Exception)
        {
            // ignored
        }
    }
コード例 #2
0
    public void InvokeOnNewReceiveUDPServer(GyroQuaternion quat)
    {
        NewReceiveUDPServer          handler = OnNewReceiveUDPServer;
        NewEventReceiveUDPServerArgs e       = new NewEventReceiveUDPServerArgs(quat);

        handler?.Invoke(this, e);
    }