1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-11-14 06:07:12 +00:00

cleaning code for gsoc

This commit is contained in:
Sergi Segura
2018-08-12 23:58:16 +02:00
parent a699c80673
commit fc98fa6afe
14 changed files with 109 additions and 231 deletions

View File

@@ -451,6 +451,34 @@ bool rtklib_solver::get_PVT(const std::map<int, Gnss_Synchro>& gnss_observables_
}
break;
}
case 'C':
{
// BEIDOU B1I
// - find the ephemeris for the current BEIDOU SV observation. The SV PRN ID is the map key
std::string sig_(gnss_observables_iter->second.Signal);
if (sig_.compare("B1") == 0)
{
beidou_ephemeris_iter = beidou_ephemeris_map.find(gnss_observables_iter->second.PRN);
if (beidou_ephemeris_iter != beidou_ephemeris_map.cend())
{
// convert ephemeris from GNSS-SDR class to RTKLIB structure
eph_data[valid_obs] = eph_to_rtklib(beidou_ephemeris_iter->second);
// convert observation from GNSS-SDR class to RTKLIB structure
obsd_t newobs = {{0, 0}, '0', '0', {}, {}, {}, {}, {}, {}};
obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs,
gnss_observables_iter->second,
beidou_ephemeris_iter->second.i_BEIDOU_week,
0);
valid_obs++;
}
else // the ephemeris are not available for this SV
{
DLOG(INFO) << "No ephemeris data for SV " << gnss_observables_iter->first;
}
}
break;
}
default:
DLOG(INFO) << "Hybrid observables: Unknown GNSS";
break;

View File

@@ -1,11 +1,9 @@
/*!
* \file gps_l1_ca_pcps_acquisition.h
* \file beidou_bi1_pcps_acquisition.h
* \brief Adapts a PCPS acquisition block to an AcquisitionInterface for
* GPS L1 C/A signals
* Beidou B1I signals
* \authors <ul>
* <li> Javier Arribas, 2011. jarribas(at)cttc.es
* <li> Luis Esteve, 2012. luis(at)epsilon-formacion.com
* <li> Marc Molina, 2013. marc.molina.pena(at)gmail.com
* <li> Sergi Segura, 2018. sergi.segura.munoz(at)gmail.com
* </ul>
*
* -------------------------------------------------------------------------

View File

@@ -1,179 +0,0 @@
void decodeBCHBeidou(std::list<bool> *firstBranch_encoded, std::list<int> *output)
{
bool input[15];
std::copy(firstBranch_encoded.begin(),firstBranch_encoded.end(),input);
std::array<bool, 4> D_register = {0,0,0,0};
std::array<bool, 15> stage_buffer;
std::array<bool, 15> ROM_list_circuit;
for (i = 0; i < 15; i++)
{
D_register = {inputBit[i] ^ D_register[3], D_register[0] ^ D_register[3], D_register[1], D_register[2]};
stage_buffer[i] = inputBit[i];
}
if(D_register == {0,0,0,0}) {
ROM_list_circuit = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
} else if(D_register == {0,0,0,1}) {
ROM_list_circuit = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,1};
} else if(D_register == {0,0,1,0}) {
ROM_list_circuit = {0,0,0,0,0,0,0,0,0,0,0,0,0,1,0};
} else if(D_register == {0,0,1,1}) {
ROM_list_circuit = {0,0,0,0,0,0,0,0,0,0,1,0,0,0,0};
} else if(D_register == {0,1,0,0}) {
ROM_list_circuit = {0,0,0,0,0,0,0,0,0,0,0,0,1,0,0};
} else if(D_register == {0,1,0,1}) {
ROM_list_circuit = {0,0,0,0,0,0,1,0,0,0,0,0,0,0,0};
} else if(D_register == {0,1,1,0}) {
ROM_list_circuit = {0,0,0,0,0,0,0,0,0,1,0,0,0,0,0};
} else if(D_register == {0,1,1,1}) {
ROM_list_circuit = {0,0,0,0,1,0,0,0,0,0,0,0,0,0,0};
} else if(D_register == {1,0,0,0}) {
ROM_list_circuit = {0,0,0,0,0,0,0,0,0,0,0,1,0,0,0};
} else if(D_register == {1,0,0,1}) {
ROM_list_circuit = {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
} else if(D_register == {1,0,1,0}) {
ROM_list_circuit = {0,0,0,0,0,1,0,0,0,0,0,0,0,0,0};
} else if(D_register == {1,0,1,1}) {
ROM_list_circuit = {0,0,0,0,0,0,0,1,0,0,0,0,0,0,0};
} else if(D_register == {1,1,0,0}) {
ROM_list_circuit = {0,0,0,0,0,0,0,0,1,0,0,0,0,0,0};
} else if(D_register == {1,1,0,1}) {
ROM_list_circuit = {0,1,0,0,0,0,0,0,0,0,0,0,0,0,0};
} else if(D_register == {1,1,1,0}) {
ROM_list_circuit = {0,0,0,1,0,0,0,0,0,0,0,0,0,0,0};
} else if(D_register == {1,1,1,1}) {
ROM_list_circuit = {0,0,1,0,0,0,0,0,0,0,0,0,0,0,0};
}
for (i = 0; i < 15; i++)
{
if(stage_buffer[i] ^ ROM_list_circuit[i])
{
output.push_back(1);
}
else
{
output.push_back(-1);
}
}
}
void remove_NH_Beidou(bool *input, bool *output)
{
int *code_NH_Beidou = {-1,-1,-1,-1,-1,+1,-1,-1,+1,+1,-1,+1,-1,+1,-1,-1,+1,+1,+1,-1};
int corr_NH = 0;
int correlation = 0;
for (int i = 0; i < 20; i++)
{
if ((code_NH_Beidou[i] * input[i]) > 0.0)
{
corr_NH += 1;
}
else
{
corr_NH -= 1;
}
}
if (abs(corr_NH) == 20)
{
correlation = 1;
if (corr_NH > 0)
{
output = 1;
}
else
{
output = 0;
}
}
}
void process_TRK_output_Beidou(bool *input, int n_input_bits, int *output)
{
bool buffer_NH[15];
bool new_bit;
std::list<bool> firstBranch_encoded;
std::list<int> firstBranch_decoded;
std::list<bool> secondBranch_encoded;
std::list<int> secondBranch_decoded;
std::list<int> output_list;
for (int i = 0; i < n_input_bits/15; i++)
{
for (int j = 0; j < 15; i++)
{
buffer_NH[j] = input[i + j];
}
remove_NH_Beidou(buffer_NH, &new_bit)
if ( i % 2 == 0 )
{
firstBranch_encoded.push_back(new_bit);
}
else
{
secondBranch_encoded.push_back(new_bit);
}
if (firstBranch_encoded.size() == 15)
{
decodeBCHBeidou(&firstBranch_encoded, &firstBranch_decoded);
firstBranch_encoded.clear();
}
if (secondBranch_encoded.size() == 15)
{
decodeBCHBeidou(&secondBranch_encoded, &secondBranch_decoded);
secondBranch_encoded.clear();
}
if (firstBranch_decoded.size() > 10)
{
for (i = 0; i < 11; i++)
{
output_list.push_back(firstBranch_decoded.front());
firstBranch_decoded.pop_front();
}
}
if (secondBranch_decoded.size() > 10)
{
for (i = 0; i < 11; i++)
{
output_list.push_back(secondBranch_decoded.front());
secondBranch_decoded.pop_front();
}
}
}
std::copy(output_list.begin(),output_list.end(),output);
}

View File

@@ -65,6 +65,9 @@ obsd_t insert_obs_to_rtklib(obsd_t& rtklib_obs, const Gnss_Synchro& gnss_synchro
case 'R':
rtklib_obs.sat = gnss_synchro.PRN + NSATGPS;
break;
case 'C':
rtklib_obs.sat = gnss_synchro.PRN + NSATGPS + NSATGLO + NSATGAL;
break;
default:
rtklib_obs.sat = gnss_synchro.PRN;
@@ -227,6 +230,62 @@ eph_t eph_to_rtklib(const Gps_Ephemeris& gps_eph)
return rtklib_sat;
}
eph_t eph_to_rtklib(const Beidou_Ephemeris& bei_eph)
{
eph_t rtklib_sat = {0, 0, 0, 0, 0, 0, 0, 0, {0, 0}, {0, 0}, {0, 0}, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, {}, {}, 0.0, 0.0 };
rtklib_sat.sat = bei_eph.i_satellite_PRN;
rtklib_sat.A = bei_eph.d_sqrt_A * bei_eph.d_sqrt_A;
rtklib_sat.M0 = bei_eph.d_M_0;
rtklib_sat.deln = bei_eph.d_Delta_n;
rtklib_sat.OMG0 = bei_eph.d_OMEGA0;
rtklib_sat.OMGd = bei_eph.d_OMEGA_DOT;
rtklib_sat.omg = bei_eph.d_OMEGA;
rtklib_sat.i0 = bei_eph.d_i_0;
rtklib_sat.idot = bei_eph.d_IDOT;
rtklib_sat.e = bei_eph.d_e_eccentricity;
rtklib_sat.Adot = 0; //only in CNAV;
rtklib_sat.ndot = 0; //only in CNAV;
rtklib_sat.week = adjgpsweek(bei_eph.i_BEIDOU_week); /* week of tow */
rtklib_sat.cic = bei_eph.d_Cic;
rtklib_sat.cis = bei_eph.d_Cis;
rtklib_sat.cuc = bei_eph.d_Cuc;
rtklib_sat.cus = bei_eph.d_Cus;
rtklib_sat.crc = bei_eph.d_Crc;
rtklib_sat.crs = bei_eph.d_Crs;
rtklib_sat.f0 = bei_eph.d_A_f0;
rtklib_sat.f1 = bei_eph.d_A_f1;
rtklib_sat.f2 = bei_eph.d_A_f2;
rtklib_sat.tgd[0] = bei_eph.d_TGD1;
rtklib_sat.tgd[1] = 0.0;
rtklib_sat.tgd[2] = 0.0;
rtklib_sat.tgd[3] = 0.0;
rtklib_sat.toes = bei_eph.d_Toe;
rtklib_sat.toc = gpst2time(rtklib_sat.week, bei_eph.d_Toc);
rtklib_sat.ttr = gpst2time(rtklib_sat.week, bei_eph.d_TOW);
/* adjustment for week handover */
double tow, toc;
tow = time2gpst(rtklib_sat.ttr, &rtklib_sat.week);
toc = time2gpst(rtklib_sat.toc, NULL);
if (rtklib_sat.toes < tow - 302400.0)
{
rtklib_sat.week++;
tow -= 604800.0;
}
else if (rtklib_sat.toes > tow + 302400.0)
{
rtklib_sat.week--;
tow += 604800.0;
}
rtklib_sat.toe = gpst2time(rtklib_sat.week, rtklib_sat.toes);
rtklib_sat.toc = gpst2time(rtklib_sat.week, toc);
rtklib_sat.ttr = gpst2time(rtklib_sat.week, tow);
return rtklib_sat;
}
eph_t eph_to_rtklib(const Gps_CNAV_Ephemeris& gps_cnav_eph)
{

View File

@@ -38,10 +38,13 @@
#include "gps_cnav_ephemeris.h"
#include "glonass_gnav_ephemeris.h"
#include "glonass_gnav_utc_model.h"
#include "beidou_ephemeris.h"
eph_t eph_to_rtklib(const Galileo_Ephemeris& gal_eph);
eph_t eph_to_rtklib(const Gps_Ephemeris& gps_eph);
eph_t eph_to_rtklib(const Gps_CNAV_Ephemeris& gps_cnav_eph);
eph_t eph_to_rtklib(const Beidou_Ephemeris& bei_eph);
/*!
* \brief Transforms a Glonass_Gnav_Ephemeris to its RTKLIB counterpart
* \param glonass_gnav_eph GLONASS GNAV Ephemeris structure

View File

@@ -1,8 +1,8 @@
/*!
* \file gps_l1_ca_telemetry_decoder.cc
* \brief Implementation of an adapter of a GPS L1 C/A NAV data decoder block
* \file beidou_b1i_telemetry_decoder.cc
* \brief Implementation of an adapter of a Beidou B1I NAV data decoder block
* to a TelemetryDecoderInterface
* \author Javier Arribas, 2011. jarribas(at)cttc.es
* \author Sergi Segura, 2018. sergi.segura.munoz(at)gmail.com
*
* -------------------------------------------------------------------------
*

View File

@@ -1,8 +1,8 @@
/*!
* \file gps_l1_ca_telemetry_decoder.h
* \brief Interface of an adapter of a GPS L1 C/A NAV data decoder block
* \file beidou_b1i_telemetry_decoder.h
* \brief Interface of an adapter of a Beidou B1I NAV data decoder block
* to a TelemetryDecoderInterface
* \author Javier Arribas, 2011. jarribas(at)cttc.es
* \author Sergi Segura, 2018. sergi.segura.munoz(at)gmail.com
*
* -------------------------------------------------------------------------
*

View File

@@ -36,11 +36,6 @@
#include <gnuradio/io_signature.h>
#include <volk_gnsssdr/volk_gnsssdr.h>
#ifndef _rotl
#define _rotl(X, N) ((X << N) ^ (X >> (32 - N))) // Used in the parity check algorithm
#endif
using google::LogMessage;
beidou_b1i_telemetry_decoder_cc_sptr
@@ -180,7 +175,6 @@ void beidou_b1i_telemetry_decoder_cc::decodebch_bi1(int *bits, int *decbits)
{
int bit, err, reg[4] = {1, 1, 1, 1};
int errind[15] = {14, 13, 10, 12, 6, 9, 4, 11, 0, 5, 7, 8, 1, 3, 2};
uint8_t bin;
for (unsigned int i = 0; i < 15; i++)
{
@@ -208,7 +202,7 @@ void beidou_b1i_telemetry_decoder_cc::decodebch_bi1(int *bits, int *decbits)
void beidou_b1i_telemetry_decoder_cc::decode_word(int word_counter, boost::circular_buffer<signed int> *d_bit_buffer, unsigned int& d_BEIDOU_frame_4bytes)
{
d_BEIDOU_frame_4bytes = 0;
int bits[30], bitsdec[30], bitsbch[30], first_branch[15], second_branch[15];
int bitsdec[30], bitsbch[30], first_branch[15], second_branch[15];
if (word_counter == 1)
{
@@ -273,7 +267,6 @@ int beidou_b1i_telemetry_decoder_cc::general_work(int noutput_items __attribute_
double current_time_samples = current_symbol.Tracking_sample_counter;
double current_samples_fs = current_symbol.fs;
int symbol_value = 0;
bool Flag_valid_symbol_output = false;
d_symbol_nh_history.push_back(current_symbol.Prompt_I); //add new symbol to the symbol queue
consume_each(1);
@@ -353,7 +346,6 @@ int beidou_b1i_telemetry_decoder_cc::general_work(int noutput_items __attribute_
new_sym = false;
}*/
unsigned int required_symbols = BEIDOU_B1I_PREAMBLE_LENGTH_SYMBOLS;
d_flag_preamble = false;
@@ -469,7 +461,6 @@ int beidou_b1i_telemetry_decoder_cc::general_work(int noutput_items __attribute_
case 3: //we have a new set of ephemeris data for the current SV
*/ if (d_BEIDOU_FSM.d_nav.satellite_validation() == true)
{
std::cout << " we have a new set of ephemeris data for the current SV "<< std::endl;
// get ephemeris object for this SV (mandatory)
std::shared_ptr<Beidou_Ephemeris> tmp_obj = std::make_shared<Beidou_Ephemeris>(d_BEIDOU_FSM.d_nav.get_ephemeris());
@@ -479,7 +470,6 @@ std::cout << " we have a new set of ephemeris data for the current SV "<< std::e
case 4: // Possible IONOSPHERE and UTC model update (page 18)
*/ if (d_BEIDOU_FSM.d_nav.flag_iono_valid == true)
{
std::cout << " we have a new set of iono data for the current SV "<< std::endl;
std::shared_ptr<Beidou_Iono> tmp_obj = std::make_shared<Beidou_Iono>(d_BEIDOU_FSM.d_nav.get_iono());
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
@@ -507,7 +497,7 @@ std::cout << " we have a new set of utc data for the current SV "<< std::endl;
//2. Add the telemetry decoder information
if (this->d_flag_preamble == true and d_flag_new_tow_available == true)
{
d_TOW_at_current_symbol_ms = static_cast<unsigned int>(d_BEIDOU_FSM.d_nav.d_SOW) * 1000 + BEIDOU_B1I_CODE_PERIOD_MS + BEIDOU_B1I_PREAMBLE_DURATION_MS;
d_TOW_at_current_symbol_ms = static_cast<unsigned int>(d_BEIDOU_FSM.d_nav.d_SOW) * 1000 + 599;
d_TOW_at_Preamble_ms = d_TOW_at_current_symbol_ms;
flag_TOW_set = true;
d_flag_new_tow_available = false;

View File

@@ -1,5 +1,5 @@
/*!
* \file gps_l1_ca_subframe_fsm.h
* \file beidou_b1i_subframe_fsm.h
* \brief Interface of a BEIDOU NAV message word-to-subframe decoder state machine
* \author Sergi Segura, 2018. sergi.segura.munoz(at)gmail.com
*

View File

@@ -1,10 +1,8 @@
/*!
* \file beidou_b1i_dll_pll_tracking.cc
* \brief Implementation of an adapter of a DLL+PLL tracking loop block
* for GPS L1 C/A to a TrackingInterface
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
* Javier Arribas, 2011. jarribas(at)cttc.es
* Sergi Segura, 2018. sergi.segura.munoz@gmail.com
* for Beidou B1I to a TrackingInterface
* \author Sergi Segura, 2018. sergi.segura.munoz@gmail.com
*
* Code DLL + carrier PLL according to the algorithms described in:
* K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H.Jensen,

View File

@@ -1,9 +1,8 @@
/*!
* \file gps_l1_ca_dll_pll_tracking.h
* \file beidou_b1i_dll_pll_tracking.h
* \brief Interface of an adapter of a DLL+PLL tracking loop block
* for GPS L1 C/A to a TrackingInterface
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
* Javier Arribas, 2011. jarribas(at)cttc.es
* for Beidou B1I to a TrackingInterface
* \author Sergi Segura, 2018. sergi.segura.munoz(at)gmail.com
*
* Code DLL + carrier PLL according to the algorithms described in:
* K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H.Jensen,