Exemple #1
0
        internal static ImuDerivedEventData Parse(byte[] data, int offset)
        {
            ImuDerivedEventData obj = new ImuDerivedEventData();
            UInt64 time_ns          = BitConverter.ToUInt64(data, 0);

            obj._Time = (double)time_ns / (1000 * 1000 * 1000);

            obj._GyroX = BitConverter.ToDouble(data, 8);
            obj._GyroY = BitConverter.ToDouble(data, 16);
            obj._GyroZ = BitConverter.ToDouble(data, 24);

            obj._AccelX = BitConverter.ToDouble(data, 32);
            obj._AccelY = BitConverter.ToDouble(data, 40);
            obj._AccelZ = BitConverter.ToDouble(data, 48);

            return(obj);
        }
Exemple #2
0
        private void _ImuFilterEvent_Fired(LinkUpEventLabel label, byte[] data)
        {
            List <Tuple <IProxyEventSubscriber, ProxyEventType> > subscriber = null;

            lock (_Subscriptions)
            {
                subscriber = _Subscriptions.Where(c => c.Item2 == ProxyEventType.ImuDerivedEvent).ToList();
            }

            if (label == _ImuDerivedEventLabel && subscriber != null && subscriber.Count() > 0)
            {
                ImuDerivedEventData eventData = ImuDerivedEventData.Parse(data, 0);
                foreach (Tuple <IProxyEventSubscriber, ProxyEventType> t in subscriber)
                {
                    t.Item1.Fired(this, new List <AbstractProxyEventData>()
                    {
                        eventData
                    });
                }
            }
        }