简体   繁体   English

GPS FIX 数据,从 com 端口读取

[英]GPS FIX data, reading from com Port

I'm creating a very simple application to read the info from a GPS in java.我正在创建一个非常简单的应用程序来从 java 中的 GPS 读取信息。 The information is sent on the COM1 in the NMEA0183 format.信息以 NMEA0183 格式在 COM1 上发送。

Everything works good except that I can't find my position because the RMC and GGA sentence are empty.一切都很好,除了我找不到我的 position 因为 RMC 和 GGA 句子是空的。 I receive other sentence with the satellite informations and positioning, but all I want is my current position (long/lat).我收到其他带有卫星信息和定位的句子,但我想要的只是我当前的 position(长/纬度)。 when I check the data in hyper terminal the data is comming.当我在超级终端中检查数据时,数据正在到来。

Here is some example of what I currently receive:以下是我目前收到的一些示例:

$GPGGA,,,,,,0,00,,,M,,M,,*66
$GPVTG,0.0,T,,,000.0,N,000.0,K,A*40
$GPGSA,M,1,,,,,,,,,,,,,-1.0,-1.0,-1.0*10
$GPGGA,,,,,,0,00,,,M,,M,,*66
$GPVTG,0.0,T,,,000.0,N,000.0,K,A*40
$GPGSV,2,1,08,03,00,000,,06,00,000,,11,00,000,,14,00,000,*72
$GPGSV,2,2,08,19,00,000,,20,00,000,,22,00,000,,24,00,000,*7D
$GPGSA,M,1,,,,,,,,,,,,,-1.0,-1.0,-1.0*10
$GPGGA,,,,,,0,00,,,M,,M,,*66
$GPVTG,0.0,T,,,000.0,N,000.0,K,A*40
$GPGSV,3,1,12,03,21,351,,06,13,004,,11,55,235,,14,47,126,*78
$GPGSV,3,2,12,19,49,331,,20,19,272,,22,24,115,,24,41,227,*75
$GPGSV,3,3,12,31,16,048,,32,43,267,,09,00,160,,12,00,129,*71
$GPGSA,M,1,,,,,,,,,,,,,-1.0,-1.0,-1.0*10
$GPGGA,,,,,,0,00,,,M,,M,,*66
$GPVTG,0.0,T,,,000.0,N,000.0,K,A*40
$GPGSV,3,1,12,03,21,351,,06,13,004,,11,55,235,,14,47,126,*78
$GPGSV,3,2,12,19,49,331,,20,19,272,,22,24,115,,24,41,227,*75
$GPGSV,3,3,12,31,16,048,,32,43,267,,09,00,160,,12,00,129,*71
$GPGSA,M,1,,,,,,,,,,,,,-1.0,-1.0,-1.0*10
$GPGGA,,,,,,0,00,,,M,,M,,*66
$GPVTG,0.0,T,,,000.0,N,000.0,K,A*40
$GPGSV,3,1,12,03,21,351,,06,12,004,,11,55,235,,14,47,126,*79
$GPGSV,3,2,12,19,49,331,,20,19,272,,22,24,115,,24,41,227,*75
$GPGSV,3,3,12,31,16,048,,32,43,267,,09,00,160,,12,00,129,*71
$GPGSA,M,1,,,,,,,,,,,,,-1.0,-1.0,-1.0*10

And I also hav a probleam to check the GPS device is connected or not to the computer.而且我也有一个问题来检查 GPS 设备是否连接到计算机。 I am using rxtxcomm.jar for com port reading.我正在使用 rxtxcomm.jar 进行 com 端口读取。

Code for opening com port is as following打开 com 端口的代码如下

CommPortIdentifier port_id = CommPortIdentifier.getPortIdentifier(serial_port_name_);
serial_port = (SerialPort)port_id.open("Gps",2000);
serial_port.setFlowControlMode(SerialPort.FLOWCONTROL_RTSCTS_IN);
serial_port_.setSerialPortParams(speed,
                             SerialPort.DATABITS_8,
                             SerialPort.STOPBITS_1,
                             SerialPort.PARITY_NONE);

According to the GSV sentences, you have no signal from any of the satellites in the list (signal to noise ratio field for all of them is empty).根据 GSV 语句,您没有来自列表中任何卫星的信号(所有卫星的信噪比字段为空)。 You won't get position information until you get some signal strength.在您获得一些信号强度之前,您不会获得 position 信息。 The GPS receiver needs to be outside ideally, but it might work if you put it next to a window.理想情况下,GPS 接收器需要放在室外,但如果将其放在 window 旁边,它可能会起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM