1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-11-13 21:34:57 +00:00

Merge branch 'next' of https://github.com/gnss-sdr/gnss-sdr into next

This commit is contained in:
Carles Fernandez 2019-05-06 18:51:20 +02:00
commit 1c73533b8f
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
8 changed files with 1794 additions and 1710 deletions

View File

@ -1871,19 +1871,22 @@ if(Protobuf_FOUND AND CMAKE_VERSION VERSION_LESS 3.9)
endif() endif()
endif() endif()
if(Protobuf_FOUND AND CMAKE_CROSSCOMPILING) if(Protobuf_FOUND AND CMAKE_CROSSCOMPILING)
find_program(PROTOC_EXECUTABLE protoc)
if(NOT PROTOC_EXECUTABLE)
find_program(PROTOC_EXECUTABLE protoc find_program(PROTOC_EXECUTABLE protoc
HINTS HINTS
/usr/local/bin/
/usr/bin/ /usr/bin/
NO_SYSTEM_ENVIRONMENT_PATH /usr/local/bin/
) )
endif()
if(PROTOC_EXECUTABLE) if(PROTOC_EXECUTABLE)
set_target_properties(protobuf::protoc PROPERTIES set_target_properties(protobuf::protoc PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
IMPORTED_LOCATION ${PROTOC_EXECUTABLE} IMPORTED_LOCATION ${PROTOC_EXECUTABLE}
) )
set(Protobuf_PROTOC_EXECUTABLE ${PROTOC_EXECUTABLE})
else() else()
message(FATAL ERROR "Please install the Protocol Buffers compiter v${Protobuf_VERSION} in the host machine") message(FATAL_ERROR "Please install the Protocol Buffers compiler v${Protobuf_VERSION} in the host machine")
endif() endif()
endif() endif()
if((NOT Protobuf_FOUND) OR (NOT Protobuf_PROTOC_EXECUTABLE) OR (${Protobuf_VERSION} VERSION_LESS ${GNSSSDR_PROTOBUF_MIN_VERSION})) if((NOT Protobuf_FOUND) OR (NOT Protobuf_PROTOC_EXECUTABLE) OR (${Protobuf_VERSION} VERSION_LESS ${GNSSSDR_PROTOBUF_MIN_VERSION}))

View File

@ -71,7 +71,7 @@ $ sudo apt-get install build-essential cmake git libboost-dev libboost-date-time
libgtest-dev libprotobuf-dev protobuf-compiler libgtest-dev libprotobuf-dev protobuf-compiler
~~~~~~ ~~~~~~
Please note that the required files from `libgtest-dev` were moved to `googletest` in Debian 9 "stretch" and Ubuntu 18.04 "bionic", and moved back again to `libgtest-dev` in Debian 10 "buster" and Ubuntu 18.10 "cosmic". Please note that the required files from `libgtest-dev` were moved to `googletest` in Debian 9 "stretch" and Ubuntu 18.04 "bionic", and moved back again to `libgtest-dev` in Debian 10 "buster" and Ubuntu 18.10 "cosmic" (and above).
**Note for Ubuntu 14.04 LTS "trusty" users:** you will need to build from source and install GNU Radio manually, as explained below, since GNSS-SDR requires `gnuradio-dev` >= 3.7.3, and Ubuntu 14.04 came with 3.7.2. Install all the packages above BUT EXCEPT `libuhd-dev`, `gnuradio-dev` and `gr-osmosdr` (and remove them if they are already installed in your machine), and install those dependencies using PyBOMBS. The same applies to `libmatio-dev`: Ubuntu 14.04 came with 1.5.2 and the minimum required version is 1.5.3. Please do not install the `libmatio-dev` package and install `libtool`, `automake` and `libhdf5-dev` instead. A recent version of the library will be downloaded and built automatically if CMake does not find it installed. **Note for Ubuntu 14.04 LTS "trusty" users:** you will need to build from source and install GNU Radio manually, as explained below, since GNSS-SDR requires `gnuradio-dev` >= 3.7.3, and Ubuntu 14.04 came with 3.7.2. Install all the packages above BUT EXCEPT `libuhd-dev`, `gnuradio-dev` and `gr-osmosdr` (and remove them if they are already installed in your machine), and install those dependencies using PyBOMBS. The same applies to `libmatio-dev`: Ubuntu 14.04 came with 1.5.2 and the minimum required version is 1.5.3. Please do not install the `libmatio-dev` package and install `libtool`, `automake` and `libhdf5-dev` instead. A recent version of the library will be downloaded and built automatically if CMake does not find it installed.
@ -120,7 +120,7 @@ $ sudo yum install make automake gcc gcc-c++ kernel-devel cmake git boost-devel
boost-serialization log4cpp-devel gnuradio-devel gr-osmosdr-devel \ boost-serialization log4cpp-devel gnuradio-devel gr-osmosdr-devel \
blas-devel lapack-devel matio-devel armadillo-devel gflags-devel \ blas-devel lapack-devel matio-devel armadillo-devel gflags-devel \
glog-devel openssl-devel libpcap-devel python-mako python-six \ glog-devel openssl-devel libpcap-devel python-mako python-six \
pugixml-devel protobuf-devel pugixml-devel protobuf-devel protobuf-compiler
~~~~~~ ~~~~~~
Once you have installed these packages, you can jump directly to [download the source code and build GNSS-SDR](#download-and-build-linux). Once you have installed these packages, you can jump directly to [download the source code and build GNSS-SDR](#download-and-build-linux).
@ -130,13 +130,23 @@ Once you have installed these packages, you can jump directly to [download the s
If you are using openSUSE Leap: If you are using openSUSE Leap:
~~~~~~
zypper install cmake git gcc-c++ boost-devel libboost_atomic-devel \
libboost_system-devel libboost_filesystem-devel libboost_chrono-devel \
libboost_thread-devel libboost_serialization-devel log4cpp-devel \
gnuradio-devel pugixml-devel libpcap-devel armadillo-devel libtool \
automake hdf5-devel openssl-devel python-Mako python-six protobuf-devel
~~~~~~
If you are using openSUSE Tumbleweed:
~~~~~~ ~~~~~~
zypper install cmake git gcc-c++ boost-devel libboost_atomic-devel \ zypper install cmake git gcc-c++ boost-devel libboost_atomic-devel \
libboost_system-devel libboost_filesystem-devel libboost_date_time-devel \ libboost_system-devel libboost_filesystem-devel libboost_date_time-devel \
libboost_thread-devel libboost_chrono-devel libboost_serialization-devel \ libboost_thread-devel libboost_chrono-devel libboost_serialization-devel \
log4cpp-devel gtest gnuradio-devel pugixml-devel libpcap-devel \ log4cpp-devel gtest gnuradio-devel pugixml-devel libpcap-devel \
armadillo-devel libtool automake hdf5-devel libopenssl-devel python-Mako \ armadillo-devel libtool automake hdf5-devel libopenssl-devel \
python-six protobuf-devel python3-Mako python3-six protobuf-devel
~~~~~~ ~~~~~~
Once you have installed these packages, you can jump directly to [download the source code and build GNSS-SDR](#download-and-build-linux). Once you have installed these packages, you can jump directly to [download the source code and build GNSS-SDR](#download-and-build-linux).

View File

@ -108,6 +108,9 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
gr::io_signature::make(nchannels, nchannels, sizeof(Gnss_Synchro)), gr::io_signature::make(nchannels, nchannels, sizeof(Gnss_Synchro)),
gr::io_signature::make(0, 0, 0)) gr::io_signature::make(0, 0, 0))
{ {
// Send feedback message to observables block with the receiver clock offset
this->message_port_register_out(pmt::mp("pvt_to_observables"));
d_output_rate_ms = conf_.output_rate_ms; d_output_rate_ms = conf_.output_rate_ms;
d_display_rate_ms = conf_.display_rate_ms; d_display_rate_ms = conf_.display_rate_ms;
d_dump = conf_.dump; d_dump = conf_.dump;
@ -1434,6 +1437,14 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
// } // }
if (d_pvt_solver->get_PVT(gnss_observables_map, false)) if (d_pvt_solver->get_PVT(gnss_observables_map, false))
{
double Rx_clock_offset_s = d_pvt_solver->get_time_offset_s();
if (fabs(Rx_clock_offset_s) > 0.001)
{
this->message_port_pub(pmt::mp("pvt_to_observables"), pmt::make_any(Rx_clock_offset_s));
LOG(INFO) << "Sent clock offset correction to observables: " << Rx_clock_offset_s << "[s]";
}
else
{ {
//Optional debug code: export observables snapshot for rtklib unit testing //Optional debug code: export observables snapshot for rtklib unit testing
//std::cout << "step 1: save gnss_synchro map" << std::endl; //std::cout << "step 1: save gnss_synchro map" << std::endl;
@ -1442,10 +1453,10 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
//end debug //end debug
if (d_display_rate_ms != 0) if (d_display_rate_ms != 0)
{ {
if (current_RX_time_ms % d_display_rate_ms == 0) // if (current_RX_time_ms % d_display_rate_ms == 0)
{ // {
flag_display_pvt = true; flag_display_pvt = true;
} // }
} }
if (d_rtcm_MT1019_rate_ms != 0) // allows deactivating messages by setting rate = 0 if (d_rtcm_MT1019_rate_ms != 0) // allows deactivating messages by setting rate = 0
{ {
@ -3341,6 +3352,7 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
} }
} }
} }
}
// DEBUG MESSAGE: Display position in console output // DEBUG MESSAGE: Display position in console output
if (d_pvt_solver->is_valid_position() and flag_display_pvt) if (d_pvt_solver->is_valid_position() and flag_display_pvt)

View File

@ -52,6 +52,33 @@ hybrid_observables_gs_sptr hybrid_observables_gs_make(unsigned int nchannels_in,
return hybrid_observables_gs_sptr(new hybrid_observables_gs(nchannels_in, nchannels_out, dump, dump_mat, std::move(dump_filename))); return hybrid_observables_gs_sptr(new hybrid_observables_gs(nchannels_in, nchannels_out, dump, dump_mat, std::move(dump_filename)));
} }
void hybrid_observables_gs::msg_handler_pvt_to_observables(const pmt::pmt_t &msg)
{
gr::thread::scoped_lock lock(d_setlock); // require mutex with work function called by the scheduler
try
{
if (pmt::any_ref(msg).type() == typeid(double))
{
double new_rx_clock_offset_s;
new_rx_clock_offset_s = boost::any_cast<double>(pmt::any_ref(msg));
T_rx_offset_ms = new_rx_clock_offset_s * 1000.0;
T_rx_TOW_ms = T_rx_TOW_ms - static_cast<int>(round(T_rx_offset_ms));
T_rx_remnant_to_20ms = (T_rx_TOW_ms % 20);
//d_Rx_clock_buffer.clear(); // Clear all the elements in the buffer
for (uint32_t n = 0; n < d_nchannels_out; n++)
{
d_gnss_synchro_history->clear(n);
}
LOG(INFO) << "Corrected new RX Time offset: " << T_rx_offset_ms << "[ms]";
}
}
catch (boost::bad_any_cast &e)
{
LOG(WARNING) << "msg_handler_pvt_to_observables Bad any cast!";
}
}
hybrid_observables_gs::hybrid_observables_gs(uint32_t nchannels_in, hybrid_observables_gs::hybrid_observables_gs(uint32_t nchannels_in,
uint32_t nchannels_out, uint32_t nchannels_out,
@ -61,12 +88,16 @@ hybrid_observables_gs::hybrid_observables_gs(uint32_t nchannels_in,
gr::io_signature::make(nchannels_in, nchannels_in, sizeof(Gnss_Synchro)), gr::io_signature::make(nchannels_in, nchannels_in, sizeof(Gnss_Synchro)),
gr::io_signature::make(nchannels_out, nchannels_out, sizeof(Gnss_Synchro))) gr::io_signature::make(nchannels_out, nchannels_out, sizeof(Gnss_Synchro)))
{ {
// PVT input message port
this->message_port_register_in(pmt::mp("pvt_to_observables"));
this->set_msg_handler(pmt::mp("pvt_to_observables"), boost::bind(&hybrid_observables_gs::msg_handler_pvt_to_observables, this, _1));
d_dump = dump; d_dump = dump;
d_dump_mat = dump_mat and d_dump; d_dump_mat = dump_mat and d_dump;
d_dump_filename = std::move(dump_filename); d_dump_filename = std::move(dump_filename);
d_nchannels_out = nchannels_out; d_nchannels_out = nchannels_out;
d_nchannels_in = nchannels_in; d_nchannels_in = nchannels_in;
T_rx_clock_step_samples = 0U; T_rx_offset_ms = 0;
d_gnss_synchro_history = new Gnss_circular_deque<Gnss_Synchro>(500, d_nchannels_out); d_gnss_synchro_history = new Gnss_circular_deque<Gnss_Synchro>(500, d_nchannels_out);
// ############# ENABLE DATA FILE LOG ################# // ############# ENABLE DATA FILE LOG #################
@ -114,6 +145,7 @@ hybrid_observables_gs::hybrid_observables_gs(uint32_t nchannels_in,
} }
} }
T_rx_TOW_ms = 0U; T_rx_TOW_ms = 0U;
T_rx_remnant_to_20ms = 0;
T_rx_step_ms = 20; //read from config at the adapter GNSS-SDR.observable_interval_ms!! T_rx_step_ms = 20; //read from config at the adapter GNSS-SDR.observable_interval_ms!!
T_rx_TOW_set = false; T_rx_TOW_set = false;
@ -410,6 +442,17 @@ bool hybrid_observables_gs::interp_trk_obs(Gnss_Synchro &interpolated_obs, const
interpolated_obs.Carrier_Doppler_hz = d_gnss_synchro_history->at(ch, t1_idx).Carrier_Doppler_hz + (d_gnss_synchro_history->at(ch, t2_idx).Carrier_Doppler_hz - d_gnss_synchro_history->at(ch, t1_idx).Carrier_Doppler_hz) * time_factor; interpolated_obs.Carrier_Doppler_hz = d_gnss_synchro_history->at(ch, t1_idx).Carrier_Doppler_hz + (d_gnss_synchro_history->at(ch, t2_idx).Carrier_Doppler_hz - d_gnss_synchro_history->at(ch, t1_idx).Carrier_Doppler_hz) * time_factor;
// TOW INTERPOLATION // TOW INTERPOLATION
interpolated_obs.interp_TOW_ms = static_cast<double>(d_gnss_synchro_history->at(ch, t1_idx).TOW_at_current_symbol_ms) + (static_cast<double>(d_gnss_synchro_history->at(ch, t2_idx).TOW_at_current_symbol_ms) - static_cast<double>(d_gnss_synchro_history->at(ch, t1_idx).TOW_at_current_symbol_ms)) * time_factor; interpolated_obs.interp_TOW_ms = static_cast<double>(d_gnss_synchro_history->at(ch, t1_idx).TOW_at_current_symbol_ms) + (static_cast<double>(d_gnss_synchro_history->at(ch, t2_idx).TOW_at_current_symbol_ms) - static_cast<double>(d_gnss_synchro_history->at(ch, t1_idx).TOW_at_current_symbol_ms)) * time_factor;
// LOG(INFO) << "Channel " << ch << " int idx: " << t1_idx << " TOW Int: " << interpolated_obs.interp_TOW_ms
// << " TOW p1 : " << d_gnss_synchro_history->at(ch, t1_idx).TOW_at_current_symbol_ms
// << " TOW p2: "
// << d_gnss_synchro_history->at(ch, t2_idx).TOW_at_current_symbol_ms
// << " t2-t1: "
// << d_gnss_synchro_history->at(ch, t2_idx).RX_time - d_gnss_synchro_history->at(ch, t1_idx).RX_time
// << " trx - t1: "
// << T_rx_s - d_gnss_synchro_history->at(ch, t1_idx).RX_time;
// //
// std::cout << "Rx samplestamp: " << T_rx_s << " Channel " << ch << " interp buff idx " << nearest_element // std::cout << "Rx samplestamp: " << T_rx_s << " Channel " << ch << " interp buff idx " << nearest_element
// << " ,diff: " << old_abs_diff << " samples (" << static_cast<double>(old_abs_diff) / static_cast<double>(d_gnss_synchro_history->at(ch, nearest_element).fs) << " s)\n"; // << " ,diff: " << old_abs_diff << " samples (" << static_cast<double>(old_abs_diff) / static_cast<double>(d_gnss_synchro_history->at(ch, nearest_element).fs) << " s)\n";
@ -459,6 +502,7 @@ void hybrid_observables_gs::update_TOW(const std::vector<Gnss_Synchro> &data)
} }
} }
T_rx_TOW_ms = TOW_ref - (TOW_ref % 20); T_rx_TOW_ms = TOW_ref - (TOW_ref % 20);
T_rx_remnant_to_20ms = 0;
} }
else else
{ {
@ -477,13 +521,14 @@ void hybrid_observables_gs::compute_pranges(std::vector<Gnss_Synchro> &data)
// std::cout.precision(17); // std::cout.precision(17);
// std::cout << " T_rx_TOW_ms: " << static_cast<double>(T_rx_TOW_ms) << std::endl; // std::cout << " T_rx_TOW_ms: " << static_cast<double>(T_rx_TOW_ms) << std::endl;
std::vector<Gnss_Synchro>::iterator it; std::vector<Gnss_Synchro>::iterator it;
double current_T_rx_TOW_s = (static_cast<double>(T_rx_TOW_ms - T_rx_remnant_to_20ms) + GPS_STARTOFFSET_MS) / 1000.0;
for (it = data.begin(); it != data.end(); it++) for (it = data.begin(); it != data.end(); it++)
{ {
if (it->Flag_valid_word) if (it->Flag_valid_word)
{ {
double traveltime_s = (static_cast<double>(T_rx_TOW_ms) - it->interp_TOW_ms + GPS_STARTOFFSET_MS) / 1000.0; double traveltime_s = current_T_rx_TOW_s - it->interp_TOW_ms / 1000.0;
//todo: check what happens during the week rollover (TOW rollover at 604800000s) //todo: check what happens during the week rollover (TOW rollover at 604800000ms)
it->RX_time = (static_cast<double>(T_rx_TOW_ms) + GPS_STARTOFFSET_MS) / 1000.0; it->RX_time = current_T_rx_TOW_s;
it->Pseudorange_m = traveltime_s * SPEED_OF_LIGHT; it->Pseudorange_m = traveltime_s * SPEED_OF_LIGHT;
it->Flag_valid_pseudorange = true; it->Flag_valid_pseudorange = true;
// debug code // debug code
@ -491,17 +536,11 @@ void hybrid_observables_gs::compute_pranges(std::vector<Gnss_Synchro> &data)
// std::cout << "[" << it->Channel_ID << "] interp_TOW_ms: " << it->interp_TOW_ms << std::endl; // std::cout << "[" << it->Channel_ID << "] interp_TOW_ms: " << it->interp_TOW_ms << std::endl;
// std::cout << "[" << it->Channel_ID << "] Diff T_rx_TOW_ms - interp_TOW_ms: " << static_cast<double>(T_rx_TOW_ms) - it->interp_TOW_ms << std::endl; // std::cout << "[" << it->Channel_ID << "] Diff T_rx_TOW_ms - interp_TOW_ms: " << static_cast<double>(T_rx_TOW_ms) - it->interp_TOW_ms << std::endl;
} }
else
{
it->RX_time = current_T_rx_TOW_s;
}
} }
// for (it = data.begin(); it != data.end(); it++)
// {
// if (it->Flag_valid_word)
// {
// std::cout << "[" << it->Channel_ID << "] Pseudorange_m: " << it->Pseudorange_m << std::endl;
// }
// }
// std::cout << std::endl;
// usleep(1000);
} }
@ -517,12 +556,6 @@ int hybrid_observables_gs::general_work(int noutput_items __attribute__((unused)
if (ninput_items[d_nchannels_in - 1] > 0) if (ninput_items[d_nchannels_in - 1] > 0)
{ {
d_Rx_clock_buffer.push_back(in[d_nchannels_in - 1][0].Tracking_sample_counter); d_Rx_clock_buffer.push_back(in[d_nchannels_in - 1][0].Tracking_sample_counter);
if (T_rx_clock_step_samples == 0)
{
T_rx_clock_step_samples = std::round(static_cast<double>(in[d_nchannels_in - 1][0].fs) * 1e-3); // 1 ms
LOG(INFO) << "Observables clock step samples set to " << T_rx_clock_step_samples;
}
// Consume one item from the clock channel (last of the input channels) // Consume one item from the clock channel (last of the input channels)
consume(d_nchannels_in - 1, 1); consume(d_nchannels_in - 1, 1);
} }
@ -541,6 +574,7 @@ int hybrid_observables_gs::general_work(int noutput_items __attribute__((unused)
if (d_gnss_synchro_history->front(n).PRN != in[n][m].PRN) if (d_gnss_synchro_history->front(n).PRN != in[n][m].PRN)
{ {
d_gnss_synchro_history->clear(n); d_gnss_synchro_history->clear(n);
// LOG(INFO) << "Channel " << d_gnss_synchro_history->front(n).Channel_ID << " changed satellite to PRN " << in[n][m].PRN;
} }
} }
d_gnss_synchro_history->push_back(n, in[n][m]); d_gnss_synchro_history->push_back(n, in[n][m]);
@ -557,7 +591,9 @@ int hybrid_observables_gs::general_work(int noutput_items __attribute__((unused)
for (uint32_t n = 0; n < d_nchannels_out; n++) for (uint32_t n = 0; n < d_nchannels_out; n++)
{ {
Gnss_Synchro interpolated_gnss_synchro{}; Gnss_Synchro interpolated_gnss_synchro{};
if (!interp_trk_obs(interpolated_gnss_synchro, n, d_Rx_clock_buffer.front()))
uint32_t T_rx_remnant_to_20ms_samples = T_rx_remnant_to_20ms * in[d_nchannels_in - 1][0].fs / 1000;
if (!interp_trk_obs(interpolated_gnss_synchro, n, d_Rx_clock_buffer.front() - T_rx_remnant_to_20ms_samples))
{ {
// Produce an empty observation // Produce an empty observation
interpolated_gnss_synchro = Gnss_Synchro(); interpolated_gnss_synchro = Gnss_Synchro();
@ -574,9 +610,20 @@ int hybrid_observables_gs::general_work(int noutput_items __attribute__((unused)
epoch_data.push_back(interpolated_gnss_synchro); epoch_data.push_back(interpolated_gnss_synchro);
} }
if (T_rx_TOW_set)
{
update_TOW(epoch_data);
}
else
{
if (n_valid > 0) if (n_valid > 0)
{ {
update_TOW(epoch_data); update_TOW(epoch_data);
}
}
if (n_valid > 0)
{
compute_pranges(epoch_data); compute_pranges(epoch_data);
} }

View File

@ -68,6 +68,7 @@ private:
friend hybrid_observables_gs_sptr friend hybrid_observables_gs_sptr
hybrid_observables_gs_make(uint32_t nchannels_in, uint32_t nchannels_out, bool dump, bool dump_mat, std::string dump_filename); hybrid_observables_gs_make(uint32_t nchannels_in, uint32_t nchannels_out, bool dump, bool dump_mat, std::string dump_filename);
hybrid_observables_gs(uint32_t nchannels_in, uint32_t nchannels_out, bool dump, bool dump_mat, std::string dump_filename); hybrid_observables_gs(uint32_t nchannels_in, uint32_t nchannels_out, bool dump, bool dump_mat, std::string dump_filename);
void msg_handler_pvt_to_observables(const pmt::pmt_t& msg);
bool interpolate_data(Gnss_Synchro& out, const uint32_t& ch, const double& ti); bool interpolate_data(Gnss_Synchro& out, const uint32_t& ch, const double& ti);
bool interp_trk_obs(Gnss_Synchro& interpolated_obs, const uint32_t& ch, const uint64_t& rx_clock); bool interp_trk_obs(Gnss_Synchro& interpolated_obs, const uint32_t& ch, const uint64_t& rx_clock);
double compute_T_rx_s(const Gnss_Synchro& a); double compute_T_rx_s(const Gnss_Synchro& a);
@ -79,11 +80,12 @@ private:
boost::circular_buffer<uint64_t> d_Rx_clock_buffer; boost::circular_buffer<uint64_t> d_Rx_clock_buffer;
//Tracking observable history //Tracking observable history
Gnss_circular_deque<Gnss_Synchro>* d_gnss_synchro_history; Gnss_circular_deque<Gnss_Synchro>* d_gnss_synchro_history;
uint32_t T_rx_clock_step_samples;
//rx time follow GPST //rx time follow GPST
bool T_rx_TOW_set; bool T_rx_TOW_set;
uint32_t T_rx_TOW_ms; uint32_t T_rx_TOW_ms;
uint32_t T_rx_remnant_to_20ms;
uint32_t T_rx_step_ms; uint32_t T_rx_step_ms;
double T_rx_offset_ms;
bool d_dump; bool d_dump;
bool d_dump_mat; bool d_dump_mat;
uint32_t d_nchannels_in; uint32_t d_nchannels_in;

View File

@ -147,24 +147,28 @@ void labsat23_source::decode_samples_one_channel(int16_t input_short, gr_complex
// bits per sample, 4 samples per int16 // bits per sample, 4 samples per int16
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
out[i] = gr_complex(0.0, 0.0); //out[i] = gr_complex(0.0, 0.0);
// In-Phase // In-Phase
if (bs[15 - 4 * i]) if (bs[15 - 4 * i])
{ {
if (bs[13 - 4 * i]) // 11 if (bs[13 - 4 * i]) // 11
{ {
out[i] += gr_complex(-1, 0); out[i] = gr_complex(-1, 0);
} }
else // 10 else // 10
{ {
out[i] += gr_complex(-2, 0); out[i] = gr_complex(-2, 0);
} }
} }
else else
{ {
if (bs[13 - 4 * i]) // 01 if (bs[13 - 4 * i]) // 01
{ {
out[i] += gr_complex(1, 0); out[i] = gr_complex(2, 0);
}
else
{
out[i] = gr_complex(1, 0);
} }
} }
@ -183,11 +187,15 @@ void labsat23_source::decode_samples_one_channel(int16_t input_short, gr_complex
else else
{ {
if (bs[12 - 4 * i]) // 01 if (bs[12 - 4 * i]) // 01
{
out[i] += gr_complex(0, 2);
}
else
{ {
out[i] += gr_complex(0, 1); out[i] += gr_complex(0, 1);
} }
} }
out[i] += gr_complex(0.5, 0.5); //out[i] += gr_complex(0.5, 0.5);
} }
break; break;
} }
@ -412,6 +420,7 @@ int labsat23_source::general_work(int noutput_items,
{ {
case 0: case 0:
// dual channel 2 bits per complex sample // dual channel 2 bits per complex sample
//todo: implement dual channel reader
break; break;
default: default:
// single channel 2 bits per complex sample (1 bit I + 1 bit Q, 8 samples per int16) // single channel 2 bits per complex sample (1 bit I + 1 bit Q, 8 samples per int16)
@ -473,6 +482,7 @@ int labsat23_source::general_work(int noutput_items,
{ {
case 0: case 0:
// dual channel // dual channel
//todo: implement dual channel reader
break; break;
default: default:
// single channel 4 bits per complex sample (2 bit I + 2 bit Q, 4 samples per int16) // single channel 4 bits per complex sample (2 bit I + 2 bit Q, 4 samples per int16)

View File

@ -64,14 +64,13 @@ void Tracking_2nd_PLL_filter::initialize()
/* /*
* PLL second order FIR filter * PLL second order IIR filter
* Req Input in [Hz/Ti] * Req Input in [Hz/Ti]
* The output is in [Hz/s]. * The output is in [Hz/s].
*/ */
float Tracking_2nd_PLL_filter::get_carrier_nco(float PLL_discriminator) float Tracking_2nd_PLL_filter::get_carrier_nco(float PLL_discriminator)
{ {
float carr_nco = d_old_carr_nco + (d_tau2_carr / d_tau1_carr) * (PLL_discriminator - d_old_carr_error) + (PLL_discriminator + d_old_carr_error) * (d_pdi_carr / (2.0 * d_tau1_carr)); float carr_nco = d_old_carr_nco + (d_tau2_carr / d_tau1_carr) * (PLL_discriminator - d_old_carr_error) + (PLL_discriminator + d_old_carr_error) * (d_pdi_carr / (2.0 * d_tau1_carr));
//carr_nco = d_old_carr_nco + (d_tau2_carr/d_tau1_carr)*(PLL_discriminator - d_old_carr_error) + PLL_discriminator * (d_pdi_carr/d_tau1_carr);
d_old_carr_nco = carr_nco; d_old_carr_nco = carr_nco;
d_old_carr_error = PLL_discriminator; d_old_carr_error = PLL_discriminator;
return carr_nco; return carr_nco;
@ -80,16 +79,15 @@ float Tracking_2nd_PLL_filter::get_carrier_nco(float PLL_discriminator)
Tracking_2nd_PLL_filter::Tracking_2nd_PLL_filter(float pdi_carr) Tracking_2nd_PLL_filter::Tracking_2nd_PLL_filter(float pdi_carr)
{ {
//--- PLL variables -------------------------------------------------------- // PLL variables
d_pdi_carr = pdi_carr; // Summation interval for carrier d_pdi_carr = pdi_carr; // Summation interval for carrier
//d_plldampingratio = 0.65;
d_plldampingratio = 0.7; d_plldampingratio = 0.7;
} }
Tracking_2nd_PLL_filter::Tracking_2nd_PLL_filter() Tracking_2nd_PLL_filter::Tracking_2nd_PLL_filter()
{ {
//--- PLL variables -------------------------------------------------------- // PLL variables
d_pdi_carr = 0.001; // Summation interval for carrier d_pdi_carr = 0.001; // Summation interval for carrier
d_plldampingratio = 0.7; d_plldampingratio = 0.7;
} }

View File

@ -677,6 +677,7 @@ void GNSSFlowgraph::connect()
top_block_->connect(observables_->get_right_block(), i, pvt_->get_left_block(), i); top_block_->connect(observables_->get_right_block(), i, pvt_->get_left_block(), i);
top_block_->msg_connect(channels_.at(i)->get_right_block(), pmt::mp("telemetry"), pvt_->get_left_block(), pmt::mp("telemetry")); top_block_->msg_connect(channels_.at(i)->get_right_block(), pmt::mp("telemetry"), pvt_->get_left_block(), pmt::mp("telemetry"));
} }
top_block_->msg_connect(pvt_->get_left_block(), pmt::mp("pvt_to_observables"), observables_->get_right_block(), pmt::mp("pvt_to_observables"));
} }
catch (const std::exception& e) catch (const std::exception& e)
{ {
@ -948,6 +949,7 @@ void GNSSFlowgraph::disconnect()
} }
top_block_->msg_disconnect(channels_.at(i)->get_right_block(), pmt::mp("telemetry"), pvt_->get_left_block(), pmt::mp("telemetry")); top_block_->msg_disconnect(channels_.at(i)->get_right_block(), pmt::mp("telemetry"), pvt_->get_left_block(), pmt::mp("telemetry"));
} }
top_block_->msg_disconnect(pvt_->get_left_block(), pmt::mp("pvt_to_observables"), observables_->get_right_block(), pmt::mp("pvt_to_observables"));
} }
catch (const std::exception& e) catch (const std::exception& e)
{ {