Exemplo n.º 1
0
        public static Matrix3 rotation_df(DFLog.DFItem ATT)
        {
            //return the current DCM rotation matrix'''
            var r = new Matrix3();

            r.from_euler(radians((Double)ATT.GetRaw("Roll")), radians((Double)ATT.GetRaw("Pitch")), radians((Double)ATT.GetRaw("Yaw")));
            return(r);
        }
Exemplo n.º 2
0
        public static Vector3 earth_accel_df(DFLog.DFItem IMU, DFLog.DFItem ATT)
        {
            //return earth frame acceleration vector from df log
            var r     = rotation_df(ATT);
            var accel = new Vector3((float)IMU.GetRaw("AccX"), (float)IMU.GetRaw("AccY"), (float)IMU.GetRaw("AccZ"));

            return(r * accel);
        }
Exemplo n.º 3
0
        public DFLog.DFItem this[long indexin]
        {
            get
            {
                var index = (int)indexin;

                long startoffset = linestartoffset[index];
                long endoffset   = startoffset;

                if ((index + 1) >= linestartoffset.Count)
                {
                    endoffset = basestream.Length;
                }
                else
                {
                    endoffset = linestartoffset[index + 1];
                }

                int length = (int)(endoffset - startoffset);

                // prevent multi io to file
                lock (locker)
                {
                    if (linestartoffset[index] != basestream.Position)
                    {
                        basestream.Seek(linestartoffset[index], SeekOrigin.Begin);
                    }

                    if (binary)
                    {
                        var items = binlog.ReadMessageObjects(basestream, basestream.Length);

                        //var test = dflog.GetDFItemFromLine(this[index], index);

                        var answer = new DFLog.DFItem(dflog, items, (int)indexin);

                        return(answer);
                    }
                    else
                    {
                        byte[] data = new byte[length];

                        basestream.Read(data, 0, length);

                        return(dflog.GetDFItemFromLine(ASCIIEncoding.ASCII.GetString(data), (int)indexin));
                    }
                }
            }
        }