How to Program Parrot AR.Drone to Fly Straight

I am using node.js & node-ar-drone to program my AR.Drone 2.0 to perform some basic flight maneuvers indoors. From what I can tell, the drone seems to never fly straight. It will always sway to the left and right, hover for a few seconds, or crash into a wall regardless of where I set the takeoff point from. In other words, if I run the same program to fly down a hallway 10 times, each time it will do something different.

If it does make it down a hallway it will land somewhere different each time. I would have built-in counter moves to adjust for the random swaying such as if it sways to the right, I would tell it to shift to the left, but it never seems to be enough. No amount of counter moves seems to get it to fly straight. I am using the latest firmware on the drone.

  • Saving AR-Drone 2.0 Video Stream Using Node JS
  • I was told that there is nothing on board the drone that corrects errors during flight, such as a feedback loop. In addition to this I was also told that these drones were primarily made for use outdoors or in very wide open spaces such that it wont crash.

    I wanted to see if this held true with anyone else or if anyone had any suggestions to get it to fly straight. Any input or comment would be helpful

  • Saving AR-Drone 2.0 Video Stream Using Node JS
  • One Solution collect form web for “How to Program Parrot AR.Drone to Fly Straight”

    The AR.Drone does use feedback from its combination of sensors to improve its flight, as seen in this diagram (from “The Navigation and Control technology inside the AR.Drone micro UAV”):

    enter image description here

    For your situation, probably the most important thing is how well attitude and speed estimation is working, which uses the accelerometers, gyrometers and cameras. There are a few things you can do to help those systems work:

    1. Make sure you take off from a completely level surface.
    2. Call ftrim to set the flat trim level before taking off.
    3. The vision algorithms are designed to try to do a good job even if the surface under the downward-facing camera doesn’t have very much texture, but they still can get confused if the floor/ground is too featureless. Try flying over something with more texture and contrast.

    For #3, flying over something like a uniformly colored carpet or a concrete floor can make it harder for the drone to see what it’s doing–very similar to the problem of using an optical mouse on a smooth, featureless surface. When you see Parrot showing off the AR.Drone’s abilities, you’ll notice they often fly over a surface that is obviously chosen to make navigation easier. E.g.,

    From https://www.youtube.com/watch?v=IcxBf-kegKo:
    enter image description here

    From https://www.youtube.com/watch?v=pEMD6P_j5uQ#t=8m25s:
    enter image description here

    That said, with my drone I’ve sometimes experienced situations where immediately on takeoff, the drone veers off to the side until it crashes even though I called ftrim and thought I took off from a flat surface. You may need to use trial and error to find a good takeoff point.

    The drone is designed to be able to fly indoors (e.g. the styrofoam hull with the propeller protectors is recommended for indoor flight but not recommended for outdoor flight, and the FreeFlight app has indoor & outdoor flight modes), but in my experience the drone still wanders a bit and so you’ll have the best results in a larger room.

    Here’s a demo where my drone flies in a very stable manner indoors, in a large room, with well textured carpet, from a very flat location: https://www.youtube.com/watch?v=uhBa11gdbeU

    enter image description here

    Even then you can see the drone make a small, quick correction at 0:23.