What's the easiest way to view GPS data at the rpi CLI?


#1

I’ve been trying to find a solution to view gps data from the rpi cli.

Does the pixhawk have a output file? I found something about GPS_Dump but I don’t think it’s on the 2.4.8 pix.

Can I monitor a serial port for this?


How do i get a stream of GPS data from mavproxy in Linux?
#2

Check the tlog file for gps data. You can use MP or offline tools to view.

https://ardupilot.org/mavproxy/docs/analysis/mavtools.html

https://ardupilot.org/copter/docs/common-mission-planner-telemetry-logs.html

For real-time monitoring you can see position data with mavproxy commands using

status GLOBAL_POSITION_INT

I wasn’t able to figure out how to extract just lat or lon data from this dictionary, but if you do perhaps you could use the graph module to output it real-time.

You can also monitor output with Mission Planner, python or mavlink code.

With python you could set up a socket to monitor data sent to a laptop. You would create a vehicle object and use something like

lat = vehicle.location.global_frame.lat

which you could store, print or send.

A mavlink example might include

from pymavlink import mavutil

#Start a connection listening to a UDP port

vehicle = mavutil.mavlink_connection(‘udpin:localhost:14551’)

#Wait for the first heartbeat
#This sets the system and component ID of remote system for the link

vehicle.wait_heartbeat()

print(“Heartbeat from system (system %u component %u)” % (vehicle.target_system, vehicle.target_component))

while 1:
msg = vehicle.recv_match(type=‘GLOBAL_POSITION_INT’,blocking=True)
print(msg)

I have also taken GPS csv data and later plotted it on Google Earth as a kml file.


#3

In case anyone was trying to parse lat long:

lat = vehicle.field('GLOBAL_POSITION_INT', 'lat', 0) * 1.0e-7
lon = vehicle.field('GLOBAL_POSITION_INT', 'lon', 0) * 1.0e-7
print(lat)
print(lon)