Event on received message


I’m working on a modified version of Mission Planner (I’m using Visual Studio 2019) and I would like to list every GPS position sent by the copter during a mission.

Is there an event I can use in order to get the copter position each time the GPS is refreshed ?
I can’t find the class where the Mavlink messages sent by the copter are read.

Thanks in advance.

Why would you do that. Mission Planner is logging every incoming mavlink messages in the local telemetry log (tlog), you can extract all positions from there.

Thank you for your answer.

Actually I’m using the copter to take measurements and I would like the GPS position to match the moment when the measure is taken. Where do I find the tlog ?

Usually, the path is shown in MP: CONFIG -> Planner: Log Path.
Depending on which vehicle you are using, there is the appropriate folder for it.

Found it,
Thanks !

But, is there any way I can get the raw Mavlink GPS message when it arrives ?

Nice, but I am not sure what you mean by “raw”?

By default, AP will stream out a bunch of messages like this:

Just parse and pick what you interest in.

It’s what Im looking for, but where can I get thoses messages in the code ?

I recommend using pymavlink and you may want to see the instruction here:


Thanks, I’ll check that.
So there isn’t a way to read thoses messages from the C# code ?

Mavlink provides API for C and C++. I have never tried with it with C# but this method may help

If you insist of code, don’t modify mission planner. Maintain your own fork is a pain in the *ss and MP changes a lot. Instead check the code and instructions in this post.Tank empty alert You can write a plugin with a couple of lines of code that subscribes the Mavlink OnPacketReceived event, and gets every mavlink messages that received by the ground station. Having a plugin makes you independent of the Mission Planner version, you can keep up with the new releases without change and recompile.

Well, since I already started to modify my version a few month ago… But using a plugin seems a good idea indeed.
I’ll try both !

Thank you very much !