I had the same question, and didn't find anything written, so I source-dived the code and wrote my own. I have it posted on my public github so you're welcome to check it out if it's useful.
I'm not a dev, so things may be wrong. I also didn't dig too deeply into aspects that didn't interest me, so... something is better than nothing, right?
To the devs: I've found this for copter, but it's not perfect. Does anything like this exist for plane? If not, shall I start a wiki and make one based on my notes so far?