GPS NMEA(0183)通讯协议解析(还有几个很简单的就没解了)(0分)

  • 主题发起人 主题发起人 吕雪松
  • 开始时间 开始时间

吕雪松

Unregistered / Unconfirmed
GUEST, unregistred user!
//Fix Data
//Example
//$GPGGA,235947.000,0000.0000,N,00000.0000,E,0,00,0.0,0.0,M,,,,0000*00
//$GPGGA,092204.999,4250.5589,S,14718.5084,E,1,04,24.4,19.7,M,,,,0000*1F
procedure TCommForm.DoSentence_GPGGA(Sentence : string);
var
XX,YY :do
uble;
TimeStr : String;
TX,TY : string;
begin

TY := GetStrItem(Sentence,',',3);
TX := GetStrItem(Sentence,',',5);
XX := 0.0;
YY := 0.0;
if (TY <> '') and (TX <> '') then
begin

YY := StrToFloat(TY);
XX := StrToFloat(TX);
//'直接端口连接'以后改成本窗口选择的设备名称
MainForm.UpdateCarList('D','端口' + ComboBox2.Text + '设备',TimeStr,'1','0',XX/100,YY/100);
end;


IsLocated(XX,YY);

TimeStr := GetStrItem(Sentence,',',2);
UpdateTimeInfo(TimeStr);

UpdateCurStar(GetStrItem(Sentence,',',8));

UpdateXYInfo(XX,YY,GetStrItem(Sentence,',',6),GetStrItem(Sentence,',',4));
UpdateHDOPInfo(GetStrItem(Sentence,',',9));
UpdateDGPSInfo(GetStritem(Sentence,',',14),GetStrItem(GetStritem(Sentence,',',15),'*',1));
UpdateElevation(GetStrItem(Sentence,',',10));
end;


procedure TCommForm.DoSentence_GPGLL(Sentence : string);
var
XX,YY :do
uble;
TimeStr : String;
TX,TY : string;
begin

TY := GetStrItem(Sentence,',',2);
TX := GetStrItem(Sentence,',',4);
XX := 0.0;
YY := 0.0;

if (TY <> '') and (TX <> '') then
begin

YY := StrToFloat(TY);
XX := StrToFloat(TX);

//'直接端口连接'以后改成本窗口选择的设备名称
MainForm.UpdateCarList('D','端口' + ComboBox2.Text + '设备',TimeStr,'1','0',XX/100,YY/100);
end;

IsLocated(XX,YY);

UpdateXYInfo(XX,YY,GetStrItem(Sentence,',',5),GetStrItem(Sentence,',',3));
UpdateTimeInfo(GetStrItem(Sentence,',',6));
end;


//目前可用的卫星
//$GPGSA,A,3,04,05,,09,12,,,24,,,,,2.5,1.3,2.1*39
procedure TCommForm.DoSentence_GPGSA(Sentence : string);
var
ID : string;
Mode1,Mode2 : string;
I : integer;
begin

ID := Trim(GetStrItem(Sentence,',',2));
if ID = 'A' then
Mode1 := 'Auto 2D/3D' else
if ID = 'M' then
Mode1 := 'Forced 2D/3D';
ID := Trim(GetStrItem(Sentence,',',3));
if ID = '1' then
Mode2 := 'No Fix' else
if ID = '2' then
Mode2 := '2D' else
if ID = '3' then
Mode2 := '3D';

InitializeSignal;
for I := 4 to 15do
begin

ID := Trim(GetStrItem(Sentence,',',I));
UpdateActiveStar(I - 3,ID);
end;

UpdatePDOPInfo(GetStrItem(Sentence,',',16));
UpdateHDOPInfo(GetStrItem(Sentence,',',17));
UpdateVDOPInfo(GetStrItem(Sentence,',',18));
end;


procedure TCommForm.InitializeSignal;
var
I : integer;
begin

for I := 0 to 11do
begin

if ChannelList.Shape.Brush.Color = clBtnFace then
begin

ChannelList.Shape.Visible := FALSE;
ChannelList.Shape.Height := 0;
ChannelList.Shape.Top := 168 - ChannelList.Shape.Height;
ChannelList.Label_.Caption := '';
ChannelList.Shape.Visible := TRUE;

// Refresh;
end;

ChannelList.Shape.Brush.Color := clBtnFace;
end;

end;


procedure TCommForm.DoSentence_GPGSV(Sentence : string);
var
SeqNum : integer;
Star : TGeoStar;
TempInt,I : integer;
SNRStr : string;
SID : string;
begin

//得到报文数
MsgCount := StrToInt(GetStrItem(Sentence,',',2));
//当前报文序号
SeqNum := StrToInt(GetStrItem(Sentence,',',3));
if SeqNum = 1 then
begin

StarAmount := 0;
for I := 0 to StarList.Count - 1do
begin

TGeoStar(StarList.Items).Free;
end;

StarList.Clear;
end;

//得到可视未星数
StarInView := StrToInt(GetStrItem(Sentence,',',4));

TempInt := StarInView - StarAmount;
if TempInt > 4 then
TempInt := 4;
for I := 1 to TempIntdo
begin

Star := TGeoStar.Create;
SID := GetStrItem(Sentence,',',I * 4 + 1);
if SID <> '' then
begin

Star.ID := StrToInt(SID);
Star.Elevation := GetStrItem(Sentence,',',I * 4 + 2);
Star.Azimuth := GetStrItem(Sentence,',',I * 4 + 3);
if I = TempInt then

SNRStr := GetStrItem(GetStrItem(Sentence,',',I * 4 + 4),'*',1)
else

SNRStr := GetStrItem(Sentence,',',I * 4 + 4);

if Trim(SNRstr) = '' then
SNRStr := '0';
Star.SNR1 := StrToInt(SNRStr);
Star.ChannelID := I + StarAmount;
StarList.Add(Star)
end;

end;

Inc(StarAmount,TempInt);
if SeqNum = MsgCount then
begin

//更新卫星信息
//已经接收的卫星数量重新置为0
UpdateStarInfo;
end;

end;


procedure TCommForm.DoSentence_GPRMC(Sentence : string);
var
XX,YY :do
uble;
TimeStr : String;
TX,TY : string;
begin

TY := GetStrItem(Sentence,',',4);
TX := GetStrItem(Sentence,',',6);
XX := 0;
YY := 0;
if (TY <> '') and (TX <> '') then
begin

YY := StrToFloat(TY);
XX := StrToFloat(TX);
//'直接端口连接'以后改成本窗口选择的设备名称
MainForm.UpdateCarList('D','端口' + ComboBox2.Text + '设备',TimeStr,'1','0',XX/100,YY/100);
end;

IsLocated(XX,YY);

TimeStr := GetStrItem(Sentence,',',2);
UpdateXYInfo(XX,YY,GetStrItem(Sentence,',',7),GetStrItem(Sentence,',',5));
end;

 
好东西,踢一脚!^_^
 
请问一下吕雪松有关于gps的定位原理?(使用mapinfo地图)
 
还有顺便问一下那里有这方面的资料呢?万分谢谢
 
刚才看了你发的上海地图配准函数,请问依据是什么。
 
gps定位的原理就是利用三颗以上的卫星,确定三个交叉的平面,三个平面的交点就是定位
的位置。

网上的资料很多,我们目前也在编写相关的资料,到时会通知大家的。

上海坐标系的配准依据是上海坐标系的投影公式。
 
上海地图配准函数在哪里有?
 
吕雪松。。这方面的资料什么时候可以知道呀
 
GPS方面的资料给我们菜人也发一份呀.
nzfboy@21cn.com
 
上海的配准参数和函数到上海测绘院去要。
 
请问误差怎么处理的?
 
后退
顶部