3D Robotics

Setting up ArduPilot for autonomous flight

ArduPilot has two modes: programmed waypoints and return-to-launch (RTL). In the first one, you enter in GPS Latitude and Longitude coordinates of your waypoints into the code with the Arduino IDE. In the second, you don't enter in any waypoints and the aircraft just returns to the Lat/Lon it was at when you first powered on the board (at your launch location). I fyou're using ArudPilot 2.1 or above, you can set it up with a desktop utility, as described here. If you're using 1.0 to 2.0.1, you need to do it by hand. Here's the process: 1) Go into Google Maps, satellite view, and right click on the location you want to be your waypoint. Select "Center map here", then click on the "link" icon in the top right corner. You'll see a URL come up, which contains your Lat and Lon. Copy each one and past them the "wp-lat" and "wp_lon" declaration for that waypoint in the Mission Setup tab of the ArduPilot code. Continue until you've got all the waypoints. Add as many waypoints as you want, but remember to set the "waypoints" definition in the first tab to the number of waypoints you're using. [Again, this will all get easier and more intuitive in the next version of the code] The altitude is relative to the initial launch position, not above sea level. So if your airfield is 500 meters above sea level and you enter "500" as the waypoint altitude, the plane will fly at 1,000 meters above sea level (but just 500 meters above you). 2) If you just want to have ArduPilot Return To Launch, then go to the first tab in the code and look for "#define RTL 0". This is the RTL flag. Set it to 1 if you want the plane to just RTL, or 0 if you want it to follow the waypoints in the Mission Setup tab. Once you've got the waypoints and settings the way you want them, upload the code to the board. Unplug the GPS module if it was connected, plug in the FTDI cable and click on the upload to I/O board icon on the Arduino IDE. Once it's uploaded, you can reconnect the GPS module. 3) Now it's time to set up your FMA Co-Pilot. Follow the setup instructions that came with it. At the airfield, calibrated it and fly a bit to get a feel for how much gain to give it (using your proportional control on the transmitter). Once it's stable, try turning on the Co-Pilot and then turning the plane using just the rudder. It should "skid" around turns with a bit of rocking as the Co-Pilot tries to keep the wings level as the rudder yaws the plane. What you're doing is manually testing what the ArduPilot will do under autonomous control. 4) Once that is set up, it's time to try an autonomous flight. Take off manually, and get to the altitude you want to run the course at. Turn on the FMA co-pilot and ensure that it's working. Now flip the ArduPilot control switch (your channel 5 or 6 toggle, depending on how you've set it up.) The aircraft should navigate to the first waypoint. If anything seems to be going wrong, remember that you can always override the the FMA Co-Pilot with your aileron and elevator sticks. Even if ArduPilot has done something very wrong with the rudder and throttle, you should be above to regain control and bring the aircraft back to you. Once the aircraft is back in control, turn the autopilot off and you will regain control of the rudder and throttle so you can land and diagnose the problem.
E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones


  • hi Chris ,

    i wanted to ask you a few questions regarding buying hardware for my hardware in the loop simulation using the Ground station and Ardupilot Board.
    1.Do i require XYZ Sensors ( as i would not be getting any inputs while in doing the simulation)
    2.Should i buy a GPS Module(the board is stationary throughout the whole simulation Exercise)
    3.I m planning to interface the Ardupilot with Xplane using the FTDI cable and UDP so please tell me the relevant hardware i would require
  • Alright . Thanks !!
  • 3D Robotics
    Well, for starters, don't look to these ancient posts. Start with the current manual. There is a section on simulation there.
  • Hi ,

    I am a beginner here. The Project i am working is on Implementing ILS using Arduino , X-Plane . what hardware's do i require to do this simulation . Arduboard , GPS module . and how do i get started with the whole simulation .

  • 3D Robotics
    @Hessel: Thanks again for catching those. That's just the list of blog posts, which is mostly for archival purposes, and is a pain to maintain when titles change. But I have corrected those two.
  • Thanks Chris, just in time for my first test flight just before dusk yesterday evening;->

    "Using ArduPilot 2.x in the field" is not linked from the Home page, it is an update to "Instructions for calibrating ArduPilot 2.0 in the field" I guess but that link is dead (because of the addition of 2.1 probably). The text "Settings you can change from within the ArduPilot code" on the home page is not a link (yet) but the article is there.
  • 3D Robotics
    It's here. All these posts are linked to from the ArduPilot home page. You can always go to that for the latest version of everything.
  • Where did the "Instructions for calibrating ArduPilot 2.0 in the field" topic go ?
  • 3D Robotics
    Yes, you can use ArduPilot with a simulator. Search this site to see many different kinds.
  • can I simulate all these flights on the computer (if I have an EasyStar)?
This reply was deleted.