Read drone's state in real-time


I am trying to make the ANAFI drone fly an autonomous trajectory (example: z coordinate = sin(x-coordinate)).
To do this, I want to know the current physical location of the drone in real time, so that I can use the MoveBy command.

Can any one please discuss if:

  1. We can read the drone’s state in some absolute frame (position and attitude) in real time?
  2. If yes, can you please post a code snippet that shows this ?

Hey @rnallapu,

I know it is possible to do it with the --datalog feature in Sphinx. See the code about tlm-data-logger here.

NB: You can get it in real time albeit being a command-line tool, you get a “stream” of data that has to be parsed in order to use it later. It is based in the SDK so you should be able to prototype some snippet to get it directly into your workflow

Moreover, you may also get it through Olympe, but I know no way to do it. If you find anything, please share it!

Very good --datalog feature. I was able to work, but could not access from another computer that is connected to the Sphinx control network. What would be the reason?

Check out tlm-data-logger to redirect the log output to a TCP port.

Thanks. I will test this.
On the other hand, I can get the position with SDK events (, but the update interval is very large, about 1 second. Does anyone know how to shorten this time?

Hello @espetro and @pjnet,

Thank you very much for your responses.

@pjnet: I worked with the position state changed command. But This does not work well for indoor flights.
Example: I noted the (lat, lon, alt) when my ANAFI took off. I then commanded my drone to ‘moveby’ 1 m forward and then measured the (lat, lon, and alt). These values were exactly the same. – At least in my case. As far as the interval goes, I was reading the data in a while loop, so my state would be updated every time instant.

@espetro: I think the tlm logger is exactly what I want, but as you mentioned, this is for the Sphinx. environment. Is there a similar environment to read the data from a physical drone ?


I think a physical drone has no way of knowing the actual position without GPS. Therefore it sends the value of 500.