1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-14 20:20:35 +00:00

Code indentation

This commit is contained in:
Carles Fernandez 2017-05-11 06:15:06 +02:00
parent 314b80e8ac
commit e82799d687

View File

@ -41,13 +41,10 @@
#include "Galileo_E1.h" #include "Galileo_E1.h"
#include "GPS_L1_CA.h" #include "GPS_L1_CA.h"
using google::LogMessage; using google::LogMessage;
hybrid_observables_cc_sptr hybrid_observables_cc_sptr hybrid_make_observables_cc(unsigned int nchannels, bool dump, std::string dump_filename, unsigned int deep_history)
hybrid_make_observables_cc(unsigned int nchannels, bool dump, std::string dump_filename, unsigned int deep_history)
{ {
return hybrid_observables_cc_sptr(new hybrid_observables_cc(nchannels, dump, dump_filename, deep_history)); return hybrid_observables_cc_sptr(new hybrid_observables_cc(nchannels, dump, dump_filename, deep_history));
} }
@ -105,25 +102,31 @@ bool Hybrid_pairCompare_gnss_synchro_sample_counter(const std::pair<int,Gnss_Syn
return (a.second.Tracking_sample_counter) < (b.second.Tracking_sample_counter); return (a.second.Tracking_sample_counter) < (b.second.Tracking_sample_counter);
} }
bool Hybrid_valueCompare_gnss_synchro_sample_counter(const Gnss_Synchro& a, unsigned long int b) bool Hybrid_valueCompare_gnss_synchro_sample_counter(const Gnss_Synchro& a, unsigned long int b)
{ {
return (a.Tracking_sample_counter) < (b); return (a.Tracking_sample_counter) < (b);
} }
bool Hybrid_valueCompare_gnss_synchro_receiver_time(const Gnss_Synchro& a, double b) bool Hybrid_valueCompare_gnss_synchro_receiver_time(const Gnss_Synchro& a, double b)
{ {
return (((double)a.Tracking_sample_counter+a.Code_phase_samples)/(double)a.fs) < (b); return (((double)a.Tracking_sample_counter+a.Code_phase_samples)/(double)a.fs) < (b);
} }
bool Hybrid_pairCompare_gnss_synchro_d_TOW(const std::pair<int,Gnss_Synchro>& a, const std::pair<int,Gnss_Synchro>& b) bool Hybrid_pairCompare_gnss_synchro_d_TOW(const std::pair<int,Gnss_Synchro>& a, const std::pair<int,Gnss_Synchro>& b)
{ {
return (a.second.TOW_at_current_symbol_s) < (b.second.TOW_at_current_symbol_s); return (a.second.TOW_at_current_symbol_s) < (b.second.TOW_at_current_symbol_s);
} }
bool Hybrid_valueCompare_gnss_synchro_d_TOW(const Gnss_Synchro& a, double b) bool Hybrid_valueCompare_gnss_synchro_d_TOW(const Gnss_Synchro& a, double b)
{ {
return (a.TOW_at_current_symbol_s) < (b); return (a.TOW_at_current_symbol_s) < (b);
} }
int hybrid_observables_cc::general_work (int noutput_items, int hybrid_observables_cc::general_work (int noutput_items,
gr_vector_int &ninput_items, gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items, gr_vector_const_void_star &input_items,
@ -157,7 +160,8 @@ int hybrid_observables_cc::general_work (int noutput_items,
} }
bool channel_history_ok; bool channel_history_ok;
do{ do
{
channel_history_ok = true; channel_history_ok = true;
for (unsigned int i = 0; i < d_nchannels; i++) for (unsigned int i = 0; i < d_nchannels; i++)
{ {
@ -224,26 +228,30 @@ int hybrid_observables_cc::general_work (int noutput_items,
realigned_gnss_synchro_map.insert(std::pair<int, Gnss_Synchro>( realigned_gnss_synchro_map.insert(std::pair<int, Gnss_Synchro>(
d_gnss_synchro_history_queue[i].at(distance-1).Channel_ID, d_gnss_synchro_history_queue[i].at(distance-1).Channel_ID,
d_gnss_synchro_history_queue[i].at(distance-1))); d_gnss_synchro_history_queue[i].at(distance-1)));
adjacent_gnss_synchro_map.insert(std::pair<int, Gnss_Synchro>(gnss_synchro_deque_iter->Channel_ID, adjacent_gnss_synchro_map.insert(std::pair<int, Gnss_Synchro>(gnss_synchro_deque_iter->Channel_ID, *gnss_synchro_deque_iter));
*gnss_synchro_deque_iter)); }
}else{ else
realigned_gnss_synchro_map.insert(std::pair<int, Gnss_Synchro>(gnss_synchro_deque_iter->Channel_ID, {
*gnss_synchro_deque_iter)); realigned_gnss_synchro_map.insert(std::pair<int, Gnss_Synchro>(gnss_synchro_deque_iter->Channel_ID, *gnss_synchro_deque_iter));
adjacent_gnss_synchro_map.insert(std::pair<int, Gnss_Synchro>( adjacent_gnss_synchro_map.insert(std::pair<int, Gnss_Synchro>(
d_gnss_synchro_history_queue[i].at(distance-1).Channel_ID, d_gnss_synchro_history_queue[i].at(distance-1).Channel_ID,
d_gnss_synchro_history_queue[i].at(distance-1))); d_gnss_synchro_history_queue[i].at(distance-1)));
} }
}else{ }
realigned_gnss_synchro_map.insert(std::pair<int, Gnss_Synchro>(gnss_synchro_deque_iter->Channel_ID, else
*gnss_synchro_deque_iter)); {
realigned_gnss_synchro_map.insert(std::pair<int, Gnss_Synchro>(gnss_synchro_deque_iter->Channel_ID, *gnss_synchro_deque_iter));
} }
}else{ }
else
{
//std::cout<<"ch["<<i<<"] delta_T_rx:"<<delta_T_rx_s*1000.0<<std::endl; //std::cout<<"ch["<<i<<"] delta_T_rx:"<<delta_T_rx_s*1000.0<<std::endl;
} }
} }
} }
} }
if(!realigned_gnss_synchro_map.empty()) if(!realigned_gnss_synchro_map.empty())
{ {
/* /*
@ -259,26 +267,16 @@ int hybrid_observables_cc::general_work (int noutput_items,
// compute interpolated TOW value at T_rx_s // compute interpolated TOW value at T_rx_s
int ref_channel_key = gnss_synchro_map_iter->second.Channel_ID; int ref_channel_key = gnss_synchro_map_iter->second.Channel_ID;
Gnss_Synchro adj_obs = adjacent_gnss_synchro_map.at(ref_channel_key); Gnss_Synchro adj_obs = adjacent_gnss_synchro_map.at(ref_channel_key);
double ref_adj_T_rx_s=(double)adj_obs.Tracking_sample_counter/ref_fs_hz double ref_adj_T_rx_s = (double)adj_obs.Tracking_sample_counter / ref_fs_hz + adj_obs.Code_phase_samples / ref_fs_hz;
+adj_obs.Code_phase_samples/ref_fs_hz;
double d_TOW_reference = gnss_synchro_map_iter->second.TOW_at_current_symbol_s; double d_TOW_reference = gnss_synchro_map_iter->second.TOW_at_current_symbol_s;
double d_ref_T_rx_s=(double)gnss_synchro_map_iter->second.Tracking_sample_counter/ref_fs_hz double d_ref_T_rx_s = (double)gnss_synchro_map_iter->second.Tracking_sample_counter / ref_fs_hz + gnss_synchro_map_iter->second.Code_phase_samples / ref_fs_hz;
+gnss_synchro_map_iter->second.Code_phase_samples/ref_fs_hz;
double selected_T_rx_s = T_rx_s; double selected_T_rx_s = T_rx_s;
// two points linear interpolation using adjacent (adj) values: y=y1+(x-x1)*(y2-y1)/(x2-x1) // two points linear interpolation using adjacent (adj) values: y=y1+(x-x1)*(y2-y1)/(x2-x1)
double ref_TOW_at_T_rx_s = adj_obs.TOW_at_current_symbol_s + (selected_T_rx_s - ref_adj_T_rx_s) double ref_TOW_at_T_rx_s = adj_obs.TOW_at_current_symbol_s + (selected_T_rx_s - ref_adj_T_rx_s)
* (d_TOW_reference - adj_obs.TOW_at_current_symbol_s) / (d_ref_T_rx_s - ref_adj_T_rx_s); * (d_TOW_reference - adj_obs.TOW_at_current_symbol_s) / (d_ref_T_rx_s - ref_adj_T_rx_s);
//std::cout<<"DELTA T REF:"<<T_rx_s-ref_adj_T_rx_s<<std::endl;
//std::cout<<"ref TOW:"<<d_TOW_reference<<" ref_TOW_at_T_rx_s:"<<ref_TOW_at_T_rx_s<<std::endl;
// std::cout << std::fixed;
// std::cout << std::setprecision(2);
// std::cout<<"d_TOW_reference:"<<d_TOW_reference*1000.0<<std::endl;
//std::cout<<"OBS SV REF SAT: "<<gnss_synchro_map_iter->second.PRN<<std::endl;
// Now compute RX time differences due to the PRN alignment in the correlators // Now compute RX time differences due to the PRN alignment in the correlators
double traveltime_ms; double traveltime_ms;
double pseudorange_m; double pseudorange_m;
@ -290,30 +288,23 @@ int hybrid_observables_cc::general_work (int noutput_items,
{ {
channel_fs_hz = (double)gnss_synchro_map_iter->second.fs; channel_fs_hz = (double)gnss_synchro_map_iter->second.fs;
channel_TOW_s = gnss_synchro_map_iter->second.TOW_at_current_symbol_s; channel_TOW_s = gnss_synchro_map_iter->second.TOW_at_current_symbol_s;
channel_T_rx_s=(double)gnss_synchro_map_iter->second.Tracking_sample_counter/channel_fs_hz channel_T_rx_s = (double)gnss_synchro_map_iter->second.Tracking_sample_counter / channel_fs_hz + gnss_synchro_map_iter->second.Code_phase_samples / channel_fs_hz;
+gnss_synchro_map_iter->second.Code_phase_samples/channel_fs_hz;
// compute interpolated observation values // compute interpolated observation values
// two points linear interpolation using adjacent (adj) values: y=y1+(x-x1)*(y2-y1)/(x2-x1) // two points linear interpolation using adjacent (adj) values: y=y1+(x-x1)*(y2-y1)/(x2-x1)
// TOW at the selected receiver time T_rx_s // TOW at the selected receiver time T_rx_s
int element_key = gnss_synchro_map_iter->second.Channel_ID; int element_key = gnss_synchro_map_iter->second.Channel_ID;
adj_obs = adjacent_gnss_synchro_map.at(element_key); adj_obs = adjacent_gnss_synchro_map.at(element_key);
double adj_T_rx_s=(double)adj_obs.Tracking_sample_counter/channel_fs_hz double adj_T_rx_s = (double)adj_obs.Tracking_sample_counter / channel_fs_hz + adj_obs.Code_phase_samples / channel_fs_hz;
+adj_obs.Code_phase_samples/channel_fs_hz;
double channel_TOW_at_T_rx_s = adj_obs.TOW_at_current_symbol_s+(selected_T_rx_s-adj_T_rx_s) double channel_TOW_at_T_rx_s = adj_obs.TOW_at_current_symbol_s + (selected_T_rx_s - adj_T_rx_s) * (channel_TOW_s - adj_obs.TOW_at_current_symbol_s) / (channel_T_rx_s - adj_T_rx_s);
*(channel_TOW_s-adj_obs.TOW_at_current_symbol_s)/(channel_T_rx_s-adj_T_rx_s);
//Doppler and Accumulated carrier phase //Doppler and Accumulated carrier phase
double Carrier_phase_lin_rads = adj_obs.Carrier_phase_rads+(selected_T_rx_s-adj_T_rx_s) double Carrier_phase_lin_rads = adj_obs.Carrier_phase_rads + (selected_T_rx_s - adj_T_rx_s) * (gnss_synchro_map_iter->second.Carrier_phase_rads - adj_obs.Carrier_phase_rads) / (channel_T_rx_s - adj_T_rx_s);
*(gnss_synchro_map_iter->second.Carrier_phase_rads-adj_obs.Carrier_phase_rads)/(channel_T_rx_s-adj_T_rx_s); double Carrier_Doppler_lin_hz = adj_obs.Carrier_Doppler_hz + (selected_T_rx_s - adj_T_rx_s) * (gnss_synchro_map_iter->second.Carrier_Doppler_hz - adj_obs.Carrier_Doppler_hz) / (channel_T_rx_s - adj_T_rx_s);
double Carrier_Doppler_lin_hz = adj_obs.Carrier_Doppler_hz+(selected_T_rx_s-adj_T_rx_s)
*(gnss_synchro_map_iter->second.Carrier_Doppler_hz-adj_obs.Carrier_Doppler_hz)/(channel_T_rx_s-adj_T_rx_s);
//compute the pseudorange (no rx time offset correction) //compute the pseudorange (no rx time offset correction)
traveltime_ms = (ref_TOW_at_T_rx_s - channel_TOW_at_T_rx_s) * 1000.0 traveltime_ms = (ref_TOW_at_T_rx_s - channel_TOW_at_T_rx_s) * 1000.0 + GPS_STARTOFFSET_ms;
+ GPS_STARTOFFSET_ms;
//convert to meters //convert to meters
pseudorange_m = traveltime_ms * GPS_C_m_ms; // [m] pseudorange_m = traveltime_ms * GPS_C_m_ms; // [m]
// update the pseudorange object // update the pseudorange object
@ -325,17 +316,8 @@ int hybrid_observables_cc::general_work (int noutput_items,
current_gnss_synchro[gnss_synchro_map_iter->second.Channel_ID].Carrier_phase_rads = Carrier_phase_lin_rads; current_gnss_synchro[gnss_synchro_map_iter->second.Channel_ID].Carrier_phase_rads = Carrier_phase_lin_rads;
current_gnss_synchro[gnss_synchro_map_iter->second.Channel_ID].Carrier_Doppler_hz = Carrier_Doppler_lin_hz; current_gnss_synchro[gnss_synchro_map_iter->second.Channel_ID].Carrier_Doppler_hz = Carrier_Doppler_lin_hz;
//debug
//double delta_T_rx_s_previous=((double)adjacent_gnss_synchro_map.at(gnss_synchro_map_iter->second.Channel_ID).Tracking_sample_counter/(double)gnss_synchro_map_iter->second.fs - T_rx_s);
// std::cout<<"["<<gnss_synchro_map_iter->second.PRN<<"] delta_TOW at T_rx: "<<(ref_TOW_at_T_rx_s - channel_TOW_at_T_rx_s)*1000.0
// <<" [ms] delta_TOW_ms: "<<(d_TOW_reference - gnss_synchro_map_iter->second.TOW_at_current_symbol_s) * 1000.0
// <<" Pr: "<<pseudorange_m<<" [m]"
// <<std::endl;
} }
//std::cout<<std::endl;
if(d_dump == true) if(d_dump == true)
{ {
// MULTIPLEXED FILE RECORDING - Record results to file // MULTIPLEXED FILE RECORDING - Record results to file
@ -391,7 +373,5 @@ int hybrid_observables_cc::general_work (int noutput_items,
consume(i, n_consume[i]); //which input, how many items consume(i, n_consume[i]); //which input, how many items
} }
//std::cout<<"OBS noutput_items: "<<noutput_items<<std::endl;
return n_outputs; return n_outputs;
} }