/// <summary>
        /// Prompt for the data necessary to create the console commander,
        /// create it and run it
        /// </summary>
        public void Run()
        {
            Console.WriteLine($"Tello Commander {DroneCommander.Version}");

            string version = PromptForDictionaryVersion();

            if (!string.IsNullOrEmpty(version))
            {
                ConnectionType connectionType = PromptForConnectionType();
                if (connectionType != ConnectionType.None)
                {
                    CommandDictionary dictionary = CommandDictionary.ReadStandardDictionary(version);
                    switch (connectionType)
                    {
                    case ConnectionType.Mock:
                        ITelloConnection mockConnection = new MockTelloConnection(dictionary);
                        new ConsoleCommander(mockConnection, dictionary).Run(false);
                        break;

                    case ConnectionType.Simulator:
                        ITelloConnection connection = new TelloConnection(IPAddress.Loopback.ToString(), TelloConnection.DefaultTelloPort, connectionType);
                        new ConsoleCommander(connection, dictionary).Run(true);
                        break;

                    case ConnectionType.Drone:
                        new ConsoleCommander(new TelloConnection(), dictionary).Run(true);
                        break;

                    default:
                        break;
                    }
                }
            }
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            var connection = new TelloConnection();

            connection.Connect("192.168.10.1", 8889);

            var drone = new TelloDrone(connection);

            drone.SendCommand(new TakeoffCommand());
            drone.Wait(1000);
            drone.SendCommand(new RcCommand(0, 50, 0, 0));
            drone.Wait(1000);
            drone.SendCommand(new RcCommand(0, 0, 0, 0));
            drone.SendCommand(new LandCommand());
        }
Exemplo n.º 3
0
 public TelloDrone(TelloConnection connection)
 {
     this.Connection = connection;
 }