Recently, a customer asked for a GPS Vehicle Monitoring System to display the location of a car on an electronic map in real time. He had never been in touch with it before and learned from the beginning.
First, you must understand the GPS signal format and transmission method. Otherwise, how can you use a program to get the coordinates of the car. Internet g, GPS terminal models and performance vary, but their serial GPS positioning information output format mostly adopted the National Ocean Electronics Association developed NMEA-0183 communication standard format. The output data uses ASCII codes, which contain longitude, dimension, height, speed, date, time, course, satellite status, and other information. There are 6 commonly used statements, including GGA, GlL, GSA, GSV, RMC, and Vtg.
The following describes the meaning of each statement.
GPS-NMEA0183 format
Note: The nmea0183 format starts with "$". The main statements include gpgga, gpvtg, and gpmc.
1. gps dop and active satellites (GSA) current satellite information
$ Gpgsa, <1>, <2>, <3>, <3>, <3>, <3>, <4>, <5>, <6>, <7> <CR> <LF>
<1> mode: M = manual, a = automatic.
<2> positioning type 1 = undetermined, 2 = 2D, 3 = 3D.
<3> PRN number: Number of the satellites used in the sky from Table 01 to Table 32. Up to 12 satellites can be received.
<4> position precision factor of pdop (0.5 ~ 99.9)
<5> hdop horizontal precision factor (0.5 ~ 99.9)
<6> vdop vertical precision factor (0.5 ~ 99.9)
<7> checksum. (check bit ).
2. GPS satellites in view (GSV) Satellite Information $ gpgsv, <1 >,< 2 >,< 3 >,< 4 >,< 5 >,< 6>, <7> ,? <4>, <5>, <6>, <7>, <8> <CR> <LF>
<1> total number of GSV statements
<2> the number of GSV in this sentence
<3> total number of visible satellites: 00 to 12.
<4> Satellite Number, ranging from 01 to 32.
<5> satellite elevation, ranging from 00 to 90 degrees.
<6> satellite azimuth, ranging from 359 to degrees. The actual value.
<7> signal-to-noise ratio (C/no), 00 to 99 dB; no table does not receive signals.
<8> checksum. (check bit ).
<4>, <5>, <6>, <7> some satellites are repeated. Each row has a maximum of four satellites. Other satellite information will appear in the next row. if not used, these fields will be blank.
3. Global Positioning System Fix Data (GGA) GPS Positioning Information
$ Gpgga, <1 >,< 2 >,< 3 >,< 4 >,< 5 >,< 6 >,< 7 >,< 8 >,< 9>, m, <10>, M, <11>, <12> * hh <CR> <LF>
<1> UTC time, hhmmss (hour/minute/second) Format
<2> latitude ddmm. Mmmm (degree) format (the preceding 0 will also be transmitted)
<3> latitude hemisphere N (northern hemisphere) or S (Southern Hemisphere)
<4> longitude dddmm. Mmmm (degree) format (the preceding 0 will also be transmitted)
<5> longitude hemisphere E (eastern longitude) or W (Western longitude)
<6> GPS status: 0 = undetermined, 1 = non-differential positioning, 2 = differential positioning, 6 = estimating
<7> Number of satellites at the resolution position being used (00 ~ 12) (the previous 0 will also be transmitted)
<8> hdop horizontal precision factor (0.5 ~ 99.9)
<9> altitude (-9999.9 ~ 99999.9)
<10> height of the earth's elliptical sphere relative to the geolevel
<11> differential time (the number of seconds from the last time the difference signal was received. If the difference is not located, it will be blank)
<12> ID number of the differential substation: 0000 ~ 1023 (the previous 0 will also be transmitted, if not differential positioning will be blank)
4. recommended minimum specific GPS/transit data (RMC) recommended positioning information
$ Uplmc, <1>, <2>, <3>, <4>, <5>, <6>, <7>, <8>, <9>, <10>, <11>, <12> * hh <CR> <LF>
<1> UTC time, hhmmss (hour/minute/second) Format
<2> positioning status, A = valid, V = invalid
<3> latitude ddmm. Mmmm (degree) format (the preceding 0 will also be transmitted)
<4> latitude hemisphere N (northern hemisphere) or S (Southern Hemisphere)
<5> longitude dddmm. Mmmm (degree) format (the preceding 0 will also be transmitted)
<6> longitude hemisphere E (eastern longitude) or W (Western longitude)
<7> ground speed (000.0 ~ Section 999.9, the previous 0 will also be transmitted)
<8> ground heading (000.0 ~ 359.9 degrees. Based on the reference of zhenbei, the preceding 0 will also be transmitted)
<9> UTC date, in ddmmyy format
<10> magnetic angle (000.0 ~ 180.0 degrees, the previous 0 will also be transmitted)
<11> magnetic angle direction, E (East) or W (West)
<12> mode indication (output only in nmea0183 3.00, A = self-locating, D = differential, E = estimation, n = Invalid Data) 5. Track made good and ground speed (Vtg) ground speed information $ gpvtg, <1>, T, <2>, M, <3>, N, <4>, k, <5> * hh <CR> <LF> <1> ground heading based on zhenbei (000 ~ 359 degrees, the previous 0 will also be transmitted)
<2> ground heading (000 ~ 359 degrees, the previous 0 will also be transmitted)
<3> ground speed (000.0 ~ Section 999.9, the previous 0 will also be transmitted)
<4> ground speed (0000.0 ~ 1851.8 km/hour, the front 0 will also be transmitted)
<5> mode indication (output only in nmea0183 3.00, A = self-locating, D = differential, E = estimation, n = Invalid Data)
After learning about the format, I can easily explain it. There are a lot of classes on the Internet that can interpret these statements. You can use them if you are too lazy to download and modify them.
If you have software and no hardware, you can make it easy! Hey, fortunately, the customer provided a vehicle-mounted GPS terminal device, and then we can test it.
The on-board gps I used requires a SIM card to support access through cmnet. For this reason, I have activated the GPRS function for my mobile phone card and initialized the on-board GPS terminal, connect to the terminal and use the server-side acceptance testing tool to test the connection ...... no? I have no data and can't connect to the server. I have asked the dealer to know that the SIM card of this GPS terminal only supports the cmnet network, and mine is the cmwap! Put on another person's card and wait a few seconds until the data finally comes out.
The test program that comes with me can only accept data for display. To contact the electronic map, I have to write the program myself. I have written a program for receiving the program, which uses the TCP connection method, if the test fails, only one terminal number can be received, and no data is displayed. The reason is not found. In another way, set the terminal to a UDP protocol, I used the UDP protocol to write a receiving program again, and it actually solved the problem. Seeing that the receiving area showed a series of data, it was finally completed. However, I have never understood why the TCP connection method is not good.
Connect the GPS terminal to the car and turn it around. The effect is not bad. The error is within 10 meters. It may also be related to the accuracy of the map.