mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-12 11:10:33 +00:00
Merge in GLONASS acquisition and tracking code
This commit is contained in:
parent
19f4da0aa6
commit
4e78bcf446
81
conf/gnss-sdr_GLONASS_L1_CA_ibyte.conf
Normal file
81
conf/gnss-sdr_GLONASS_L1_CA_ibyte.conf
Normal file
@ -0,0 +1,81 @@
|
||||
[GNSS-SDR]
|
||||
|
||||
;######### GLOBAL OPTIONS ##################
|
||||
GNSS-SDR.internal_fs_hz=6625000
|
||||
|
||||
;######### SIGNAL_SOURCE CONFIG ############
|
||||
SignalSource.implementation=File_Signal_Source
|
||||
SignalSource.filename=/home/gastd/sdr/NT1065_GLONASS_L1_20160831_fs6625e6_if0e3_schar_1m.bin
|
||||
;SignalSource.filename=/home/gastd/sdr/signal_glonass.bin
|
||||
SignalSource.item_type=ibyte
|
||||
SignalSource.sampling_frequency=6625000
|
||||
;SignalSource.freq=0
|
||||
;SignalSource.samples=66250000
|
||||
SignalSource.samples=0
|
||||
SignalSource.dump=false;
|
||||
SignalSource.dump_filename=./signal_glonass.bin
|
||||
|
||||
;######### SIGNAL_CONDITIONER CONFIG ############
|
||||
SignalConditioner.implementation=Signal_Conditioner
|
||||
DataTypeAdapter.implementation=Ibyte_To_Complex
|
||||
InputFilter.implementation=Pass_Through
|
||||
InputFilter.item_type=gr_complex
|
||||
Resampler.implementation=Direct_Resampler
|
||||
Resampler.sample_freq_in=6625000
|
||||
Resampler.sample_freq_out=6625000
|
||||
Resampler.item_type=gr_complex
|
||||
|
||||
;######### CHANNELS GLOBAL CONFIG ############
|
||||
Channels_1G.count=2
|
||||
Channels.in_acquisition=1
|
||||
Channel0.signal=1G
|
||||
Channel0.signal=1G
|
||||
Channel1.signal=1G
|
||||
Channel2.signal=1G
|
||||
Channel3.signal=1G
|
||||
Channel4.signal=1G
|
||||
Channel5.signal=1G
|
||||
Channel6.signal=1G
|
||||
Channel7.signal=1G
|
||||
|
||||
Channel0.satellite=2
|
||||
Channel1.satellite=21
|
||||
Channel2.satellite=12
|
||||
;Channel3.satellite=2
|
||||
;Channel4.satellite=22
|
||||
;Channel5.satellite=21
|
||||
|
||||
;######### ACQUISITION GLOBAL CONFIG ############
|
||||
Acquisition_1G.implementation=GLONASS_L1_CA_PCPS_Acquisition
|
||||
Acquisition_1G.item_type=gr_complex
|
||||
Acquisition_1G.threshold=0.0
|
||||
Acquisition_1G.pfa=0.01
|
||||
Acquisition_1G.if=0
|
||||
Acquisition_1G.doppler_max=10000
|
||||
Acquisition_1G.doppler_step=250
|
||||
Acquisition_1G.dump=false;
|
||||
Acquisition_1G.dump_filename=./acquisition.dat
|
||||
|
||||
;######### TRACKING GLOBAL CONFIG ############
|
||||
Tracking_1G.implementation=GLONASS_L1_CA_DLL_PLL_C_Aid_Tracking
|
||||
Tracking_1G.item_type=gr_complex
|
||||
Tracking_1G.if=0
|
||||
Tracking_1G.early_late_space_chips=0.5
|
||||
Tracking_1G.pll_bw_hz=20.0;
|
||||
Tracking_1G.dll_bw_hz=4.0;
|
||||
Tracking_1G.dump=false;
|
||||
Tracking_1G.dump_filename=./tracking_ch_
|
||||
|
||||
;######### TELEMETRY DECODER GPS CONFIG ############
|
||||
TelemetryDecoder_1G.implementation=GPS_L1_CA_Telemetry_Decoder
|
||||
|
||||
;######### OBSERVABLES CONFIG ############
|
||||
Observables.implementation=Hybrid_Observables
|
||||
|
||||
;######### PVT CONFIG ############
|
||||
PVT.implementation=RTKLIB_PVT
|
||||
PVT.averaging_depth=100
|
||||
PVT.flag_averaging=true
|
||||
PVT.output_rate_ms=10
|
||||
PVT.display_rate_ms=500
|
||||
|
@ -115,7 +115,7 @@ void signal_generator_c::init()
|
||||
/ (GLONASS_L1_CA_CODE_RATE_HZ / GLONASS_L1_CA_CODE_LENGTH_CHIPS)));
|
||||
|
||||
num_of_codes_per_vector_.push_back(galileo_signal ? 4 * static_cast<int>(Galileo_E1_C_SECONDARY_CODE_LENGTH) : 1);
|
||||
data_bit_duration_ms_.push_back(1e3 / GLONASS_CA_TELEMETRY_RATE_BITS_SECOND);
|
||||
data_bit_duration_ms_.push_back(1e3 / GLONASS_GNAV_TELEMETRY_RATE_BITS_SECOND);
|
||||
}
|
||||
else if (system_[sat] == "E")
|
||||
{
|
||||
|
@ -16,12 +16,13 @@
|
||||
# along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
set(TELEMETRY_DECODER_ADAPTER_SOURCES
|
||||
gps_l1_ca_telemetry_decoder.cc
|
||||
gps_l2c_telemetry_decoder.cc
|
||||
set(TELEMETRY_DECODER_ADAPTER_SOURCES
|
||||
gps_l1_ca_telemetry_decoder.cc
|
||||
gps_l2c_telemetry_decoder.cc
|
||||
galileo_e1b_telemetry_decoder.cc
|
||||
sbas_l1_telemetry_decoder.cc
|
||||
galileo_e5a_telemetry_decoder.cc
|
||||
glonass_l1_ca_telemetry_decoder.cc
|
||||
)
|
||||
|
||||
include_directories(
|
||||
|
@ -58,8 +58,8 @@ glonass_l1_ca_make_telemetry_decoder_cc(Gnss_Satellite satellite, bool dump)
|
||||
glonass_l1_ca_telemetry_decoder_cc::glonass_l1_ca_telemetry_decoder_cc(
|
||||
Gnss_Satellite satellite,
|
||||
bool dump) :
|
||||
gr::block("glonass_l1_ca_telemetry_decoder_cc", gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)),
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
||||
gr::block("glonass_l1_ca_telemetry_decoder_cc", gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)),
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
||||
{
|
||||
// Telemetry Bit transition synchronization port out
|
||||
this->message_port_register_out(pmt::mp("preamble_timestamp_s"));
|
||||
@ -68,8 +68,8 @@ glonass_l1_ca_telemetry_decoder_cc::glonass_l1_ca_telemetry_decoder_cc(
|
||||
// initialize internal vars
|
||||
d_dump = dump;
|
||||
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
|
||||
LOG(INFO) << "Initializing GLONASS L1 CA TELEMETRY PROCESSING";
|
||||
// Define the number of sampes per symbol. Notice that GLONASS has to rates,
|
||||
LOG(INFO) << "Initializing GLONASS L1 CA TELEMETRY DECODING";
|
||||
// Define the number of sampes per symbol. Notice that GLONASS has 2 rates,
|
||||
//one for the navigation data and the other for the preamble information
|
||||
d_samples_per_symbol = ( GLONASS_L1_CA_CODE_RATE_HZ / GLONASS_L1_CA_CODE_LENGTH_CHIPS ) / GLONASS_L1_CA_SYMBOL_RATE_BPS;
|
||||
|
||||
@ -83,9 +83,9 @@ glonass_l1_ca_telemetry_decoder_cc::glonass_l1_ca_telemetry_decoder_cc(
|
||||
// preamble bits to sampled symbols
|
||||
d_preambles_symbols = (signed int*)malloc(sizeof(signed int) * d_symbols_per_preamble);
|
||||
int n = 0;
|
||||
for (int i = 0; i < GLONASS_GNAV_TELEMETRY_SYMBOLS_PER_PREAMBLE_BIT; i++)
|
||||
for (int i = 0; i < GLONASS_GNAV_PREAMBLE_LENGTH_BITS; i++)
|
||||
{
|
||||
for (unsigned int j = 0; j < d_samples_per_symbol; j++)
|
||||
for (unsigned int j = 0; j < GLONASS_GNAV_TELEMETRY_SYMBOLS_PER_PREAMBLE_BIT; j++)
|
||||
{
|
||||
if (d_preambles_bits[i] == 1)
|
||||
{
|
||||
@ -133,22 +133,45 @@ glonass_l1_ca_telemetry_decoder_cc::~glonass_l1_ca_telemetry_decoder_cc()
|
||||
|
||||
void glonass_l1_ca_telemetry_decoder_cc::decode_string(double *frame_symbols,int frame_length)
|
||||
{
|
||||
double chip_acc = 0.0;
|
||||
int chip_acc_counter = 0;
|
||||
|
||||
// 1. Transform from symbols to bits
|
||||
std::string frame_string;
|
||||
std::string bi_binary_code;
|
||||
std::string relative_code;
|
||||
// Group samples into bi-binary code
|
||||
for(int i = 0; i < (frame_length); i++)
|
||||
{
|
||||
if (frame_symbols[i] > 0)
|
||||
{
|
||||
frame_string.push_back('1');
|
||||
}
|
||||
chip_acc += frame_symbols[i];
|
||||
chip_acc_counter += 1;
|
||||
|
||||
if(chip_acc_counter == (GLONASS_GNAV_TELEMETRY_SYMBOLS_PER_BIT - 1))
|
||||
{
|
||||
if (chip_acc > 0)
|
||||
{
|
||||
bi_binary_code.push_back('1');
|
||||
}
|
||||
else
|
||||
{
|
||||
bi_binary_code.push_back('0');
|
||||
}
|
||||
}
|
||||
}
|
||||
// Convert from bi-binary code to relative code
|
||||
for(int i = 0; i < (GLONASS_GNAV_STRING_BITS); i++)
|
||||
{
|
||||
if(bi_binary_code[2*i] == '1' && bi_binary_code[2*i + 1] == '0')
|
||||
{
|
||||
relative_code.push_back('1');
|
||||
}
|
||||
else
|
||||
{
|
||||
frame_string.push_back('0');
|
||||
}
|
||||
{
|
||||
relative_code.push_back('0');
|
||||
}
|
||||
}
|
||||
|
||||
// 2. Call the GLONASS GNAV string decoder
|
||||
d_nav.string_decoder(frame_string);
|
||||
d_nav.string_decoder(relative_code.c_str());
|
||||
|
||||
// 3. Check operation executed correctly
|
||||
if(d_nav.flag_CRC_test == true)
|
||||
@ -178,7 +201,8 @@ void glonass_l1_ca_telemetry_decoder_cc::decode_string(double *frame_symbols,int
|
||||
}
|
||||
if (d_nav.have_new_almanac() == true)
|
||||
{
|
||||
std::shared_ptr<Glonass_Gnav_Almanac> tmp_obj= std::make_shared<Glonass_Gnav_Almanac>(d_nav.get_almanac());
|
||||
unsigned int slot_nbr = d_nav.get_ephemeris().i_satellite_slot_number;
|
||||
std::shared_ptr<Glonass_Gnav_Almanac> tmp_obj= std::make_shared<Glonass_Gnav_Almanac>(d_nav.get_almanac(slot_nbr));
|
||||
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
|
||||
}
|
||||
}
|
||||
@ -201,7 +225,7 @@ int glonass_l1_ca_telemetry_decoder_cc::general_work (int noutput_items __attrib
|
||||
consume_each(1);
|
||||
|
||||
d_flag_preamble = false;
|
||||
unsigned int required_symbols=GLONASS_GNAV_FRAME_BITS+d_symbols_per_preamble;
|
||||
unsigned int required_symbols=GLONASS_GNAV_PREAMBLE_LENGTH_SYMBOLS;
|
||||
|
||||
if (d_symbol_history.size()>required_symbols)
|
||||
{
|
||||
@ -224,9 +248,11 @@ int glonass_l1_ca_telemetry_decoder_cc::general_work (int noutput_items __attrib
|
||||
{
|
||||
if (abs(corr_value) >= d_symbols_per_preamble)
|
||||
{
|
||||
d_preamble_index = d_sample_counter;//record the preamble sample stamp
|
||||
// Record the preamble sample stamp
|
||||
d_preamble_index = d_sample_counter;
|
||||
LOG(INFO) << "Preamble detection for GLONASS L1 C/A SAT " << this->d_satellite;
|
||||
d_stat = 1; // enter into frame pre-detection status
|
||||
// Enter into frame pre-detection status
|
||||
d_stat = 1;
|
||||
}
|
||||
}
|
||||
else if (d_stat == 1) // posible preamble lock
|
||||
@ -253,39 +279,29 @@ int glonass_l1_ca_telemetry_decoder_cc::general_work (int noutput_items __attrib
|
||||
}
|
||||
else if (d_stat == 2)
|
||||
{
|
||||
if (d_sample_counter == d_preamble_index + GLONASS_GNAV_PREAMBLE_PERIOD_SYMBOLS)
|
||||
if (d_sample_counter == d_preamble_index + GLONASS_GNAV_PREAMBLE_LENGTH_SYMBOLS)
|
||||
{
|
||||
// NEW GLONASS string received
|
||||
// 0. fetch the symbols into an array
|
||||
int frame_length = GLONASS_GNAV_STRING_SYMBOLS - d_symbols_per_preamble;
|
||||
double frame_symbols[frame_length];
|
||||
int string_length = GLONASS_GNAV_STRING_SYMBOLS - d_symbols_per_preamble;
|
||||
double string_symbols[string_length];
|
||||
|
||||
//******* SYMBOL TO BIT *******
|
||||
if (d_symbol_history.at(0).Flag_valid_symbol_output == true)
|
||||
{
|
||||
// extended correlation to bit period is enabled in tracking!
|
||||
d_symbol_accumulator += d_symbol_history.at(0).Prompt_I; // accumulate the input value in d_symbol_accumulator
|
||||
d_symbol_accumulator_counter += d_symbol_history.at(0).correlation_length_ms;
|
||||
}
|
||||
if (d_symbol_accumulator_counter >= 20)
|
||||
{
|
||||
}
|
||||
|
||||
for (int i = 0; i < frame_length; i++)
|
||||
for (int i = 0; i < string_length; i++)
|
||||
{
|
||||
if (corr_value > 0)
|
||||
{
|
||||
page_part_symbols[i] = d_symbol_history.at(i + d_symbols_per_preamble).Prompt_I; // because last symbol of the preamble is just received now!
|
||||
string_symbols[i] = d_symbol_history.at(i + d_symbols_per_preamble).Prompt_I; // because last symbol of the preamble is just received now!
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
page_part_symbols[i] = -d_symbol_history.at(i + d_symbols_per_preamble).Prompt_I; // because last symbol of the preamble is just received now!
|
||||
string_symbols[i] = -d_symbol_history.at(i + d_symbols_per_preamble).Prompt_I; // because last symbol of the preamble is just received now!
|
||||
}
|
||||
}
|
||||
|
||||
//call the decoder
|
||||
decode_string(page_part_symbols);
|
||||
decode_string(string_symbols, string_length);
|
||||
if (d_nav.flag_CRC_test == true)
|
||||
{
|
||||
d_CRC_error_counter = 0;
|
||||
@ -317,7 +333,7 @@ int glonass_l1_ca_telemetry_decoder_cc::general_work (int noutput_items __attrib
|
||||
if (this->d_flag_preamble == true and d_nav.flag_TOW_set == true)
|
||||
//update TOW at the preamble instant
|
||||
{
|
||||
d_TOW_at_current_symbol = floor((d_nav.d_TOW + 2*GLONASS_L1_CA_CODE_PERIOD + GLONASS_CA_PREAMBLE_DURATION_S)*1000.0)/1000.0;
|
||||
d_TOW_at_current_symbol = floor((d_nav.d_TOW + 2*GLONASS_L1_CA_CODE_PERIOD + GLONASS_GNAV_PREAMBLE_DURATION_S)*1000.0)/1000.0;
|
||||
|
||||
}
|
||||
else //if there is not a new preamble, we define the TOW of the current symbol
|
||||
|
@ -196,7 +196,7 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_cc::start_tracking()
|
||||
acq_trk_diff_seconds = static_cast<double>(acq_trk_diff_samples) / static_cast<double>(d_fs_in);
|
||||
// Doppler effect
|
||||
// Fd=(C/(C+Vr))*F
|
||||
d_glonass_freq_ch = GLONASS_L1_FREQ_HZ + (DFRQ1_GLO * GLONASS_PRN.at(d_acquisition_gnss_synchro->PRN));
|
||||
d_glonass_freq_ch = GLONASS_L1_CA_FREQ_HZ + (DFRQ1_GLO * GLONASS_PRN.at(d_acquisition_gnss_synchro->PRN));
|
||||
double radial_velocity = (d_glonass_freq_ch + d_acq_carrier_doppler_hz) / d_glonass_freq_ch;
|
||||
// new chip and prn sequence periods based on acq Doppler
|
||||
double T_chip_mod_seconds;
|
||||
|
@ -197,7 +197,7 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_sc::start_tracking()
|
||||
acq_trk_diff_seconds = static_cast<double>(acq_trk_diff_samples) / static_cast<double>(d_fs_in);
|
||||
// Doppler effect
|
||||
// Fd=(C/(C+Vr))*F
|
||||
d_glonass_freq_ch = GLONASS_L1_FREQ_HZ + (GLONASS_L1_FREQ_HZ * GLONASS_PRN.at(d_acquisition_gnss_synchro->PRN));
|
||||
d_glonass_freq_ch = GLONASS_L1_CA_FREQ_HZ + (GLONASS_L1_CA_FREQ_HZ * GLONASS_PRN.at(d_acquisition_gnss_synchro->PRN));
|
||||
double radial_velocity = (d_glonass_freq_ch + d_acq_carrier_doppler_hz) / d_glonass_freq_ch;
|
||||
// new chip and prn sequence periods based on acq Doppler
|
||||
double T_chip_mod_seconds;
|
||||
|
@ -161,7 +161,7 @@ void Glonass_L1_Ca_Dll_Pll_Tracking_cc::start_tracking()
|
||||
acq_trk_diff_seconds = static_cast<float>(acq_trk_diff_samples) / static_cast<float>(d_fs_in);
|
||||
// Doppler effect
|
||||
// Fd=(C/(C+Vr))*F
|
||||
d_glonass_freq_ch = GLONASS_L1_FREQ_HZ + (DFRQ1_GLO * GLONASS_PRN.at(d_acquisition_gnss_synchro->PRN));
|
||||
d_glonass_freq_ch = GLONASS_L1_CA_FREQ_HZ + (DFRQ1_GLO * GLONASS_PRN.at(d_acquisition_gnss_synchro->PRN));
|
||||
double radial_velocity = (d_glonass_freq_ch + d_acq_carrier_doppler_hz) / d_glonass_freq_ch;
|
||||
// new chip and prn sequence periods based on acq Doppler
|
||||
double T_chip_mod_seconds;
|
||||
|
@ -80,8 +80,8 @@ const double GLONASS_SUN_ECCENTRICITY = 0.016719; //!< Eccentr
|
||||
// carrier and code frequencies
|
||||
const double GLONASS_L2_FREQ_HZ = FREQ2_GLO; //!< L1 [Hz]
|
||||
|
||||
const double GLONASS_L1_FREQ_HZ = FREQ1_GLO; //!< L1 [Hz]
|
||||
const double GLONASS_L1_DFREQ_HZ = DFRQ1_GLO; //!< Freq Bias for GLONASS L1 [Hz]
|
||||
const double GLONASS_L1_CA_FREQ_HZ = FREQ1_GLO; //!< L1 [Hz]
|
||||
const double GLONASS_L1_CA_DFREQ_HZ = DFRQ1_GLO; //!< Freq Bias for GLONASS L1 [Hz]
|
||||
const double GLONASS_L1_CA_CODE_RATE_HZ = 0.511e6; //!< GLONASS L1 C/A code rate [chips/s]
|
||||
const double GLONASS_L1_CA_CODE_LENGTH_CHIPS = 511.0; //!< GLONASS L1 C/A code length [chips]
|
||||
const double GLONASS_L1_CA_CODE_PERIOD = 0.001; //!< GLONASS L1 C/A code period [seconds]
|
||||
@ -116,10 +116,6 @@ const std::map<unsigned int, int> GLONASS_PRN =
|
||||
{23, 3,}, //Plane 3
|
||||
{24, 2}}; //Plane 3
|
||||
|
||||
|
||||
const int GLONASS_CA_TELEMETRY_RATE_BITS_SECOND = 50; //!< NAV message bit rate [bits/s]
|
||||
|
||||
|
||||
const double GLONASS_STARTOFFSET_ms = 68.802; //[ms] Initial sign. travel time (this cannot go here)
|
||||
|
||||
// OBSERVABLE HISTORY DEEP FOR INTERPOLATION
|
||||
@ -127,19 +123,17 @@ const int GLONASS_L1_CA_HISTORY_DEEP = 100;
|
||||
|
||||
// NAVIGATION MESSAGE DEMODULATION AND DECODING
|
||||
#define GLONASS_GNAV_PREAMBLE {1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0}
|
||||
const double GLONASS_GNAV_PREAMBLE_DURATION_S = 0.3;
|
||||
const int GLONASS_GNAV_PREAMBLE_LENGTH_BITS = 30;
|
||||
const int GLONASS_GNAV_PREAMBLE_LENGTH_SYMBOLS = 300;
|
||||
const double GLONASS_GNAV_PREAMBLE_DURATION_S = 0.3;
|
||||
const int GLONASS_GNAV_PREAMBLE_PERIOD_SYMBOLS = 1700;
|
||||
const int GLONASS_GNAV_TELEMETRY_RATE_BITS_SECOND = 50; //!< NAV message bit rate [bits/s]
|
||||
const int GLONASS_GNAV_TELEMETRY_SYMBOLS_PER_BIT = 10;
|
||||
const int GLONASS_GNAV_TELEMETRY_SYMBOLS_PER_PREAMBLE_BIT = 10;
|
||||
const int GLONASS_GNAV_TELEMETRY_RATE_SYMBOLS_SECOND = GLONASS_GNAV_TELEMETRY_RATE_BITS_SECOND*GLONASS_GNAV_TELEMETRY_SYMBOLS_PER_BIT; //!< NAV message bit rate [symbols/s]
|
||||
const int GLONASS_GNAV_PREAMBLE_PERIOD_SYMBOLS = 1700;
|
||||
const int GLONASS_GNAV_FRAME_BITS = 1725; //!< Number of chips per frame in the GNAV message 15 strings*(85 data bits + 30 time mark bits)[bits]
|
||||
const int GLONASS_GNAV_FRAME_SECONDS = 30; //!< Subframe duration [seconds]
|
||||
const int GLONASS_GNAV_FRAME_MS = 30000; //!< Subframe duration [seconds]
|
||||
const int GLONASS_GNAV_STRING_BITS = 85; //!< Number of bits per string in the GNAV message (85 data bits + 30 time mark bits) [bits]
|
||||
const int GLONASS_GNAV_HAMMING_CODE_BITS = 8; //!< Number of bits in hamming code sequence of GNAV message
|
||||
const int GLONASS_GNAV_STRING_SYMBOLS = 2000; //!< Number of bits per string in the GNAV message (85 data bits + 30 time mark bits) [bits]
|
||||
const int GLONASS_GNAV_STRING_BITS = 85; //!< Number of bits per string in the GNAV message (85 data bits + 30 time mark bits) [bits]
|
||||
const int GLONASS_GNAV_HAMMING_CODE_BITS = 8; //!< Number of bits in hamming code sequence of GNAV message
|
||||
|
||||
const std::vector<int> GLONASS_GNAV_CRC_I_INDEX {9, 10, 12, 13, 15, 17, 19, 20, 22, 24, 26, 28, 30, 32, 34, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84};
|
||||
const std::vector<int> GLONASS_GNAV_CRC_J_INDEX {9, 11, 12, 14, 15, 18, 19, 21, 22, 25, 26, 29, 30, 33, 34, 36, 37, 40, 41, 44, 45, 48, 49, 52, 53, 56, 57, 60, 61, 64, 65, 67, 68, 71, 72, 75, 76, 79, 80, 83, 84};
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <gnss_satellite.h>
|
||||
#include <glog/logging.h>
|
||||
|
||||
|
||||
void Glonass_Gnav_Navigation_Message::reset()
|
||||
@ -70,12 +71,9 @@ void Glonass_Gnav_Navigation_Message::reset()
|
||||
flag_utc_model_valid = false; //!< If set, it indicates that the UTC model parameters are filled
|
||||
flag_utc_model_str_5 = false; //!< Clock info send in string 5 of navigation data
|
||||
flag_utc_model_str_15 = false; //!< Clock info send in string 15 of frame 5 of navigation data
|
||||
flag_TOW_5 = false;
|
||||
flag_TOW_6 = false;
|
||||
flag_TOW_set = false; //!< it is true when page 5 or page 6 arrives
|
||||
|
||||
//broadcast orbit 1
|
||||
//TODO Need to send the information regarding the frame number
|
||||
flag_TOW_set = false;
|
||||
d_TOW = false; //!< Time of GPS Week of the ephemeris set (taken from subframes TOW) [s]
|
||||
d_TOW_F1 = false; //!< Time of GPS Week from HOW word of Subframe 1 [s]
|
||||
d_TOW_F2 = false; //!< Time of GPS Week from HOW word of Subframe 2 [s]
|
||||
@ -313,14 +311,14 @@ unsigned int Glonass_Gnav_Navigation_Message::get_frame_number(unsigned int sate
|
||||
}
|
||||
|
||||
|
||||
int Glonass_Gnav_Navigation_Message::string_decoder(char * frame_string)
|
||||
int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string)
|
||||
{
|
||||
int string_ID = 0;
|
||||
int J = 0;
|
||||
frame_ID = 0;
|
||||
|
||||
// UNPACK BYTES TO BITS AND REMOVE THE CRC REDUNDANCE
|
||||
std::bitset<GLONASS_GNAV_STRING_BITS> string_bits = std::bitset<GLONASS_GNAV_STRING_BITS>(std::string(frame_string));
|
||||
std::bitset<GLONASS_GNAV_STRING_BITS> string_bits = std::bitset<GLONASS_GNAV_STRING_BITS>((frame_string));
|
||||
string_ID = static_cast<int>(read_navigation_unsigned(string_bits, STRING_ID));
|
||||
|
||||
CRC_test(string_bits);
|
||||
@ -401,6 +399,7 @@ int Glonass_Gnav_Navigation_Message::string_decoder(char * frame_string)
|
||||
gnav_utc_model.d_tau_gps = static_cast<double>(read_navigation_signed(string_bits, TAU_GPS)) * TWO_N30;
|
||||
gnav_ephemeris.d_l5th_n = static_cast<double>(read_navigation_unsigned(string_bits, ALM_L_N));
|
||||
|
||||
flag_utc_model_str_5 = true;
|
||||
// Compute Year and DoY based on Algorithm A3.11 of GLONASS ICD
|
||||
if(flag_ephemeris_str_4 == true)
|
||||
{
|
||||
@ -487,7 +486,6 @@ int Glonass_Gnav_Navigation_Message::string_decoder(char * frame_string)
|
||||
flag_almanac_str_8 = true;
|
||||
|
||||
break;
|
||||
|
||||
case 9:
|
||||
// --- It is string 9 ----------------------------------------------
|
||||
if (flag_almanac_str_8 == true)
|
||||
@ -666,7 +664,7 @@ Glonass_Gnav_Utc_Model Glonass_Gnav_Navigation_Message::get_utc_model()
|
||||
}
|
||||
|
||||
|
||||
Glonass_Gnav_Almanac Glonass_Gnav_Navigation_Message::get_almanac( int satellite_slot_number)
|
||||
Glonass_Gnav_Almanac Glonass_Gnav_Navigation_Message::get_almanac(unsigned int satellite_slot_number)
|
||||
{
|
||||
return gnav_almanac[satellite_slot_number - 1];
|
||||
}
|
||||
@ -674,21 +672,17 @@ Glonass_Gnav_Almanac Glonass_Gnav_Navigation_Message::get_almanac( int satellite
|
||||
|
||||
bool Glonass_Gnav_Navigation_Message::have_new_ephemeris() //Check if we have a new ephemeris stored in the galileo navigation class
|
||||
{
|
||||
bool flag_data_valid = false;
|
||||
bool b_valid_ephemeris_set_flag = false;
|
||||
|
||||
if ((flag_ephemeris_str_1 == true) and (flag_ephemeris_str_2 == true) and (flag_ephemeris_str_3 == true) and (flag_ephemeris_str_4 == true))
|
||||
{
|
||||
//if all ephemeris pages have the same IOD, then they belong to the same block
|
||||
if ((gnav_ephemeris.d_t_b == 0) )
|
||||
if ((gnav_ephemeris.d_P_4 == 1) )
|
||||
{
|
||||
flag_ephemeris_str_1 = false;// clear the flag
|
||||
flag_ephemeris_str_2 = false;// clear the flag
|
||||
flag_ephemeris_str_3 = false;// clear the flag
|
||||
flag_ephemeris_str_4 = false;// clear the flag
|
||||
flag_all_ephemeris = true;
|
||||
// std::cout << "Ephemeris (1, 2, 3, 4) have been received and belong to the same batch" << std::endl;
|
||||
// std::cout << "Batch number: "<< IOD_ephemeris << std::endl;
|
||||
DLOG(INFO) << "Ephemeris (1, 2, 3, 4) have been received and belong to the same batch" << std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@ -703,10 +697,9 @@ bool Glonass_Gnav_Navigation_Message::have_new_ephemeris() //Check if we have a
|
||||
|
||||
bool Glonass_Gnav_Navigation_Message::have_new_utc_model() // Check if we have a new utc data set stored in the galileo navigation class
|
||||
{
|
||||
bool flag_utc_model = true;
|
||||
if (flag_utc_model == true)
|
||||
if (flag_utc_model_valid == true)
|
||||
{
|
||||
flag_utc_model = false; // clear the flag
|
||||
flag_utc_model_valid = false; // clear the flag
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
@ -63,17 +63,17 @@ public:
|
||||
bool flag_CRC_test;
|
||||
unsigned int frame_ID;
|
||||
|
||||
Glonass_Gnav_Ephemeris gnav_ephemeris; //!< Ephemeris information decoded
|
||||
Glonass_Gnav_Utc_Model gnav_utc_model; //!< UTC model information
|
||||
Glonass_Gnav_Almanac gnav_almanac[24]; //!< Almanac information for all 24 satellites
|
||||
Glonass_Gnav_Ephemeris gnav_ephemeris; //!< Ephemeris information decoded
|
||||
Glonass_Gnav_Utc_Model gnav_utc_model; //!< UTC model information
|
||||
Glonass_Gnav_Almanac gnav_almanac[24]; //!< Almanac information for all 24 satellites
|
||||
|
||||
//!< Satellite Identification
|
||||
int i_channel_ID; //!< Channel ID assigned by the receiver
|
||||
unsigned int i_satellite_freq_channel; //!< SV Frequency Slot Number
|
||||
unsigned int i_satellite_slot_number; //!< SV Orbit Slot Number
|
||||
int i_channel_ID; //!< Channel ID assigned by the receiver
|
||||
unsigned int i_satellite_freq_channel; //!< SV Frequency Slot Number
|
||||
unsigned int i_satellite_slot_number; //!< SV Orbit Slot Number
|
||||
|
||||
//!< Ephmeris Flags
|
||||
bool flag_all_ephemeris; //!< Flag indicating that all strings containing ephemeris have been received
|
||||
bool flag_all_ephemeris; //!< Flag indicating that all strings containing ephemeris have been received
|
||||
bool flag_ephemeris_str_1; //!< Flag indicating that ephemeris 1/4 (string 1) have been received
|
||||
bool flag_ephemeris_str_2; //!< Flag indicating that ephemeris 2/4 (string 2) have been received
|
||||
bool flag_ephemeris_str_3; //!< Flag indicating that ephemeris 3/4 (string 3) have been received
|
||||
@ -96,12 +96,10 @@ public:
|
||||
bool flag_utc_model_valid; //!< If set, it indicates that the UTC model parameters are filled
|
||||
bool flag_utc_model_str_5; //!< Clock info send in string 5 of navigation data
|
||||
bool flag_utc_model_str_15; //!< Clock info send in string 15 of frame 5 of navigation data
|
||||
bool flag_TOW_5;
|
||||
bool flag_TOW_6;
|
||||
bool flag_TOW_set; //!< it is true when page 5 or page 6 arrives
|
||||
|
||||
//broadcast orbit 1
|
||||
//TODO Need to send the information regarding the frame number
|
||||
bool flag_TOW_set;
|
||||
double d_TOW; //!< Time of GPS Week of the ephemeris set (taken from subframes TOW) [s]
|
||||
double d_TOW_F1; //!< Time of GPS Week from HOW word of Subframe 1 [s]
|
||||
double d_TOW_F2; //!< Time of GPS Week from HOW word of Subframe 2 [s]
|
||||
@ -136,7 +134,7 @@ public:
|
||||
/*
|
||||
* \brief Returns a Galileo_Almanac object filled with the latest navigation data received
|
||||
*/
|
||||
Glonass_Gnav_Almanac get_almanac(int satellite_slot_number);
|
||||
Glonass_Gnav_Almanac get_almanac(unsigned int satellite_slot_number);
|
||||
|
||||
/*
|
||||
* \brief Returns true if new Ephemeris has arrived. The flag is set to false when the function is executed
|
||||
@ -156,7 +154,7 @@ public:
|
||||
/*!
|
||||
* \brief Decodes the GLONASS GNAV string
|
||||
*/
|
||||
int string_decoder(char *string);
|
||||
int string_decoder(std::string frame_string);
|
||||
|
||||
/*!
|
||||
* \brief Computes the Coordinated Universal Time (UTC) and returns it in [s]
|
||||
|
@ -3960,7 +3960,7 @@ int Rtcm::set_DF041(const Gnss_Synchro & gnss_synchro)
|
||||
//TODO Need to fix the lambda value since it needs to include frequency channel
|
||||
int Rtcm::set_DF042(const Gnss_Synchro & gnss_synchro)
|
||||
{
|
||||
const double lambda = GLONASS_C_m_s / GLONASS_L1_FREQ_HZ;
|
||||
const double lambda = GLONASS_C_m_s / GLONASS_L1_CA_FREQ_HZ;
|
||||
double ambiguity = std::floor( gnss_synchro.Pseudorange_m / 599584.92 );
|
||||
double glonass_L1_pseudorange = std::round(( gnss_synchro.Pseudorange_m - ambiguity * 599584.92) / 0.02 );
|
||||
double glonass_L1_pseudorange_c = glonass_L1_pseudorange * 0.02 + ambiguity * 299792.458;
|
||||
@ -5272,7 +5272,7 @@ int Rtcm::set_DF401(const Gnss_Synchro & gnss_synchro)
|
||||
if ((sig.compare("1C") == 0) && (sys.compare("R") == 0 ))
|
||||
{
|
||||
// TODO Need to add slot number and freq number to gnss_syncro
|
||||
lambda = GLONASS_C_m_s / (GLONASS_L1_FREQ_HZ);
|
||||
lambda = GLONASS_C_m_s / (GLONASS_L1_CA_FREQ_HZ);
|
||||
}
|
||||
if ((sig.compare("2C") == 0) && (sys.compare("R") == 0 ))
|
||||
{
|
||||
@ -5382,7 +5382,7 @@ int Rtcm::set_DF404(const Gnss_Synchro & gnss_synchro)
|
||||
if ((sig_.compare("1C") == 0) && (sys_.compare("R") == 0 ))
|
||||
{
|
||||
//TODO Need to add slot number and freq number to gnss syncro
|
||||
lambda = GLONASS_C_m_s / (GLONASS_L1_FREQ_HZ);
|
||||
lambda = GLONASS_C_m_s / (GLONASS_L1_CA_FREQ_HZ);
|
||||
}
|
||||
if ((sig_.compare("2C") == 0) && (sys_.compare("R") == 0 ))
|
||||
{
|
||||
@ -5471,7 +5471,7 @@ int Rtcm::set_DF406(const Gnss_Synchro & gnss_synchro)
|
||||
if ((sig_.compare("1C") == 0) && (sys_.compare("R") == 0 ))
|
||||
{
|
||||
//TODO Need to add slot number and freq number to gnss syncro
|
||||
lambda = GLONASS_C_m_s / (GLONASS_L1_FREQ_HZ);
|
||||
lambda = GLONASS_C_m_s / (GLONASS_L1_CA_FREQ_HZ);
|
||||
}
|
||||
if ((sig_.compare("2C") == 0) && (sys_.compare("R") == 0 ))
|
||||
{
|
||||
|
@ -81,7 +81,7 @@ TEST(GlonassGnavNavigationMessageTest, String1Decoder)
|
||||
gnav_ephemeris.d_Xn = -11025.6669921875;
|
||||
|
||||
// Call target test method
|
||||
gnav_nav_message.string_decoder(const_cast<char*> (str1.c_str()));
|
||||
gnav_nav_message.string_decoder(str1);
|
||||
|
||||
// Perform assertions of decoded fields
|
||||
ASSERT_TRUE(gnav_ephemeris.d_P_1 - gnav_nav_message.gnav_ephemeris.d_P_1 < FLT_EPSILON );
|
||||
@ -116,7 +116,7 @@ TEST(GlonassGnavNavigationMessageTest, String2Decoder)
|
||||
// Call target test method
|
||||
gnav_nav_message.flag_ephemeris_str_1 = true;
|
||||
gnav_nav_message.gnav_ephemeris.d_P_1 = 15;
|
||||
gnav_nav_message.string_decoder(const_cast<char*> (str2.c_str()));
|
||||
gnav_nav_message.string_decoder(str2);
|
||||
|
||||
// Perform assertions of decoded fields
|
||||
ASSERT_TRUE(gnav_ephemeris.d_B_n - gnav_nav_message.gnav_ephemeris.d_B_n < FLT_EPSILON );
|
||||
@ -151,7 +151,7 @@ TEST(GlonassGnavNavigationMessageTest, String3Decoder)
|
||||
gnav_ephemeris.d_Zn = 19929.2377929688;
|
||||
|
||||
// Call target test method
|
||||
gnav_nav_message.string_decoder(const_cast<char*> (str3.c_str()));
|
||||
gnav_nav_message.string_decoder(str3);
|
||||
|
||||
// Perform assertions of decoded fields
|
||||
ASSERT_TRUE(gnav_ephemeris.d_P_3 - gnav_nav_message.gnav_ephemeris.d_P_3 < FLT_EPSILON );
|
||||
@ -188,7 +188,7 @@ TEST(GlonassGnavNavigationMessageTest, String4Decoder)
|
||||
gnav_ephemeris.d_M = 1;
|
||||
|
||||
// Call target test method
|
||||
gnav_nav_message.string_decoder(const_cast<char*> (str4.c_str()));
|
||||
gnav_nav_message.string_decoder(str4);
|
||||
|
||||
// Perform assertions of decoded fields
|
||||
ASSERT_TRUE(gnav_ephemeris.d_tau_n - gnav_nav_message.gnav_ephemeris.d_tau_n < FLT_EPSILON );
|
||||
@ -222,7 +222,7 @@ TEST(GlonassGnavNavigationMessageTest, String5Decoder)
|
||||
gnav_utc_model.d_tau_gps = 9.313225746154785e-08;
|
||||
|
||||
// Call target test method
|
||||
gnav_nav_message.string_decoder(const_cast<char*> (str5.c_str()));
|
||||
gnav_nav_message.string_decoder(str5);
|
||||
|
||||
// Perform assertions of decoded fields
|
||||
ASSERT_TRUE(gnav_utc_model.d_N_A - gnav_nav_message.gnav_utc_model.d_N_A < FLT_EPSILON );
|
||||
|
Loading…
Reference in New Issue
Block a user