diff --git a/src/algorithms/PVT/libs/vtl_engine.cc b/src/algorithms/PVT/libs/vtl_engine.cc index 458ae1684..8aeaa0abc 100755 --- a/src/algorithms/PVT/libs/vtl_engine.cc +++ b/src/algorithms/PVT/libs/vtl_engine.cc @@ -232,6 +232,8 @@ bool Vtl_Engine::vtl_loop(Vtl_Data& new_data) kf_yerr = kf_H * kf_xerr; // Filtered pseudorange error measurement (in m) AND Filtered Doppler shift measurements (in Hz): + TrackingCmd trk_cmd; + for (int32_t channel = 0; channel < new_data.sat_number; channel++) // Measurement vector { rho_pri_filt(channel) = new_data.pr_m(channel) + kf_yerr(channel); // now filtered @@ -243,7 +245,6 @@ bool Vtl_Engine::vtl_loop(Vtl_Data& new_data) //TODO: Fill the tracking commands outputs // Notice: keep the same satellite order as in the Vtl_Data matrices // sample code - TrackingCmd trk_cmd; trk_cmd.carrier_phase_rads = 0; // difficult of calculation trk_cmd.carrier_freq_hz = doppler_hz_filt(channel) + kf_x(7)/ Lambda_GPS_L1;//+ kf_x(7)/Lambda_GPS_L1; // this is el doppler WITHOUTH sintony correction trk_cmd.carrier_freq_rate_hz_s = 0; diff --git a/src/algorithms/tracking/gnuradio_blocks/kf_tracking.cc b/src/algorithms/tracking/gnuradio_blocks/kf_tracking.cc index 627ab5089..4e80beb2f 100644 --- a/src/algorithms/tracking/gnuradio_blocks/kf_tracking.cc +++ b/src/algorithms/tracking/gnuradio_blocks/kf_tracking.cc @@ -634,20 +634,23 @@ void kf_tracking::msg_handler_pvt_to_trk(const pmt::pmt_t &msg) if (pmt::any_ref(msg).type().hash_code() == typeid(const std::shared_ptr).hash_code()) { const auto cmd = wht::any_cast>(pmt::any_ref(msg)); + //std::cout<< "test cast CH "<sample_counter <<"\n"; if (cmd->channel_id == this->d_channel) { + + arma::vec x_tmp; + arma::mat F_tmp; + gr::thread::scoped_lock lock(d_setlock); //To.Do: apply VTL corrections to the KF states double delta_t_s = static_cast(d_sample_counter - cmd->sample_counter) / d_trk_parameters.fs_in; - arma::mat F_tmp; + // states: code_phase_chips, carrier_phase_rads, carrier_freq_hz, carrier_freq_rate_hz_s + x_tmp = {cmd->code_phase_chips, cmd->carrier_phase_rads, cmd->carrier_freq_hz, cmd->carrier_freq_rate_hz_s}; //ToDO: check state propagation, at least Doppler propagation does NOT work, see debug traces F_tmp = {{1.0, 0.0, d_beta * delta_t_s, d_beta * (delta_t_s * delta_t_s) / 2.0}, {0.0, 1.0, 2.0 * GNSS_PI * delta_t_s, GNSS_PI * (delta_t_s * delta_t_s)}, {0.0, 0.0, 1.0, delta_t_s}, {0.0, 0.0, 0.0, 1.0}}; - arma::vec x_tmp; - // states: code_phase_chips, carrier_phase_rads, carrier_freq_hz, carrier_freq_rate_hz_s - x_tmp = {cmd->code_phase_chips, cmd->carrier_phase_rads, cmd->carrier_freq_hz, cmd->carrier_freq_rate_hz_s}; // TODO: Replace only the desired states and leave the others as stored in d_x_old_old vector (e.g replace only the carrier_freq_hz) //arma::vec tmp_x = F_tmp * x_tmp; double old_doppler = d_x_old_old(2); @@ -661,13 +664,14 @@ void kf_tracking::msg_handler_pvt_to_trk(const pmt::pmt_t &msg) // << " SampleCounter origin: " << cmd->sample_counter // << " Doppler new state: " << x_tmp(2) << " vs. trk state: " << old_doppler << " [Hz]" // << " [s]\n"; - if(this->d_channel ==0) + if(cmd->channel_id ==0) { - std::cout << "CH " << this->d_channel << " RX pvt-to-trk cmd with delay: " - << static_cast(d_sample_counter - cmd->sample_counter) / d_trk_parameters.fs_in + std::cout << "CH " << cmd->channel_id << " RX pvt-to-trk cmd with delay: " + << delta_t_s << "[s]" << " SampleCounter origin: " << cmd->sample_counter << " Doppler new state: " << x_tmp(2) << " vs. trk state: " << old_doppler << " [Hz]" - << " [s]\n"; + << "\n"; + std::cout << "use count " <