我有GPS / GLONASS U-BLOX 7.当我运行U-Center应用程序时,它可以显示纬度和经度。但是,我需要从串口解码这个值(在python代码中添加它们)。 我的问题我找不到对接是如何工作的。 U-Center应用程序正在接收这些数据。当我搜索NMEA命令时,似乎缺少一些数据。但我想知道U-Center如何解码Lat和Long。
有人有想法吗?
以下是来自串口的GPS数据的输出:
08:58:08 $GPRMC,085808.00,V,,,,,,,211217,,,N*76
08:58:08 $GPVTG,,,,,,,,,N*30
08:58:08 $GPGGA,085808.00,,,,,0,00,99.99,,,,,,*6B
08:58:08 $GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*30
08:58:08 $GPGSV,3,1,10,03,83,342,,09,14,211,,11,35,165,,12,02,352,*78
08:58:08 $GPGSV,3,2,10,14,21,046,,17,42,279,,19,33,304,,22,67,073,*7B
08:58:08 $GPGSV,3,3,10,23,46,197,,32,01,042,*72
08:58:08 $GPGLL,,,,,085808.00,V,N*47
08:58:09 $GPRMC,085809.00,V,,,,,,,211217,,,N*77
08:58:09 $GPVTG,,,,,,,,,N*30
08:58:09 $GPGGA,085809.00,,,,,0,00,99.99,,,,,,*6A
08:58:09 $GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*30
08:58:09 $GPGSV,3,1,10,03,83,342,,09,14,211,,11,35,165,,12,02,352,*78
08:58:09 $GPGSV,3,2,10,14,21,046,,17,42,279,13,19,33,304,,22,67,073,*79
08:58:09 $GPGSV,3,3,10,23,46,197,,32,01,042,*72
08:58:09 $GPGLL,,,,,085809.00,V,N*46
08:58:10 $GPRMC,085810.00,V,,,,,,,211217,,,N*7F
08:58:10 $GPVTG,,,,,,,,,N*30
08:58:10 $GPGGA,085810.00,,,,,0,00,99.99,,,,,,*62
08:58:10 $GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*30
08:58:10 $GPGSV,3,1,10,03,83,342,,09,14,211,,11,35,165,,12,02,352,*78
08:58:10 $GPGSV,3,2,10,14,21,046,,17,42,279,,19,33,304,,22,67,073,*7B
08:58:10 $GPGSV,3,3,10,23,46,197,,32,01,042,*72
08:58:10 $GPGLL,,,,,085810.00,V,N*4E
08:58:11 $GPRMC,085811.00,V,,,,,,,211217,,,N*7E
08:58:11 $GPVTG,,,,,,,,,N*30
08:58:11 $GPGGA,085811.00,,,,,0,00,99.99,,,,,,*63
08:58:11 $GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*30
08:58:11 $GPGSV,3,1,10,03,83,342,,09,14,211,,11,35,165,,12,02,352,*78
08:58:11 $GPGSV,3,2,10,14,21,046,,17,42,279,17,19,33,304,,22,67,073,*7D
08:58:11 $GPGSV,3,3,10,23,46,197,,32,01,042,*72
08:58:11 $GPGLL,,,,,085811.00,V,N*4F
08:58:12 $GPRMC,085812.00,V,,,,,,,211217,,,N*7D
08:58:12 $GPVTG,,,,,,,,,N*30
08:58:12 $GPGGA,085812.00,,,,,0,00,99.99,,,,,,*60
08:58:12 $GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*30
08:58:12 $GPGSV,3,1,10,03,83,344,,09,14,211,,11,35,165,,12,02,352,*7E
08:58:12 $GPGSV,3,2,10,14,21,046,,17,42,279,,19,33,304,,22,67,073,*7B
08:58:12 $GPGSV,3,3,10,23,46,197,,32,01,042,*72
08:58:12 $GPGLL,,,,,085812.00,V,N*4C
08:58:13 $GPRMC,085813.00,V,,,,,,,211217,,,N*7C
答案 0 :(得分:0)
嗯,经过多次测试后,我发现它在某个时刻接收到了GPGLL: $ GPGLL,4908.59700,N,00912.84108,E,122829.00,A,A * 6A 使用NMEA格式我可以提取我的Lat和Lon,但是我仍然不知道U-Center是如何得到这个值的,但我认为他们显示的是最后收到的位置。 如果有人有任何想法,如果你与我分享,我将不胜感激。 感谢
答案 1 :(得分:0)
您的日志中包含以下NMEA语句:
(标签前面的GP字母是说话者ID,在此处不相关。)
VTG是一个包含速度和课程的句子,在这里不相关。 GSV显示视野中的卫星数量,不能用于提取位置。
因此,当您想要找到经度和纬度时,您可以在RMC,GGA和GLL之间进行选择。它们通常具有以下格式:
<强> RMC 强>
$GPRMC,123519,A,4807.038,N,01131.000,E,022.4,084.4,230394,003.1,W*6A
Where:
RMC Recommended Minimum sentence C
123519 Fix taken at 12:35:19 UTC
A Status A=active or V=Void.
4807.038,N Latitude 48 deg 07.038' N
01131.000,E Longitude 11 deg 31.000' E
022.4 Speed over the ground in knots
084.4 Track angle in degrees True
230394 Date - 23rd of March 1994
003.1,W Magnetic Variation
*6A The checksum data, always begins with *
如果我们将定义与您的一个句子匹配:
$GPRMC,085808.00,V,,,,,,,211217,,,N*76
我们可以看到修复是在UTC时间08:58进行的,但信号现在无效(无效)。这些字段为空,因为您没有修复。如果你确实有修复,你会看到与定义中相似的数字。
<强> GGA 强>
$GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47
Where:
GGA Global Positioning System Fix Data
123519 Fix taken at 12:35:19 UTC
4807.038,N Latitude 48 deg 07.038' N
01131.000,E Longitude 11 deg 31.000' E
1 Fix quality: 0 = invalid
1 = GPS fix (SPS)
2 = DGPS fix
3 = PPS fix
4 = Real Time Kinematic
5 = Float RTK
6 = estimated (dead reckoning) (2.3 feature)
7 = Manual input mode
8 = Simulation mode
08 Number of satellites being tracked
0.9 Horizontal dilution of position
545.4,M Altitude, Meters, above mean sea level
46.9,M Height of geoid (mean sea level) above WGS84
ellipsoid
(empty field) time in seconds since last DGPS update
(empty field) DGPS station ID number
*47 the checksum data, always begins with *
如果我们将定义与您的一个句子匹配:
$GPGGA,085808.00,,,,,0,00,99.99,,,,,,*6B
我们可以看到修复质量为0并且您没有修复。 GPS单元在经度和纬度字段中发送空白值。
<强> GLL 强>
$GPGLL,4916.45,N,12311.12,W,225444,A,*1D
Where:
GLL Geographic position, Latitude and Longitude
4916.46,N Latitude 49 deg. 16.45 min. North
12311.12,W Longitude 123 deg. 11.12 min. West
225444 Fix taken at 22:54:44 UTC
A Data Active or V (void)
*iD checksum data
如果我们将定义与您的一个句子匹配:
$GPGLL,,,,,085808.00,V,N*47
这句话也是 void ,意思是没有发送经度或纬度。
因此,当您开始接收正确的数据时,日志看起来更像我列出的定义。数据活动标志将从 V 切换到 A ,字段将具有值而不是空。你可能不得不到外面去获得一个很好的信号。要提取数据,您必须在RMC,GGA或GLL语句之间进行选择:它们都包含您要查找的内容。
要在Python中实际解析数据,您可以使用pynmea2,micropyGPS等类似的库。或者你可以自己编写逻辑。
自己编写逻辑应该很简单。只需将,
的电报拆分为拆分字符即可。最后一个字段也必须与*
分开,以分隔字段和校验和。