Flying Anafi indoors causes random yawing


I recently tried to fly an Anafi drone using both Olympe and using the FreeFlight app. Outdoors the drone works great. However, as soon as I am indoors, the drone starts to yaw. I ran the script below, which requested the drone to move left and right 1m continuously. You can see I don’t send any yaw commands. However, during this test, the drone yawed randomly.

# -*- coding: UTF-8 -*-

import olympe
from olympe.messages.ardrone3.Piloting import TakeOff, moveBy, Landing

drone = olympe.Drone("")
drone(moveBy(0,  1, 0, 0)).wait()
drone(moveBy(0, -1, 0, 0)).wait()
drone(moveBy(0,  1, 0, 0)).wait()
drone(moveBy(0, -1, 0, 0)).wait()

Reading through the forums, I found this question, which had similar problems. @Maxime replied stating: “Indoors the lighting, the ground reflection and its uniformity can induce a drift”. To reduce the possibility that a uniform ground pattern causes the yawing, I taped patterns on the floor using black duct tape. However, doing this did not change the behavior of the drone, and it still yawed without me sending yaw commands.

I ran more tests to try and figure out what exactly was causing the issue, and I think I have narrowed it down to bad compass readings. This video is a test I ran indoors where I hold the cage and then using the FreeFlight app display the compass readings. As I hold the drone and walk towards the north, you can see that the direction of north changes.

My questions are:

  1. Is there a way to fix the compass readings, either by turning them off or feeding them new data?
  2. Does the Anafi drone use a down-facing camera as part of its localization algorithm (i.e., why didn’t marking the floor help?). If it does use a down-facing camera, should I do something specifically in the Olympe code to activate it?

Any advice on the matter would be appreciated :slight_smile:


If you fly indoor a building made with steel (steel building, steel frame building, reinforced concrete building, …) the compass sensor readings may not be accurate/usable.

There is currently no way to disable a sensor or to feed external data into the sensors readings.

Anafi use its down-facing “vertical” camera as part of its localization algorithm. A floor with a non-repeating texture (grass for example) works best. A translucent, uniform or repeating texture floor (a giant checkerboard for example) may invalidate the speed readings from the vertical camera.

No, there is nothing to do from Olympe the vertical down-facing camera is always activated.

The drone firmware is already filtering out invalid sensors readings (compass, vertical camera, barometer, …) and doesn’t get fooled easily. The loss of valid compass sensor readings when flying indoor may deteriorate the precision of the drone heading control. That would be expected and I don’t think there is something simple we could do to improve the drone behavior in this case. The real question is does the drone gets completely fooled by the compass? Can you quantify the drone “yawing” during your test?

1 Like

Thanks for the quick and detailed response @ndessart. From your response, I tried two things:

The first thing was I cluttered the floor of the indoor area (6m X 6m X 2.5m) with random objects of different sizes, colors, shapes (I took all the junk I could find and put on the floor). I used the FreeFlight app and the Anafi controller and flew around inside. The cluttered floor seemed to help a little, but as soon as I got near a metal cabinet or a wall (which I assume has some metal in it), the drone started yawing again. To quantify the amount of yaw, flying at a height of 1.8m, I used roll and pitch commands to trace a square along the edge of the indoor area. After completing 1 lap of the square, the Anafi drone yawed a complete 360 degrees, despite me never giving any yaw commands (I only gave roll and pitch commands).

The second thing I came up with was a mechanical way to nullify any false sensor readings from the compass. I took a small magnet I had lying around and taped it to the back of the drone. Repeating the same square test I did above, the drone performed flawlessly and had no yawing issues. This again leads me to believe that the compass is at fault. The downside to this is that after each flight, the drone wants to do magnetometer calibration, and any yaw commands I send it are pretty unresponsive (it yaws really slowly even when I have the controllers yaw stick all the way to the left or right).

I love the Anafi, but I guess this issue comes down to the Anafi not being designed to be flown indoors with so many metal objects around it (resulting in a weak GPS and noisy compass readings).

Any suggestions, thoughts, or comments on anything above would be appreciated. My goal is to be able to have the Anafi fly indoors as it would outdoors. Thanks again for the help so far :slightly_smiling_face:

Hi Carl,

I just got the confirmation that this is actually a known issue and we are already working on a fix to ignore the compass readings automatically when flying near a steel structure. I’ll try to get back to you when I’ll have more information on this. I think that this fix should land in a future firmware update in a couple of months from now.

It could be nice to disable the compass/calibration with the SDK but unfortunately currently this is not possible. I’ll submit this feature idea for a future SDK release.

I’m glad you’ve found this clever workaround with the magnet but that doesn’t solve the magnetometer calibration problem anyway. I am afraid you will have to wait for a firmware release that fixes this issue.



Do we have any updates on this?
I have the same issue for indoor flights.

Hello @GoNavy ,

We’re still working on the compass readings rejection algorithm and if everything’s goes smoothly we should be able to improve the rejection of compass readings for outdoor flight (with GPS) in the next Anafi firmware release (1.6.5). I can’t give you a time-frame for this release at this point though.

For indoor flight compass readings rejection, we’re still in an early development stage and the only information I have is that it most probably won’t be in the 1.6.5 firmware release.




Hello, I have the exact same concerns about metallic or electromagnetic perturbations that fool the Anafi algorithms.
2 crashes outdoor : a wooden picnic table… but that featured a metallic frame, and my long flat bbq made of bricks… but with 3 iron bars that act like a magnet.

I was so surprised, I glued paper arrows to show the north direction given by a handheld compass. 50 cm above or below the barbecue and the north was correct. I did not print enough paper arrows, but on the left side of the BBQ, I have the ‘south pole’ of my bbq.

Anafi is a fantastic drone also for indoors survey and is much more stable than a Mavic Pro and much lighter… it would be great is we could ‘disable GPS and magnetometer over-interpretations’ by a switch when flying indoors in a metallic or electromagnetic environnement.

One example more : impossible to land on this wooden table due to a nail that conducts magnetic interferences of the table frame underneath… (Anafi jumping bouncing and refuse to shut motor)…
See compass reading around the nail…

… sorry as a new user, can’t post the images…

… seems now I can contribute adding more pictures of magnetic fields problems that make Anafi crazy when landing …