From fce4ce523afa71983ec937b8dee3de0d50cc17cc Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 5 Jun 2019 15:39:20 +0200 Subject: [PATCH 1/2] Fix typos in comments --- src/algorithms/libs/gps_l5_signal.cc | 35 +++++++++++----------------- src/algorithms/libs/gps_l5_signal.h | 12 ++++++---- 2 files changed, 22 insertions(+), 25 deletions(-) diff --git a/src/algorithms/libs/gps_l5_signal.cc b/src/algorithms/libs/gps_l5_signal.cc index c1f234506..180e0a72d 100644 --- a/src/algorithms/libs/gps_l5_signal.cc +++ b/src/algorithms/libs/gps_l5_signal.cc @@ -38,7 +38,7 @@ #include -std::deque l5i_xa_shift(std::deque xa) +std::deque l5i_xa_shift(std::deque xa) // GPS-IS-705E Figure 3-4 pp. 15 { if (xa == std::deque{true, true, true, true, true, true, true, true, true, true, true, false, true}) { @@ -62,7 +62,7 @@ std::deque l5q_xa_shift(std::deque xa) } -std::deque l5i_xb_shift(std::deque xb) +std::deque l5i_xb_shift(std::deque xb) // GPS-IS-705E Figure 3-5 pp. 16 { std::deque out(xb.begin(), xb.end() - 1); out.push_front(xb[12] xor xb[11] xor xb[7] xor xb[6] xor xb[5] xor xb[3] xor xb[2] xor xb[0]); @@ -146,7 +146,7 @@ void make_l5i(int32_t* _dest, int32_t prn) { xb_shift[n] = xb[(xb_offset + n) % GPS_L5I_CODE_LENGTH_CHIPS]; } - std::deque out_code(GPS_L5I_CODE_LENGTH_CHIPS, false); + for (int32_t n = 0; n < GPS_L5I_CODE_LENGTH_CHIPS; n++) { _dest[n] = xa[n] xor xb_shift[n]; @@ -166,7 +166,7 @@ void make_l5q(int32_t* _dest, int32_t prn) { xb_shift[n] = xb[(xb_offset + n) % GPS_L5Q_CODE_LENGTH_CHIPS]; } - std::deque out_code(GPS_L5Q_CODE_LENGTH_CHIPS, false); + for (int32_t n = 0; n < GPS_L5Q_CODE_LENGTH_CHIPS; n++) { _dest[n] = xa[n] xor xb_shift[n]; @@ -231,28 +231,24 @@ void gps_l5i_code_gen_complex_sampled(std::complex* _dest, uint32_t _prn, //--- Find time constants -------------------------------------------------- _ts = 1.0 / static_cast(_fs); // Sampling period in sec - _tc = 1.0 / static_cast(GPS_L5I_CODE_RATE_HZ); // C/A chip period in sec + _tc = 1.0 / static_cast(GPS_L5I_CODE_RATE_HZ); // L5I primary chip period in sec - //float aux; for (int32_t i = 0; i < _samplesPerCode; i++) { //=== Digitizing ======================================================= //--- Make index array to read L5 code values ------------------------- - //TODO: Check this formula! Seems to start with an extra sample - _codeValueIndex = std::ceil((_ts * (static_cast(i) + 1)) / _tc) - 1; - //aux = (_ts * (i + 1)) / _tc; - //_codeValueIndex = static_cast (static_cast(aux)) - 1; + _codeValueIndex = static_cast(std::ceil(_ts * static_cast(i + 1) / _tc)) - 1; - //--- Make the digitized version of the L2C code ----------------------- + //--- Make the digitized version of the L5I code ----------------------- if (i == _samplesPerCode - 1) { //--- Correct the last index (due to number rounding issues) ----------- - _dest[i] = std::complex(1.0 - 2.0 * _code[_codeLength - 1], 0); + _dest[i] = std::complex(1.0 - 2.0 * _code[_codeLength - 1], 0.0); } else { - _dest[i] = std::complex(1.0 - 2.0 * _code[_codeValueIndex], 0); //repeat the chip -> upsample + _dest[i] = std::complex(1.0 - 2.0 * _code[_codeValueIndex], 0.0); // repeat the chip -> upsample } } delete[] _code; @@ -296,7 +292,7 @@ void gps_l5q_code_gen_float(float* _dest, uint32_t _prn) /* - * Generates complex GPS L5i code for the desired SV ID and sampled to specific sampling frequency + * Generates complex GPS L5Q code for the desired SV ID and sampled to specific sampling frequency */ void gps_l5q_code_gen_complex_sampled(std::complex* _dest, uint32_t _prn, int32_t _fs) { @@ -316,7 +312,7 @@ void gps_l5q_code_gen_complex_sampled(std::complex* _dest, uint32_t _prn, //--- Find time constants -------------------------------------------------- _ts = 1.0 / static_cast(_fs); // Sampling period in sec - _tc = 1.0 / static_cast(GPS_L5Q_CODE_RATE_HZ); // C/A chip period in sec + _tc = 1.0 / static_cast(GPS_L5Q_CODE_RATE_HZ); // L5Q chip period in sec //float aux; for (int32_t i = 0; i < _samplesPerCode; i++) @@ -324,12 +320,9 @@ void gps_l5q_code_gen_complex_sampled(std::complex* _dest, uint32_t _prn, //=== Digitizing ======================================================= //--- Make index array to read L5 code values ------------------------- - //TODO: Check this formula! Seems to start with an extra sample - _codeValueIndex = std::ceil((_ts * (static_cast(i) + 1)) / _tc) - 1; - //aux = (_ts * (i + 1)) / _tc; - //_codeValueIndex = static_cast (static_cast(aux)) - 1; + _codeValueIndex = static_cast(std::ceil(_ts * static_cast(i + 1) / _tc)) - 1; - //--- Make the digitized version of the L2C code ----------------------- + //--- Make the digitized version of the L5Q code ----------------------- if (i == _samplesPerCode - 1) { //--- Correct the last index (due to number rounding issues) ----------- @@ -337,7 +330,7 @@ void gps_l5q_code_gen_complex_sampled(std::complex* _dest, uint32_t _prn, } else { - _dest[i] = std::complex(1.0 - 2.0 * _code[_codeValueIndex], 0); //repeat the chip -> upsample + _dest[i] = std::complex(1.0 - 2.0 * _code[_codeValueIndex], 0); // repeat the chip -> upsample } } delete[] _code; diff --git a/src/algorithms/libs/gps_l5_signal.h b/src/algorithms/libs/gps_l5_signal.h index b0b24d2a5..de8e44c0d 100644 --- a/src/algorithms/libs/gps_l5_signal.h +++ b/src/algorithms/libs/gps_l5_signal.h @@ -36,18 +36,22 @@ #include #include -//!Generates complex GPS L5i M code for the desired SV ID +//! Generates complex GPS L5I code for the desired SV ID void gps_l5i_code_gen_complex(std::complex* _dest, uint32_t _prn); + +//! Generates real GPS L5I code for the desired SV ID void gps_l5i_code_gen_float(float* _dest, uint32_t _prn); -//!Generates complex GPS L5q M code for the desired SV ID +//! Generates complex GPS L5Q code for the desired SV ID void gps_l5q_code_gen_complex(std::complex* _dest, uint32_t _prn); + +//! Generates real GPS L5Q code for the desired SV ID void gps_l5q_code_gen_float(float* _dest, uint32_t _prn); -//! Generates complex GPS L5i M code for the desired SV ID, and sampled to specific sampling frequency +//! Generates complex GPS L5I code for the desired SV ID, and sampled to specific sampling frequency void gps_l5i_code_gen_complex_sampled(std::complex* _dest, uint32_t _prn, int32_t _fs); -//! Generates complex GPS L5q M code for the desired SV ID, and sampled to specific sampling frequency +//! Generates complex GPS L5Q code for the desired SV ID, and sampled to specific sampling frequency void gps_l5q_code_gen_complex_sampled(std::complex* _dest, uint32_t _prn, int32_t _fs); From e0d5c12b0bfc3cc0a78e72fc4467aadafc98a6a6 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 5 Jun 2019 15:43:54 +0200 Subject: [PATCH 2/2] Remove unused includes --- src/algorithms/libs/gps_l5_signal.cc | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/algorithms/libs/gps_l5_signal.cc b/src/algorithms/libs/gps_l5_signal.cc index 180e0a72d..c5fc6e13c 100644 --- a/src/algorithms/libs/gps_l5_signal.cc +++ b/src/algorithms/libs/gps_l5_signal.cc @@ -32,9 +32,6 @@ #include "gps_l5_signal.h" #include "GPS_L5.h" -#include -#include -#include #include