예제 #1
0
        internal static DemoOption FromReader(ushort size, BinaryReader reader)
        {
            Validate(size);
            var result = new DemoOption
            {
                State             = (States)reader.ReadUInt32(),
                BatteryPercentage = reader.ReadUInt32(),
                Theta             = reader.ReadSingle() / 1000f,
                Phi         = reader.ReadSingle() / 1000f,
                Psi         = reader.ReadSingle() / 1000f,
                Altitude    = reader.ReadInt32() / 1000,
                Vx          = reader.ReadSingle() / 1000f,
                Vy          = reader.ReadSingle() / 1000f,
                Vz          = reader.ReadSingle() / 1000f,
                FrameNumber = reader.ReadUInt32(),
                _detectionCameraRotation = Matrix33.FromReader(reader),
                _detectionCameraTrans    = Vector.FromReader(reader),
                DetectionTagIndex        = reader.ReadUInt32(),
                DetectionCameraType      = reader.ReadUInt32(),
                _droneCameraRotation     = Matrix33.FromReader(reader),
                _droneCameraTrans        = Vector.FromReader(reader)
            };

            return(result);
        }
예제 #2
0
        private void AddOption(NavDataTag optionId, ushort size, BinaryReader reader)
        {
            switch (optionId)
            {
            case NavDataTag.Demo:
                Demo = DemoOption.FromReader(size, reader);
                break;

            case NavDataTag.Checksum:
                CheckSum = ChecksumOption.FromBytes(size, reader);
                break;

            case NavDataTag.VisionDetect:
                VisionDetect = VisionDetectOption.FromReader(size, reader);
                break;

            case NavDataTag.Wifi:
                Wifi = WifiOption.FromReader(size, reader);
                break;

            case NavDataTag.HdVideoStream:
                HdVideoStream = HdVideoStreamOption.FromReader(size, reader);
                break;

            default:
                if (false && Debugger.IsAttached)
                {
                    // An unhandled navdata option was detected; break into the debugger
                    Debugger.Break();
                }
                else
                {
                    for (int i = 0; i < size - 4; i++)
                    {
                        reader.ReadByte();
                    }
                }

                break;
            }
        }