📄 ogr_msgdump.c
字号:
/* ************************************************************************ * * * OpenGPS Receiver * * * * -------------------------------------------------------------------- * * * * Module: ogr_msgdump.c * * * * Version: 0.1 * * * * Date: 14.07.03 * * * * Author: G. Beyerle * * * * -------------------------------------------------------------------- * * * * Copyright (C) 2003 G. Beyerle * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the Free Software * * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * * * -------------------------------------------------------------------- * * * * Dump nav data and pseudoranges to file * * * ************************************************************************ *//* ******************************* changes ******************************** 02.04.03 - ************************************************************************ *//*-----------------------------------------------------------------message id 0x1a ofs type quantity -------------------------- 0 char PRN-1 1 char elevation [deg] 2 word signal quality 4 char tracked? 1 = yes / 0 = no 5 char status bits 6 char ??message id 0x16 ofs type quantity -------------------------- 0 float pseudorange increment 4 float f1 8 double pseudorange 16 float f2 20 char PRN-1message id 0x36 - ephemeris and almanac data -> message id 0x36 - 10 LONGs x number of sats in view per 6 seconds ofs type quantity -------------------------- 0 long 50 Hz counter 4 long GPS word 9 char PRN-1 message id 0x38 ofs type quantity -------------------------- 0 long phase counter 8 char track byte 9 char unknown 10 char unknown 11 char unknown 12 word doppler 14 double pseudorange 22 long 511500 Hz counter 26 word signal strength 28 double time of week 36 char PRN-1-----------------------------------------------------------------1.5 Message ID: 0x16-----------------------------------------------------------------General description: several hints indicate that this record could be related to velocity??/Doppler??? information:* The delta_pseudorange_rate field is very similar to the difference in pseudoranges divided by the time increment.* Also, using the phase field of the 0x38 record as a reference, and studying the behaviour of this field compared to the rate of increase of that phase we found the following: Sat Id Signal_Q Mean(cm) std (cm) 10 12000 2.0 19 02 8500 -1.3 16 05 6000 0.3 18 15 12500 0.8 17 18 6500 -0.2 18 We find that this delta_pseudorange rate follows the phase rate a bit more closely than the differences of pseudoranges shown in the other table. The improvement is more clearly seen in those sats with a lower signal. That would be consistent with its being a more precise measurement (integrated Doppler??) of the same quantity. Again, beware that this has been obtained by examining a couple minutes of data, and this interpretation could be wrong.* These 0x16 records are not sent until enough sats are acquired.* F1 and F2 seems to be some sort of correction (Kalman filter parameters/variances??) that is used when aditional info is gathered. Some observations: - F1 has similar values (usually 0 point something) for each group of messages that are sent together for the different sats. - F2 can be real big (in the order of thousands) in a cold start for a different position for the FIRST satellites. After a while, F2 drops to its normal values of about 5. - In a warm start (same position,a bit later) F2 values are very low from the beginning. - In its stable state, F2 used to be larger (about 20-30 as opposed to 3-5) with SA on. Name delta_pseudorange_rate (m/s)Position bytes 1-4Type floatDescription A float that closely (usually within a meter) resembles the increment of the pseudorange for that sat in a second.Name f1Position bytes 5-8Type floatDescription Similar values for a group of messages that are sent together for the different sats. See general description above.Name pseudorangePosition bytes 9-16Type doubleDescription Pseudorange (ms). Same as in the preceding 0x38 record.Name f2Position bytes 17-20Type float Description See general description above.Name svidPosition byte 21Type BYTEDescription SVID (PRN-1)--------------------------------------------------------------1.4 Message ID: 0x36---------------------------------------------------------------General description: timing info + something else. These records are only sent once we have computed a valid pseudorange for a satellite (see power-on description below), and disappear if there is troubles (whentracked_byte of record 0x38 becomes 0).Name c_50 Position Bytes 1-4Type unsigned longDescription 50 Hz counter, STARTING from the beginning of the week, that is, c_50/50 corresponds to TOW. It gets incremented in 30 count intervals, so that the resolution is 0.6 sec. Name unknownPosition bytes 5-8 Type BYTE[4]Description seem to vary randomly.Name svidPosition byte 9Type BYTEDescription SVID (PRN-1)------------------------------------------------------------------1.3 Message ID: 0x38 (37 byte long)-------------------------------------------------------------------Data related to a particular sat (indicated in the last byte). It is in this record where the most interesting info seems to be sent.Name phase_counter Position bytes 1-4Type unsigned long Description A counter that gets increased by about 60-70 millions per seconnd. The lower 11 bits give us the fractional phase (it mirrors the corresponding field in the 0x1a record), while the upper bits (12-32) represent the integer number of cycles. Just after starting the unit those bits will be equal to the Integrated_phase field (see below), but after a while the won't, because the phase_counter will roll over. The best way to compute the carrier phase is thus: carrier_phase = integrated_phase (whole cycles) + (phase_counter AND 2047)/2048. that is, the integrated_phase field keeps track of the integer number of cycles, so we don't have to worry about the rollover of phase_counter. From phase_counter we use only its lower 11 bits to get the fractional phase.Name track_bytePosition byte 5Type Byte Description 0x00 indicates some sort or problem with the sat. This is the case for sats with low elevation and weak signal. In that case, the other data may be unreliable. Name unknown Position bytes 6-8Type byte[3]Description Seem to be grouped into an integer (bytes 6-7) and a flag byte (byte 8) that is always? 00 or ff. The integer?? moves while the tracked_byte is 00 (the sat is not properly tracked). When the sat is locked, the number gets frozen.Name delta_fPosition bytes 9-10 Type unsigned int (interpreted as signed by substracting 32768)Description If we consider this field a signed integer (not as usually interpreted by the machine, but considering 32768 as the zero so that the value we use is actually delta_f-32768), it is positive for those sats with larger increments of pseudoranges (going away from us) and negative for those with smaller increments of pseudoranges (approaching us): Sat Id delta_pseudorange delta_f-32768 ------------------------------------------- 10 6329 1323 02 5638 -2402 05 6534 2428 15 5863 -1186 The relation between those two quantities is linear and the constant relating them (in a least squares fit) is very close to the L1 wavelenght. That would mean that this field could be a measurement/estimation? of the Doppler shift (in Hertz) for each sat. For the above data an aproximate fit is: delta_f = (delta_pr - 6080) / lambda delta_pr is obviouly a measure of the relative speed of the satellite, and the origin 6080 m/s would be the false speed caused by the clock drift. Once that bias is removed, the relation would be: delta_f = relative_speed / lambda = L1 * (relative_speed/c) = Doppler shift (Hz)Name Integrated PhasePosition Bytes 11-14Type unsigned longDescription integrated phase (whole cycles). The ratio of its increment with the increment of the pseudorange field corresponds with the inverse of the L1 wavelenght. Once locked, the difference between both fields rarely exceed 100 cm. Name pseudorangePosition Bytes 15-22Type doubleDescription Pseudorange in meters. Due to the particular idiosincrasy of the GPS12, these numbers can get real large, because the GPS12 allows the clock error to accumulate in them, at a rate (in my unit) of about 6000 m/s.Name c_511500Position Bytes 23-26Type Unsigned longDescription 511500 Hz timer. 511500 ticks corresponds to a receiver's second. At the start it is incremented by exactly 511500 units, but once enough sats have been acquired, it can vary one or two units (probably as the GPS tries to sync its measurements to an exact GPS system time second. Name signal_QPosition Bytes 27-28 Type Unsigned int.Description Measure of the signal strength or quality for that satellite. It has the same value as in the corresponding field of the next 0x1a record.Name tow Position Bytes 29-36 Type DoubleDescription Time of week in seconds. At the start it is incremented
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -