Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed info #109

Open
suitor80 opened this issue Jun 6, 2020 · 1 comment
Open

Speed info #109

suitor80 opened this issue Jun 6, 2020 · 1 comment

Comments

@suitor80
Copy link

suitor80 commented Jun 6, 2020

Hi
I'm a newbie. Is there a way to parse speed information from NMEA? And add it to print statement. I know gpsmon shows speed. I was thinking of something like msg.speed_ms or msg.speed_kmh

@fohrloop
Copy link

fohrloop commented Jul 9, 2020

Hello, @suitor80

I think questions like this are better suited as Stackoverflow questions, but here's a simple example. You probably want to look at the VTG NMEA Sentences, such as GPVTG (GPS) or GNVTG (multi-GNSS). Here is an example of parsing such NMEA message

In [1]: import pynmea2

In [2]: msg = pynmea2.parse("$GPVTG,77.52,T,,M,0.004,N,0.008,K,A*06\r\n")

In [3]: msg
Out[3]: <VTG(true_track=77.52, true_track_sym='T', mag_track=None, mag_track_sym='M', spd_over_grnd_kts=Decimal('0.004'), spd_over_grnd_kts_sym='N', spd_over_grnd_kmph=0.008, spd_over_grnd_kmph_sym='K', faa_mode='A')>

# Speed km/h
In [4]: msg.spd_over_grnd_kmph
Out[4]: 0.008

# Course over ground (degrees) 0 to 359, wrt. True north
In [5]: msg.true_track
Out[5]: 77.52

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants