Matlab and GPS

조회 수: 9 (최근 30일)
Shwetank
Shwetank 2012년 1월 1일
답변: Gayatri Menon 2022년 1월 5일
hi i have my globsat BU-353 gps connected via usb to matlab. i am trying to read data from it.
what i did so far was create a serial object, opened it and applied a fread method. what i got was a lot of numbers and i cannot make any sense of it.
s = serial('COM3', 'Baudrate', 4800);
fopen(s)
fread(s)
214
214
41
41
23
13
635
...
the gps is supposed to follow NMEA protocal, and i think that the data the matlab is reading from USB is the packets and the binary number and is translating them into number. (i think) but of this i am not sure
can anyone help me get the data from the USB so that its in NMEA format.
are tehre any libraries out there that can do this work. if not, can anyone direct me to proper documentation from which i can undedsratnd the information that is being read by matlab and how i can convert it to NMEA format.
thank you.
  댓글 수: 1
jibs
jibs 2020년 12월 15일
Hi
Im working on a GUI, whose purpose is to develop a system to measure distance between two work stations using GPS coordinate system.
pl guide me how can i measure distance if i get 4 GPS coordinates , two of the existing syste and two from other remote system.
moreover im drawing these coordinates on a graph, the problem is that after sometime when the points are updated, the graph shows the points in a straight line, since there is not much distance not more than 50 m.
kindly share with me a technique so that the distinguished points are shown in graph instaed of a jumbled set of points like a straight line.

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2012년 1월 1일
Try reading it as a text string using fgetl() or fscanf() or fread() with '*char' option. You may need to adjust the Terminator property of the serial port.
For interpretation of the data, see http://aprs.gids.nl/nmea/

추가 답변 (4개)

Shwetank
Shwetank 2012년 1월 1일
hey i did do fscanf() and the error i got was
Error: a matlab string constant is not terminated properly. i did look at the link u suggested, but i am not sure how to chose the right terminator
the current terminator i have it says is LF

Shwetank
Shwetank 2012년 1월 1일
편집: Randy Souza 2012년 9월 7일
I figured it out, thank you!
The terminator needed to be a *
>> fopen(s)
>> set(s, 'terminator', ',')
>> fscanf(s)
ans =
Ì3YÆ&vÆÆ&ÆÆ&&&ƦvVk
>> set(s, 'terminator', '*')
>> fscanf(s)
ans =
$GPRMC,054146.313,A,4341.0402,N,07934.1286,W,0.07,311.50,010112,,,A*7D
  댓글 수: 1
Walter Roberson
Walter Roberson 2012년 1월 1일
You should provide a format string for fscanf()
You should be using CR/LF for the terminator. The * marks an optional checksum field.
http://www.gpsinformation.org/dale/nmea.htm

댓글을 달려면 로그인하십시오.


Shwetank
Shwetank 2012년 1월 3일
you are right. fscanf(s, '%s') did the trick.
i wonder why it didnt work before :S
thank you for your help :)

Gayatri Menon
Gayatri Menon 2022년 1월 5일
Hi,
nmeaParser in Navigation toolbox can be used to parse data from GPS. Refer the following links for more info :
Hope this helps
Thanks

카테고리

Help CenterFile Exchange에서 Automotive에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by