mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-06-02 14:44:09 +00:00
code cleaning
This commit is contained in:
parent
8630cf2fbe
commit
7e04308a67
@ -124,7 +124,8 @@ int mixed_observables_cc::general_work (int noutput_items, gr_vector_int &ninput
|
|||||||
*/
|
*/
|
||||||
current_gnss_synchro[i].Flag_valid_pseudorange = false;
|
current_gnss_synchro[i].Flag_valid_pseudorange = false;
|
||||||
current_gnss_synchro[i].Pseudorange_m = 0.0;
|
current_gnss_synchro[i].Pseudorange_m = 0.0;
|
||||||
if(current_gnss_synchro[i].Signal[0]=='2'){
|
if(current_gnss_synchro[i].Signal[0] == '2')
|
||||||
|
{
|
||||||
if (current_gnss_synchro[i].Flag_valid_word) //if this channel have valid word
|
if (current_gnss_synchro[i].Flag_valid_word) //if this channel have valid word
|
||||||
{
|
{
|
||||||
//record the word structure in a map for pseudorange computation
|
//record the word structure in a map for pseudorange computation
|
||||||
|
@ -97,7 +97,6 @@ gps_l2_m_telemetry_decoder_cc::~gps_l2_m_telemetry_decoder_cc()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void gps_l2_m_telemetry_decoder_cc::forecast (int noutput_items, gr_vector_int &ninput_items_required)
|
void gps_l2_m_telemetry_decoder_cc::forecast (int noutput_items, gr_vector_int &ninput_items_required)
|
||||||
{
|
{
|
||||||
unsigned ninputs = ninput_items_required.size ();
|
unsigned ninputs = ninput_items_required.size ();
|
||||||
@ -106,15 +105,16 @@ void gps_l2_m_telemetry_decoder_cc::forecast (int noutput_items, gr_vector_int &
|
|||||||
//LOG(INFO) << "forecast(): " << "noutput_items=" << noutput_items << "\tninput_items_required ninput_items_required.size()=" << ninput_items_required.size();
|
//LOG(INFO) << "forecast(): " << "noutput_items=" << noutput_items << "\tninput_items_required ninput_items_required.size()=" << ninput_items_required.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void gps_l2_m_telemetry_decoder_cc::set_decimation(int decimation)
|
void gps_l2_m_telemetry_decoder_cc::set_decimation(int decimation)
|
||||||
{
|
{
|
||||||
d_decimation_output_factor = decimation;
|
d_decimation_output_factor = decimation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int gps_l2_m_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_int &ninput_items,
|
int gps_l2_m_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_int &ninput_items,
|
||||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
||||||
{
|
{
|
||||||
//LOG(INFO) << "general_work(): " << "noutput_items=" << noutput_items << "\toutput_items real size=" << output_items.size() << "\tninput_items size=" << ninput_items.size() << "\tinput_items real size=" << input_items.size() << "\tninput_items[0]=" << ninput_items[0];
|
|
||||||
// get pointers on in- and output gnss-synchro objects
|
// get pointers on in- and output gnss-synchro objects
|
||||||
const Gnss_Synchro *in = (const Gnss_Synchro *) input_items[0]; // input
|
const Gnss_Synchro *in = (const Gnss_Synchro *) input_items[0]; // input
|
||||||
Gnss_Synchro *out = (Gnss_Synchro *) output_items[0]; // output
|
Gnss_Synchro *out = (Gnss_Synchro *) output_items[0]; // output
|
||||||
@ -125,13 +125,7 @@ int gps_l2_m_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_in
|
|||||||
bool flag_new_cnav_frame = false;
|
bool flag_new_cnav_frame = false;
|
||||||
int last_frame_preamble_start = 0;
|
int last_frame_preamble_start = 0;
|
||||||
// copy correlation samples into samples vector
|
// copy correlation samples into samples vector
|
||||||
//for (int i = 0; i < noutput_items; i++)
|
|
||||||
/// {
|
|
||||||
// check if channel is in tracking state
|
|
||||||
// {
|
|
||||||
d_sample_buf.push_back(in[0].Prompt_I);
|
d_sample_buf.push_back(in[0].Prompt_I);
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
consume_each(1); //one by one
|
consume_each(1); //one by one
|
||||||
|
|
||||||
@ -142,54 +136,33 @@ int gps_l2_m_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_in
|
|||||||
{
|
{
|
||||||
//LOG(INFO)<< "Discarting channel "<<d_channel<<" tracking not ready!"<<std::endl;
|
//LOG(INFO)<< "Discarting channel "<<d_channel<<" tracking not ready!"<<std::endl;
|
||||||
d_flag_valid_word = false;
|
d_flag_valid_word = false;
|
||||||
}else{
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
d_flag_invert_buffer_symbols = d_flag_invert_input_symbols;
|
d_flag_invert_buffer_symbols = d_flag_invert_input_symbols;
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (d_flag_invert_buffer_symbols == true)
|
if (d_flag_invert_buffer_symbols == true)
|
||||||
{
|
{
|
||||||
// for (int m=0;m<d_sample_buf.size();m++)
|
|
||||||
// {
|
|
||||||
// d_sample_buf.at(m)=-d_sample_buf.at(m);
|
|
||||||
// }
|
|
||||||
for (std::vector<double>::iterator symbol_it = d_sample_buf.begin(); symbol_it != d_sample_buf.end(); symbol_it++)
|
for (std::vector<double>::iterator symbol_it = d_sample_buf.begin(); symbol_it != d_sample_buf.end(); symbol_it++)
|
||||||
{
|
{
|
||||||
*symbol_it = -(*symbol_it);
|
*symbol_it = -(*symbol_it);
|
||||||
}
|
}
|
||||||
//LOG(INFO)<<"Inverting buffer symbols";
|
//LOG(INFO)<<"Inverting buffer symbols";
|
||||||
}
|
}
|
||||||
|
|
||||||
//debug
|
|
||||||
// std::stringstream ss2;
|
|
||||||
// for (std::vector<double>::const_iterator symbol_it = d_sample_buf.begin(); symbol_it < d_sample_buf.end(); ++symbol_it)
|
|
||||||
// {
|
|
||||||
//
|
|
||||||
// ss2<<*symbol_it<<",";
|
|
||||||
// if(*symbol_it>=0)
|
|
||||||
// {
|
|
||||||
// ss2<<'1';
|
|
||||||
// }else{
|
|
||||||
// ss2<<'0';
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//LOG(INFO)<<"get_symbols="<<ss2.str();
|
|
||||||
|
|
||||||
|
|
||||||
// align symbols in pairs
|
// align symbols in pairs
|
||||||
// and obtain the bits by decoding the symbols (viterbi decoder)
|
// and obtain the bits by decoding the symbols (viterbi decoder)
|
||||||
// they can be already aligned or shifted by one position
|
// they can be already aligned or shifted by one position
|
||||||
std::vector<int> bits;
|
std::vector<int> bits;
|
||||||
bool symbol_alignment = d_symbol_aligner_and_decoder.get_bits(d_sample_buf, bits);
|
bool symbol_alignment = d_symbol_aligner_and_decoder.get_bits(d_sample_buf, bits);
|
||||||
|
|
||||||
std::stringstream ss;
|
//std::stringstream ss;
|
||||||
|
//for (std::vector<int>::const_iterator bit_it = bits.begin(); bit_it < bits.end(); ++bit_it)
|
||||||
for (std::vector<int>::const_iterator bit_it = bits.begin(); bit_it < bits.end(); ++bit_it)
|
// {
|
||||||
{
|
// ss << *bit_it;
|
||||||
ss << *bit_it;
|
// }
|
||||||
}
|
|
||||||
|
|
||||||
// LOG(INFO) << "get_bits=" << ss.str() << std::endl;
|
// LOG(INFO) << "get_bits=" << ss.str() << std::endl;
|
||||||
|
|
||||||
// search for preambles
|
// search for preambles
|
||||||
// and extract the corresponding message candidates
|
// and extract the corresponding message candidates
|
||||||
std::vector<msg_candiate_int_t> msg_candidates;
|
std::vector<msg_candiate_int_t> msg_candidates;
|
||||||
@ -204,11 +177,15 @@ int gps_l2_m_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_in
|
|||||||
if (d_flag_invert_buffer_symbols == d_flag_invert_input_symbols)
|
if (d_flag_invert_buffer_symbols == d_flag_invert_input_symbols)
|
||||||
{
|
{
|
||||||
d_flag_invert_buffer_symbols = not d_flag_invert_buffer_symbols;
|
d_flag_invert_buffer_symbols = not d_flag_invert_buffer_symbols;
|
||||||
}else{//already tested the symbol inversion but CRC still fail
|
}
|
||||||
|
else
|
||||||
|
{//already tested the symbol inversion but CRC still fail
|
||||||
LOG(INFO) << "Discarting this buffer, no CNAV frames detected CH " << this->d_channel;
|
LOG(INFO) << "Discarting this buffer, no CNAV frames detected CH " << this->d_channel;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}else{ //at least one frame has good CRC, keep the invert sign for the next frames
|
}
|
||||||
|
else
|
||||||
|
{ //at least one frame has good CRC, keep the invert sign for the next frames
|
||||||
d_flag_invert_input_symbols = d_flag_invert_buffer_symbols;
|
d_flag_invert_input_symbols = d_flag_invert_buffer_symbols;
|
||||||
std::vector<int> tmp_msg;
|
std::vector<int> tmp_msg;
|
||||||
std::string msg;
|
std::string msg;
|
||||||
@ -250,7 +227,6 @@ int gps_l2_m_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_in
|
|||||||
//1. Copy the current tracking output
|
//1. Copy the current tracking output
|
||||||
current_synchro_data = in[0];
|
current_synchro_data = in[0];
|
||||||
|
|
||||||
|
|
||||||
if (d_flag_valid_word == true)
|
if (d_flag_valid_word == true)
|
||||||
{
|
{
|
||||||
double Prn_timestamp_at_preamble_ms = 0;
|
double Prn_timestamp_at_preamble_ms = 0;
|
||||||
@ -267,7 +243,9 @@ int gps_l2_m_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_in
|
|||||||
current_synchro_data.Flag_preamble = false;
|
current_synchro_data.Flag_preamble = false;
|
||||||
current_synchro_data.Prn_timestamp_ms = in[0].Tracking_timestamp_secs * 1000.0;
|
current_synchro_data.Prn_timestamp_ms = in[0].Tracking_timestamp_secs * 1000.0;
|
||||||
current_synchro_data.Prn_timestamp_at_preamble_ms = Prn_timestamp_at_preamble_ms;
|
current_synchro_data.Prn_timestamp_at_preamble_ms = Prn_timestamp_at_preamble_ms;
|
||||||
}else{
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
d_TOW_at_current_symbol = d_TOW_at_Preamble + (d_block_size - last_frame_preamble_start) * GPS_L2_M_PERIOD;
|
d_TOW_at_current_symbol = d_TOW_at_Preamble + (d_block_size - last_frame_preamble_start) * GPS_L2_M_PERIOD;
|
||||||
current_synchro_data.d_TOW = d_TOW_at_Preamble;
|
current_synchro_data.d_TOW = d_TOW_at_Preamble;
|
||||||
current_synchro_data.d_TOW_at_current_symbol = d_TOW_at_current_symbol;
|
current_synchro_data.d_TOW_at_current_symbol = d_TOW_at_current_symbol;
|
||||||
@ -277,7 +255,9 @@ int gps_l2_m_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_in
|
|||||||
current_synchro_data.Prn_timestamp_at_preamble_ms = Prn_timestamp_at_preamble_ms;
|
current_synchro_data.Prn_timestamp_at_preamble_ms = Prn_timestamp_at_preamble_ms;
|
||||||
}
|
}
|
||||||
current_synchro_data.Flag_valid_word = true;
|
current_synchro_data.Flag_valid_word = true;
|
||||||
}else{
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
current_synchro_data.Flag_valid_word = false;
|
current_synchro_data.Flag_valid_word = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -448,12 +428,12 @@ void gps_l2_m_telemetry_decoder_cc::frame_detector::get_frame_candidates(const s
|
|||||||
|
|
||||||
// ### helper class for checking the CRC of the message candidates ###
|
// ### helper class for checking the CRC of the message candidates ###
|
||||||
|
|
||||||
|
|
||||||
void gps_l2_m_telemetry_decoder_cc::crc_verifier::reset()
|
void gps_l2_m_telemetry_decoder_cc::crc_verifier::reset()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void gps_l2_m_telemetry_decoder_cc::crc_verifier::get_valid_frames(const std::vector<msg_candiate_int_t> msg_candidates, std::vector<msg_candiate_int_t> &valid_msgs)
|
void gps_l2_m_telemetry_decoder_cc::crc_verifier::get_valid_frames(const std::vector<msg_candiate_int_t> msg_candidates, std::vector<msg_candiate_int_t> &valid_msgs)
|
||||||
{
|
{
|
||||||
std::vector <unsigned char> tmp_msg;
|
std::vector <unsigned char> tmp_msg;
|
||||||
@ -481,11 +461,9 @@ void gps_l2_m_telemetry_decoder_cc::crc_verifier::get_valid_frames(const std::ve
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void gps_l2_m_telemetry_decoder_cc::crc_verifier::zerropad_back_and_convert_to_bytes(const std::vector<int> msg_candidate, std::vector<unsigned char> &bytes)
|
void gps_l2_m_telemetry_decoder_cc::crc_verifier::zerropad_back_and_convert_to_bytes(const std::vector<int> msg_candidate, std::vector<unsigned char> &bytes)
|
||||||
{
|
{
|
||||||
std::stringstream ss;
|
//std::stringstream ss;
|
||||||
const size_t bits_per_byte = 8;
|
const size_t bits_per_byte = 8;
|
||||||
unsigned char byte = 0;
|
unsigned char byte = 0;
|
||||||
//LOG(INFO) << "zerropad_back_and_convert_to_bytes():" << byte;
|
//LOG(INFO) << "zerropad_back_and_convert_to_bytes():" << byte;
|
||||||
@ -494,7 +472,7 @@ void gps_l2_m_telemetry_decoder_cc::crc_verifier::zerropad_back_and_convert_to_b
|
|||||||
int idx_bit = candidate_bit_it - msg_candidate.begin();
|
int idx_bit = candidate_bit_it - msg_candidate.begin();
|
||||||
int bit_pos_in_current_byte = (bits_per_byte - 1) - (idx_bit % bits_per_byte);
|
int bit_pos_in_current_byte = (bits_per_byte - 1) - (idx_bit % bits_per_byte);
|
||||||
byte |= (unsigned char)(*candidate_bit_it) << bit_pos_in_current_byte;
|
byte |= (unsigned char)(*candidate_bit_it) << bit_pos_in_current_byte;
|
||||||
ss << *candidate_bit_it;
|
// ss << *candidate_bit_it;
|
||||||
if (idx_bit % bits_per_byte == bits_per_byte - 1)
|
if (idx_bit % bits_per_byte == bits_per_byte - 1)
|
||||||
{
|
{
|
||||||
bytes.push_back(byte);
|
bytes.push_back(byte);
|
||||||
@ -512,7 +490,7 @@ void gps_l2_m_telemetry_decoder_cc::crc_verifier::zerropad_back_and_convert_to_b
|
|||||||
|
|
||||||
void gps_l2_m_telemetry_decoder_cc::crc_verifier::zerropad_front_and_convert_to_bytes(const std::vector<int> msg_candidate, std::vector<unsigned char> &bytes)
|
void gps_l2_m_telemetry_decoder_cc::crc_verifier::zerropad_front_and_convert_to_bytes(const std::vector<int> msg_candidate, std::vector<unsigned char> &bytes)
|
||||||
{
|
{
|
||||||
std::stringstream ss;
|
//std::stringstream ss;
|
||||||
const size_t bits_per_byte = 8;
|
const size_t bits_per_byte = 8;
|
||||||
unsigned char byte = 0;
|
unsigned char byte = 0;
|
||||||
int idx_bit = 6; // insert 6 zeros at the front to fit the 250bits into a multiple of bytes
|
int idx_bit = 6; // insert 6 zeros at the front to fit the 250bits into a multiple of bytes
|
||||||
@ -521,7 +499,7 @@ void gps_l2_m_telemetry_decoder_cc::crc_verifier::zerropad_front_and_convert_to_
|
|||||||
{
|
{
|
||||||
int bit_pos_in_current_byte = (bits_per_byte - 1) - (idx_bit % bits_per_byte);
|
int bit_pos_in_current_byte = (bits_per_byte - 1) - (idx_bit % bits_per_byte);
|
||||||
byte |= (unsigned char)(*candidate_bit_it) << bit_pos_in_current_byte;
|
byte |= (unsigned char)(*candidate_bit_it) << bit_pos_in_current_byte;
|
||||||
ss << *candidate_bit_it;
|
// ss << *candidate_bit_it;
|
||||||
if (idx_bit % bits_per_byte == bits_per_byte - 1)
|
if (idx_bit % bits_per_byte == bits_per_byte - 1)
|
||||||
{
|
{
|
||||||
bytes.push_back(byte);
|
bytes.push_back(byte);
|
||||||
@ -536,11 +514,13 @@ void gps_l2_m_telemetry_decoder_cc::crc_verifier::zerropad_front_and_convert_to_
|
|||||||
// << std::setfill(' ') << std::resetiosflags(std::ios::hex);
|
// << std::setfill(' ') << std::resetiosflags(std::ios::hex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void gps_l2_m_telemetry_decoder_cc::set_iono_queue(concurrent_queue<Gps_CNAV_Iono> *iono_queue)
|
void gps_l2_m_telemetry_decoder_cc::set_iono_queue(concurrent_queue<Gps_CNAV_Iono> *iono_queue)
|
||||||
{
|
{
|
||||||
d_iono_queue = iono_queue;
|
d_iono_queue = iono_queue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void gps_l2_m_telemetry_decoder_cc::set_ephemeris_queue(concurrent_queue<Gps_CNAV_Ephemeris> *ephemeris_queue)
|
void gps_l2_m_telemetry_decoder_cc::set_ephemeris_queue(concurrent_queue<Gps_CNAV_Ephemeris> *ephemeris_queue)
|
||||||
{
|
{
|
||||||
d_ephemeris_queue = ephemeris_queue;
|
d_ephemeris_queue = ephemeris_queue;
|
||||||
|
@ -70,7 +70,9 @@ public:
|
|||||||
// queues to communicate broadcasted CNAV data to other blocks of GNSS-SDR
|
// queues to communicate broadcasted CNAV data to other blocks of GNSS-SDR
|
||||||
void set_iono_queue(concurrent_queue<Gps_CNAV_Iono> *iono_queue); //!< Set iono queue
|
void set_iono_queue(concurrent_queue<Gps_CNAV_Iono> *iono_queue); //!< Set iono queue
|
||||||
void set_ephemeris_queue(concurrent_queue<Gps_CNAV_Ephemeris> *ephemeris_queue); //!< Set ephemeris queue
|
void set_ephemeris_queue(concurrent_queue<Gps_CNAV_Ephemeris> *ephemeris_queue); //!< Set ephemeris queue
|
||||||
|
|
||||||
void set_decimation(int decimation);
|
void set_decimation(int decimation);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief This is where all signal processing takes place
|
* \brief This is where all signal processing takes place
|
||||||
*/
|
*/
|
||||||
@ -158,7 +160,6 @@ private:
|
|||||||
void zerropad_back_and_convert_to_bytes(const std::vector<int> msg_candidate, std::vector<unsigned char> &bytes);
|
void zerropad_back_and_convert_to_bytes(const std::vector<int> msg_candidate, std::vector<unsigned char> &bytes);
|
||||||
} d_crc_verifier;
|
} d_crc_verifier;
|
||||||
|
|
||||||
|
|
||||||
Gps_CNAV_Navigation_Message d_CNAV_Message;
|
Gps_CNAV_Navigation_Message d_CNAV_Message;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
#include <complex>
|
#include <complex>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <utility> // std::pair
|
#include <utility> // std::pair
|
||||||
#include <gnss_satellite.h>
|
#include "gnss_satellite.h"
|
||||||
#include "MATH_CONSTANTS.h"
|
#include "MATH_CONSTANTS.h"
|
||||||
|
|
||||||
// Physical constants
|
// Physical constants
|
||||||
|
@ -57,6 +57,7 @@ void Gps_CNAV_Navigation_Message::reset()
|
|||||||
d_satvel_Z = 0;
|
d_satvel_Z = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Gps_CNAV_Navigation_Message::Gps_CNAV_Navigation_Message()
|
Gps_CNAV_Navigation_Message::Gps_CNAV_Navigation_Message()
|
||||||
{
|
{
|
||||||
reset();
|
reset();
|
||||||
@ -68,6 +69,7 @@ Gps_CNAV_Navigation_Message::Gps_CNAV_Navigation_Message()
|
|||||||
b_flag_iono_valid = false;
|
b_flag_iono_valid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Gps_CNAV_Navigation_Message::print_gps_word_bytes(unsigned int GPS_word)
|
void Gps_CNAV_Navigation_Message::print_gps_word_bytes(unsigned int GPS_word)
|
||||||
{
|
{
|
||||||
std::cout << " Word =";
|
std::cout << " Word =";
|
||||||
@ -75,6 +77,7 @@ void Gps_CNAV_Navigation_Message::print_gps_word_bytes(unsigned int GPS_word)
|
|||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Gps_CNAV_Navigation_Message::read_navigation_bool(std::bitset<GPS_L2_CNAV_DATA_PAGE_BITS> bits, const std::vector<std::pair<int,int>> parameter)
|
bool Gps_CNAV_Navigation_Message::read_navigation_bool(std::bitset<GPS_L2_CNAV_DATA_PAGE_BITS> bits, const std::vector<std::pair<int,int>> parameter)
|
||||||
{
|
{
|
||||||
bool value;
|
bool value;
|
||||||
@ -174,26 +177,16 @@ void Gps_CNAV_Navigation_Message::decode_page(std::vector<int> data)
|
|||||||
{
|
{
|
||||||
std::bitset<GPS_L2_CNAV_DATA_PAGE_BITS> data_bits;
|
std::bitset<GPS_L2_CNAV_DATA_PAGE_BITS> data_bits;
|
||||||
|
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
// std::cout<<"data length="<<data.size()<<std::endl;
|
|
||||||
// std::cout<<"data=";
|
|
||||||
// for (int p=0;p<data.size();p++)
|
|
||||||
// {
|
|
||||||
// std::cout<<data.at(p)<<",";
|
|
||||||
// }
|
|
||||||
// std::cout<<std::endl;
|
|
||||||
|
|
||||||
for(int i = 0; i < GPS_L2_CNAV_DATA_PAGE_BITS; i++)
|
for(int i = 0; i < GPS_L2_CNAV_DATA_PAGE_BITS; i++)
|
||||||
{
|
{
|
||||||
//std::cout<<"byte["<<i<<"]="<<(int)data[i]<<std::endl;
|
data_bits[i] = static_cast<uint8_t>(data[GPS_L2_CNAV_DATA_PAGE_BITS - i - 1]);
|
||||||
data_bits[i]=(uint8_t)data[GPS_L2_CNAV_DATA_PAGE_BITS-i-1];
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//std::cout<<"bitset="<<data_bits<<std::endl;
|
catch(std::exception &e)
|
||||||
// try {
|
{
|
||||||
// data_bits=std::bitset<GPS_L2_CNAV_DATA_PAGE_BITS>(data);
|
|
||||||
} catch(std::exception &e) {
|
|
||||||
std::cout << "Exception converting to bitset " << e.what() << std::endl;
|
std::cout << "Exception converting to bitset " << e.what() << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -319,6 +312,8 @@ void Gps_CNAV_Navigation_Message::decode_page(std::vector<int> data)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Gps_CNAV_Navigation_Message::have_new_ephemeris() //Check if we have a new ephemeris stored in the galileo navigation class
|
bool Gps_CNAV_Navigation_Message::have_new_ephemeris() //Check if we have a new ephemeris stored in the galileo navigation class
|
||||||
{
|
{
|
||||||
if (b_flag_ephemeris_1 == true and b_flag_ephemeris_2 == true)
|
if (b_flag_ephemeris_1 == true and b_flag_ephemeris_2 == true)
|
||||||
@ -330,10 +325,13 @@ bool Gps_CNAV_Navigation_Message::have_new_ephemeris() //Check if we have a new
|
|||||||
b_flag_ephemeris_1 = false;// clear the flag
|
b_flag_ephemeris_1 = false;// clear the flag
|
||||||
b_flag_ephemeris_2 = false;// clear the flag
|
b_flag_ephemeris_2 = false;// clear the flag
|
||||||
return true;
|
return true;
|
||||||
}else{
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -352,12 +350,14 @@ bool Gps_CNAV_Navigation_Message::have_new_iono() //Check if we have a new iono
|
|||||||
{
|
{
|
||||||
b_flag_iono_valid = false;// clear the flag
|
b_flag_iono_valid = false;// clear the flag
|
||||||
return true;
|
return true;
|
||||||
}else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Gps_CNAV_Iono Gps_CNAV_Navigation_Message::get_iono()
|
Gps_CNAV_Iono Gps_CNAV_Navigation_Message::get_iono()
|
||||||
{
|
{
|
||||||
return iono_record;
|
return iono_record;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*!
|
/*!
|
||||||
* \file Gps_CNAV_Navigation_Message.h
|
* \file gps_cnav_navigation_message.h
|
||||||
* \brief Interface of a GPS NAV Data message decoder
|
* \brief Interface of a GPS CNAV Data message decoder
|
||||||
* \author Javier Arribas, 2015. jarribas(at)cttc.es
|
* \author Javier Arribas, 2015. jarribas(at)cttc.es
|
||||||
*
|
*
|
||||||
* -------------------------------------------------------------------------
|
* -------------------------------------------------------------------------
|
||||||
@ -32,16 +32,16 @@
|
|||||||
#ifndef GNSS_SDR_Gps_CNAV_Navigation_Message_H_
|
#ifndef GNSS_SDR_Gps_CNAV_Navigation_Message_H_
|
||||||
#define GNSS_SDR_Gps_CNAV_Navigation_Message_H_
|
#define GNSS_SDR_Gps_CNAV_Navigation_Message_H_
|
||||||
|
|
||||||
|
#include "stdint.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <bitset>
|
#include <bitset>
|
||||||
#include "stdint.h"
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include "boost/assign.hpp"
|
#include <boost/assign.hpp>
|
||||||
#include "GPS_L2C.h"
|
#include "GPS_L2C.h"
|
||||||
#include "gps_cnav_ephemeris.h"
|
#include "gps_cnav_ephemeris.h"
|
||||||
#include "gps_cnav_iono.h"
|
#include "gps_cnav_iono.h"
|
||||||
@ -69,7 +69,6 @@ private:
|
|||||||
Gps_CNAV_Utc_Model utc_model_record;
|
Gps_CNAV_Utc_Model utc_model_record;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
double d_TOW;
|
double d_TOW;
|
||||||
bool b_flag_ephemeris_1;
|
bool b_flag_ephemeris_1;
|
||||||
bool b_flag_ephemeris_2;
|
bool b_flag_ephemeris_2;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user