Drone Control from Dynamics NAV

This week at UGFocus I brought my Tello Drone to have some fun at the Hackathon.

The Tello drone can be controlled with a simple text based command mode through UDP communication.

First up, lets connect to the drone, this requires an UdpClient DotNet instance (Since NAV only support TCP not UDP)

After this we need to create a Send command:

UDP is just a byte stream across the net so our data needs to be converted into a byte[] array.

After this, we’re ready to receive data. UDP is a bit different, because send and receive are not linked in the same way as TCP, so we’ll just have to wait a bit to see if anything is received. Since some of the commands to the drone can take a while to complete (it’s a physical thing after all) I set the timeout to around 10 seconds:

Now we’re ready to send a real command to the done:

This simply sends the string “takeoff” to the drone. The IfNotOKTryToLand() method will check if we get an OK return:

On top of this, I have created a series of navigational commands like this:

To complete the picture we added a small little UI where we could put together a series of commands that the drone could execute:

Down the objects from here Tello.zip but please remember, controlling a drone from Dynamics might not be the smartest or safest thing to do 🙂

This article also serves as an example of how to do UDP communication with Dynamics NAV.