Trying to catch GPS coordinates


I’m trying to aquire GPS coordinates from APM. I tried to use some methods from the code without success, then I tried to include the Ublox library at APM to get this coordinates. I had success using it, but what I really want is to get values for X and Y displacements in meters, is it possible to get? I also would like to have the NED speeds, if its possible.

thank you,


Hi Rafael,
Easiest way to get coordinates from APM is to read them from MAVLink using MAVProxy or your own code.

Hi mikhailavkhimenia,

Thank you for helping, but I don’t understand how to catch the mavproxy information in my code. what I saw at the documentation is that mavproxy sends information to a selected IP on network. I’m trying to catch the coordinates, put it together with another parameters and save it on a .CSV file at a directory in RPi.

what’s the best to do it? (I’m programing in C++)

APM (or MAVProxy) can send MAVLink on a local port, so you can read it directly on Raspberry.
You can open that port in C++, parse the MAVLink protocol and extract the coordinates from the corresponding GPS message.

Hello mikhailavkhimenia,

I followed this tutorial:
and looked better in the developers enviroment:

But I didn’t had success while installing mavproxy, when I type “python build install --user” I receive an error and I cannot install pymavlink and I’m not able to run MAVProxy because it cannot load the modules.

can you help me again?

I would make sure your raspi is up to date with upgrades and updates.

apt-get install upgrade
apt-get install update

Then try again.

The commands were fine, but I still cannot install the mavproxy.

I’m trying to use the functions inertial_nav.getposition() and inertial_nav.getvelocity()
I don’t receive de X and Y coordinates, only the Z. the velocities seems to be wrong too.


I’ve been trying to figure out how to send MAVLink on local port and I am not sure how to do it. In particular, I would like to send MAVLink both to Mission Planner and to Raspberry Pi itself (to extract the coordinates parsing the protocol).

  • Do I need to use two telemetries when I start ArduCopter (i.e. -A for the GCS with Mission Planner and -C for the local port)?
  • Or do I need to send the MAVLink through Mission Planner?

I would really appreciate any help!!! :smile:

@mariagf there are numerous ways to do that, using two telemetry options may be the simplest of them. Just specify as IP port for one of telemetries.

Great! I will try that then!

Hey! Did you managed to obtain the MAVlink data? How?