Esempio n. 1
0
        private void UpdateNavigationData(NavigationPacket packet)
        {
            NavigationData navigationData;

            if (TryParseNavigationPacket(ref packet, out navigationData))
            {
                _DroneClient.NavigationData = navigationData;
                _DroneClient.NavigationDataViewModel.Update(navigationData);
                if (navigationData.Masks.HasFlag(def_ardrone_state_mask_t.ARDRONE_COM_WATCHDOG_MASK))
                {
                    _DroneClient.PostCommand(Command.Watchdog());
                }

                if (navigationData.Masks.HasFlag(def_ardrone_state_mask_t.ARDRONE_COMMAND_MASK))
                {
                    if (consecutiveCommandMask >= 5)
                    {
                        _DroneClient.FlushConfigCommands();
                        consecutiveCommandMask = 0;
                    }
                    else
                    {
                        consecutiveCommandMask++;
                    }
                }
                else
                {
                    consecutiveCommandMask = 0;
                }
                //TODO gérer les autres MASKS (LOW Battery, Too much wind) pour la gestion d'alertes
            }
        }