Anafi Monitoring

Hello,
I would like to be able to monitor several parameters of my drone while it is moving. I have a states method that must loop every second to write the information to a file. But whatever I use thread, subproccess, lock, async,… I can’t get them to work in parallel… Have I missed a tip in the documentation?

Thanks in advance
Cybo

My code:

Hello,

I’d like to add a publisher/subscriber API to Olympe in order to simplify this use case. It shouldn’t be too hard to implement it.

I think this is also what @ptsneves was looking for at some point (see his third question in the following thread) :

He’s proposing a simple patch on Olympe to add a message callback API that might interest you. I am not a big fan of spawning a thread for each received message (a dedicated thread for running the callbacks with a queue to receive the messages from olympe would be better) but his solution is simple and should work.

Here, you are blocking the main thread with :

self.drone(moveBy(4, 0, 0, math.pi, _timeout=20)).wait().success()

while the main thread is holding the lock. So there is no state update while the drone hasn’t reached its moveBy destination (4 meters ~= a few seconds).

Anyway, I don’t see what your lock is protecting here because Olympe performs most of its work in dedicated background threads. In this case, simply removing the lock should solve all your problems.

Hi,

Olympe 1.2.0 has a new event monitoring API. You should probably have a look at the following examples:

Nicolas

2 Likes