Where is the Auto Waypoint Code on Github

I want write a program to create a mission file for a square flight plan after inputting a few variables like the starting position, initial heading and distance of first leg. The mission would make a series of reducing right turns until the entire area is covered. Sites like http://williams.best.vwh.net/avform.htm#LL go into detail on waypoint projection formulas, but the output does not match the missions I have created manually in Mission Planner and the lat/lon coordinates. I’m hoping if I look at the Auto-WP code I can figure out how you have tackled the problem. I’ve trolled through a number of the folders on Github, but have not been able to find the code yet.

Any help is appreciated.

This link should help http://ardupilot.org/plane/docs/common-mavlink-mission-command-messages-mav_cmd.html

The behaviour also depends on the vehicle you a flying

see https://github.com/ArduPilot/ardupilot/tree/master/libraries/AP_Mission for the code

Thanks, but that is more about the format and sending the data once the waypoint has been calculated.

I’m specifically looking for the code that gets executed when Auto WP -> Survey(Grid) is used after the Draw Polygon feature is used. The closest I have found to code actually calculating waypoints is libraries/AC_WPNav/AC_WPNav.cpp where AC_Circle references pythagorous2, but that is not what I’m looking for.

You need to look Mission Planner sources and Survey grid waypoints are all done in MP.

Thanks. Does that mean somewhere in this list of folders? https://github.com/ArduPilot/MissionPlanner? Any chance you can share which one? Or advice on how to find the right one?

Yes that is correct. @meee1 could be best to tell exact location as he created Mission Planner. I took a quick look inside code and it looks like it’s more or less in here:
https://github.com/ArduPilot/MissionPlanner/blob/master/GCSViews/FlightPlanner.cs

Thanks a bunch. Found what I was looking for.