mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-14 20:20:35 +00:00
Improve data types and string comparisons
This commit is contained in:
parent
5f01161af6
commit
cc58fbe30f
@ -171,11 +171,11 @@ const double CNAV_DELTA_TLS_LSB = 1;
|
||||
const std::vector<std::pair<int32_t, int32_t> > CNAV_TOT({{172, 16}});
|
||||
const double CNAV_TOT_LSB = TWO_P4;
|
||||
const std::vector<std::pair<int32_t, int32_t> > CNAV_WN_OT({{188, 13}});
|
||||
const double CNAV_WN_OT_LSB = 1;
|
||||
const int32_t CNAV_WN_OT_LSB = 1;
|
||||
const std::vector<std::pair<int32_t, int32_t> > CNAV_WN_LSF({{201, 13}});
|
||||
const double CNAV_WN_LSF_LSB = 1;
|
||||
const int32_t CNAV_WN_LSF_LSB = 1;
|
||||
const std::vector<std::pair<int32_t, int32_t> > CNAV_DN({{214, 4}});
|
||||
const double CNAV_DN_LSB = 1;
|
||||
const int32_t CNAV_DN_LSB = 1;
|
||||
const std::vector<std::pair<int32_t, int32_t> > CNAV_DELTA_TLSF({{218, 8}});
|
||||
const double CNAV_DELTA_TLSF_LSB = 1;
|
||||
|
||||
|
@ -221,7 +221,7 @@ const std::vector<std::pair<int32_t, int32_t>> HEALTH_SV32({{283, 6}});
|
||||
|
||||
// page 25 - Health (PRN 1 - 24)
|
||||
const std::vector<std::pair<int32_t, int32_t>> T_OA({{69, 8}});
|
||||
const double T_OA_LSB = TWO_P12;
|
||||
const int32_t T_OA_LSB = TWO_P12;
|
||||
const std::vector<std::pair<int32_t, int32_t>> WN_A({{77, 8}});
|
||||
const std::vector<std::pair<int32_t, int32_t>> HEALTH_SV1({{91, 6}});
|
||||
const std::vector<std::pair<int32_t, int32_t>> HEALTH_SV2({{97, 6}});
|
||||
|
@ -205,7 +205,7 @@ const std::vector<std::pair<int32_t, int32_t>> TOW_6_bit({{106, 20}});
|
||||
const std::vector<std::pair<int32_t, int32_t>> IOD_a_7_bit({{7, 4}});
|
||||
const std::vector<std::pair<int32_t, int32_t>> WN_a_7_bit({{11, 2}});
|
||||
const std::vector<std::pair<int32_t, int32_t>> t0a_7_bit({{13, 10}});
|
||||
const double t0a_7_LSB = 600;
|
||||
const int32_t t0a_7_LSB = 600;
|
||||
const std::vector<std::pair<int32_t, int32_t>> SVID1_7_bit({{23, 6}});
|
||||
const std::vector<std::pair<int32_t, int32_t>> DELTA_A_7_bit({{29, 13}});
|
||||
const double DELTA_A_7_LSB = TWO_N9;
|
||||
@ -250,7 +250,7 @@ const double Omega_dot_8_LSB = TWO_N33;
|
||||
const std::vector<std::pair<int32_t, int32_t>> IOD_a_9_bit({{7, 4}});
|
||||
const std::vector<std::pair<int32_t, int32_t>> WN_a_9_bit({{11, 2}});
|
||||
const std::vector<std::pair<int32_t, int32_t>> t0a_9_bit({{13, 10}});
|
||||
const double t0a_9_LSB = 600;
|
||||
const int32_t t0a_9_LSB = 600;
|
||||
const std::vector<std::pair<int32_t, int32_t>> M0_9_bit({{23, 16}});
|
||||
const double M0_9_LSB = TWO_N15;
|
||||
const std::vector<std::pair<int32_t, int32_t>> af0_9_bit({{39, 16}});
|
||||
|
@ -174,7 +174,7 @@ const std::vector<std::pair<int32_t, int32_t>> FNAV_TOW_4_bit({{190, 20}});
|
||||
const std::vector<std::pair<int32_t, int32_t>> FNAV_IODa_5_bit({{7, 4}});
|
||||
const std::vector<std::pair<int32_t, int32_t>> FNAV_WNa_5_bit({{11, 2}});
|
||||
const std::vector<std::pair<int32_t, int32_t>> FNAV_t0a_5_bit({{13, 10}});
|
||||
const double FNAV_t0a_5_LSB = 600;
|
||||
const int32_t FNAV_t0a_5_LSB = 600;
|
||||
const std::vector<std::pair<int32_t, int32_t>> FNAV_SVID1_5_bit({{23, 6}});
|
||||
const std::vector<std::pair<int32_t, int32_t>> FNAV_Deltaa12_1_5_bit({{29, 13}});
|
||||
const double FNAV_Deltaa12_5_LSB = TWO_N9;
|
||||
|
@ -45,7 +45,7 @@ public:
|
||||
// Word type 7: Almanac for SVID1 (1/2), almanac reference time and almanac reference week number
|
||||
int32_t IOD_a_7;
|
||||
int32_t WN_a_7;
|
||||
double t0a_7;
|
||||
int32_t t0a_7;
|
||||
int32_t SVID1_7;
|
||||
double DELTA_A_7;
|
||||
double e_7;
|
||||
@ -73,7 +73,7 @@ public:
|
||||
// Word type 9: Almanac for SVID2 (2/2) and SVID3 (1/2)
|
||||
int32_t IOD_a_9;
|
||||
int32_t WN_a_9;
|
||||
double t0a_9;
|
||||
int32_t t0a_9;
|
||||
double M0_9;
|
||||
double af0_9;
|
||||
double af1_9;
|
||||
|
@ -41,7 +41,7 @@
|
||||
#include <iostream>
|
||||
|
||||
|
||||
typedef boost::crc_optimal<24, 0x1864CFBu, 0x0, 0x0, false, false> CRC_Galileo_FNAV_type;
|
||||
using CRC_Galileo_FNAV_type = boost::crc_optimal<24, 0x1864CFBu, 0x0, 0x0, false, false>;
|
||||
|
||||
void Galileo_Fnav_Message::reset()
|
||||
{
|
||||
@ -84,7 +84,7 @@ void Galileo_Fnav_Message::reset()
|
||||
FNAV_region4_1 = false;
|
||||
FNAV_region5_1 = false;
|
||||
FNAV_BGD_1 = 0.0;
|
||||
FNAV_E5ahs_1 = 0.0;
|
||||
FNAV_E5ahs_1 = 0;
|
||||
FNAV_WN_1 = 0.0;
|
||||
FNAV_TOW_1 = 0.0;
|
||||
FNAV_E5advs_1 = false;
|
||||
@ -134,8 +134,8 @@ void Galileo_Fnav_Message::reset()
|
||||
|
||||
// WORD 5 Almanac (SVID1 and SVID2(1/2)), Week Number and almanac reference time
|
||||
FNAV_IODa_5 = 0;
|
||||
FNAV_WNa_5 = 0.0;
|
||||
FNAV_t0a_5 = 0.0;
|
||||
FNAV_WNa_5 = 0;
|
||||
FNAV_t0a_5 = 0;
|
||||
FNAV_SVID1_5 = 0;
|
||||
FNAV_Deltaa12_1_5 = 0.0;
|
||||
FNAV_e_1_5 = 0.0;
|
||||
@ -160,7 +160,7 @@ void Galileo_Fnav_Message::reset()
|
||||
FNAV_M0_2_6 = 0.0;
|
||||
FNAV_af0_2_6 = 0.0;
|
||||
FNAV_af1_2_6 = 0.0;
|
||||
FNAV_E5ahs_2_6 = 0.0;
|
||||
FNAV_E5ahs_2_6 = 0;
|
||||
FNAV_SVID3_6 = 0;
|
||||
FNAV_Deltaa12_3_6 = 0.0;
|
||||
FNAV_e_3_6 = 0.0;
|
||||
@ -171,7 +171,7 @@ void Galileo_Fnav_Message::reset()
|
||||
FNAV_M0_3_6 = 0.0;
|
||||
FNAV_af0_3_6 = 0.0;
|
||||
FNAV_af1_3_6 = 0.0;
|
||||
FNAV_E5ahs_3_6 = 0.0;
|
||||
FNAV_E5ahs_3_6 = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -181,7 +181,7 @@ Galileo_Fnav_Message::Galileo_Fnav_Message()
|
||||
}
|
||||
|
||||
|
||||
void Galileo_Fnav_Message::split_page(std::string page_string)
|
||||
void Galileo_Fnav_Message::split_page(const std::string& page_string)
|
||||
{
|
||||
std::string message_word = page_string.substr(0, 214);
|
||||
std::string CRC_data = page_string.substr(214, 24);
|
||||
@ -231,7 +231,7 @@ bool Galileo_Fnav_Message::_CRC_test(std::bitset<GALILEO_FNAV_DATA_FRAME_BITS> b
|
||||
}
|
||||
|
||||
|
||||
void Galileo_Fnav_Message::decode_page(std::string data)
|
||||
void Galileo_Fnav_Message::decode_page(const std::string& data)
|
||||
{
|
||||
std::bitset<GALILEO_FNAV_DATA_FRAME_BITS> data_bits(data);
|
||||
page_type = read_navigation_unsigned(data_bits, FNAV_PAGE_TYPE_bit);
|
||||
@ -346,8 +346,8 @@ void Galileo_Fnav_Message::decode_page(std::string data)
|
||||
break;
|
||||
case 5: // Almanac (SVID1 and SVID2(1/2)), Week Number and almanac reference time
|
||||
FNAV_IODa_5 = static_cast<int32_t>(read_navigation_unsigned(data_bits, FNAV_IODa_5_bit));
|
||||
FNAV_WNa_5 = static_cast<double>(read_navigation_unsigned(data_bits, FNAV_WNa_5_bit));
|
||||
FNAV_t0a_5 = static_cast<double>(read_navigation_unsigned(data_bits, FNAV_t0a_5_bit));
|
||||
FNAV_WNa_5 = static_cast<int32_t>(read_navigation_unsigned(data_bits, FNAV_WNa_5_bit));
|
||||
FNAV_t0a_5 = static_cast<int32_t>(read_navigation_unsigned(data_bits, FNAV_t0a_5_bit));
|
||||
FNAV_t0a_5 *= FNAV_t0a_5_LSB;
|
||||
FNAV_SVID1_5 = static_cast<int32_t>(read_navigation_unsigned(data_bits, FNAV_SVID1_5_bit));
|
||||
FNAV_Deltaa12_1_5 = static_cast<double>(read_navigation_signed(data_bits, FNAV_Deltaa12_1_5_bit));
|
||||
@ -368,7 +368,7 @@ void Galileo_Fnav_Message::decode_page(std::string data)
|
||||
FNAV_af0_1_5 *= FNAV_af0_5_LSB;
|
||||
FNAV_af1_1_5 = static_cast<double>(read_navigation_signed(data_bits, FNAV_af1_1_5_bit));
|
||||
FNAV_af1_1_5 *= FNAV_af1_5_LSB;
|
||||
FNAV_E5ahs_1_5 = static_cast<double>(read_navigation_unsigned(data_bits, FNAV_E5ahs_1_5_bit));
|
||||
FNAV_E5ahs_1_5 = static_cast<uint32_t>(read_navigation_unsigned(data_bits, FNAV_E5ahs_1_5_bit));
|
||||
FNAV_SVID2_5 = static_cast<int32_t>(read_navigation_unsigned(data_bits, FNAV_SVID2_5_bit));
|
||||
FNAV_Deltaa12_2_5 = static_cast<double>(read_navigation_signed(data_bits, FNAV_Deltaa12_2_5_bit));
|
||||
FNAV_Deltaa12_2_5 *= FNAV_Deltaa12_5_LSB;
|
||||
@ -404,7 +404,7 @@ void Galileo_Fnav_Message::decode_page(std::string data)
|
||||
FNAV_af0_2_6 *= FNAV_af0_5_LSB;
|
||||
FNAV_af1_2_6 = static_cast<double>(read_navigation_signed(data_bits, FNAV_af1_2_6_bit));
|
||||
FNAV_af1_2_6 *= FNAV_af1_5_LSB;
|
||||
FNAV_E5ahs_2_6 = static_cast<double>(read_navigation_unsigned(data_bits, FNAV_E5ahs_2_6_bit));
|
||||
FNAV_E5ahs_2_6 = static_cast<int32_t>(read_navigation_unsigned(data_bits, FNAV_E5ahs_2_6_bit));
|
||||
FNAV_SVID3_6 = static_cast<int32_t>(read_navigation_unsigned(data_bits, FNAV_SVID3_6_bit));
|
||||
FNAV_Deltaa12_3_6 = static_cast<double>(read_navigation_signed(data_bits, FNAV_Deltaa12_3_6_bit));
|
||||
FNAV_Deltaa12_3_6 *= FNAV_Deltaa12_5_LSB;
|
||||
@ -424,7 +424,7 @@ void Galileo_Fnav_Message::decode_page(std::string data)
|
||||
FNAV_af0_3_6 *= FNAV_af0_5_LSB;
|
||||
FNAV_af1_3_6 = static_cast<double>(read_navigation_signed(data_bits, FNAV_af1_3_6_bit));
|
||||
FNAV_af1_3_6 *= FNAV_af1_5_LSB;
|
||||
FNAV_E5ahs_3_6 = static_cast<double>(read_navigation_unsigned(data_bits, FNAV_E5ahs_3_6_bit));
|
||||
FNAV_E5ahs_3_6 = static_cast<int32_t>(read_navigation_unsigned(data_bits, FNAV_E5ahs_3_6_bit));
|
||||
|
||||
flag_almanac_2 = true;
|
||||
break;
|
||||
@ -432,7 +432,7 @@ void Galileo_Fnav_Message::decode_page(std::string data)
|
||||
}
|
||||
|
||||
|
||||
uint64_t Galileo_Fnav_Message::read_navigation_unsigned(std::bitset<GALILEO_FNAV_DATA_FRAME_BITS> bits, const std::vector<std::pair<int32_t, int32_t>> parameter)
|
||||
uint64_t Galileo_Fnav_Message::read_navigation_unsigned(std::bitset<GALILEO_FNAV_DATA_FRAME_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter)
|
||||
{
|
||||
uint64_t value = 0ULL;
|
||||
int num_of_slices = parameter.size();
|
||||
@ -441,7 +441,7 @@ uint64_t Galileo_Fnav_Message::read_navigation_unsigned(std::bitset<GALILEO_FNAV
|
||||
for (int j = 0; j < parameter[i].second; j++)
|
||||
{
|
||||
value <<= 1; // shift left
|
||||
if (bits[GALILEO_FNAV_DATA_FRAME_BITS - parameter[i].first - j] == 1)
|
||||
if (static_cast<int>(bits[GALILEO_FNAV_DATA_FRAME_BITS - parameter[i].first - j]) == 1)
|
||||
{
|
||||
value += 1; // insert the bit
|
||||
}
|
||||
@ -451,13 +451,13 @@ uint64_t Galileo_Fnav_Message::read_navigation_unsigned(std::bitset<GALILEO_FNAV
|
||||
}
|
||||
|
||||
|
||||
int64_t Galileo_Fnav_Message::read_navigation_signed(std::bitset<GALILEO_FNAV_DATA_FRAME_BITS> bits, const std::vector<std::pair<int32_t, int32_t>> parameter)
|
||||
int64_t Galileo_Fnav_Message::read_navigation_signed(std::bitset<GALILEO_FNAV_DATA_FRAME_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter)
|
||||
{
|
||||
int64_t value = 0LL;
|
||||
int num_of_slices = parameter.size();
|
||||
|
||||
// read the MSB and perform the sign extension
|
||||
if (bits[GALILEO_FNAV_DATA_FRAME_BITS - parameter[0].first] == 1)
|
||||
if (static_cast<int>(bits[GALILEO_FNAV_DATA_FRAME_BITS - parameter[0].first]) == 1)
|
||||
{
|
||||
value ^= 0x0FFFFFFFFFFFFFFF; // 64 bits variable
|
||||
}
|
||||
@ -472,7 +472,7 @@ int64_t Galileo_Fnav_Message::read_navigation_signed(std::bitset<GALILEO_FNAV_DA
|
||||
{
|
||||
value <<= 1; // shift left
|
||||
value &= 0xFFFFFFFFFFFFFFFE; // reset the corresponding bit (for the 64 bits variable)
|
||||
if (bits[GALILEO_FNAV_DATA_FRAME_BITS - parameter[i].first - j] == 1)
|
||||
if (static_cast<int>(bits[GALILEO_FNAV_DATA_FRAME_BITS - parameter[i].first - j]) == 1)
|
||||
{
|
||||
value += 1; // insert the bit
|
||||
}
|
||||
@ -504,7 +504,9 @@ bool Galileo_Fnav_Message::have_new_ephemeris() // Check if we have a new ephem
|
||||
}
|
||||
}
|
||||
else
|
||||
return false;
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -513,10 +515,12 @@ bool Galileo_Fnav_Message::have_new_iono_and_GST() // Check if we have a new io
|
||||
if ((flag_iono_and_GST == true) and (flag_utc_model == true)) // the condition on flag_utc_model is added to have a time stamp for iono
|
||||
{
|
||||
flag_iono_and_GST = false; // clear the flag
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -525,10 +529,12 @@ bool Galileo_Fnav_Message::have_new_utc_model() // Check if we have a new utc d
|
||||
if (flag_utc_model == true)
|
||||
{
|
||||
flag_utc_model = false; // clear the flag
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -540,10 +546,12 @@ bool Galileo_Fnav_Message::have_new_almanac() // Check if we have a new almanac
|
||||
flag_almanac_1 = false;
|
||||
flag_almanac_2 = false;
|
||||
flag_all_almanac = true;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -57,7 +57,7 @@
|
||||
class Galileo_Fnav_Message
|
||||
{
|
||||
public:
|
||||
void split_page(std::string page_string);
|
||||
void split_page(const std::string& page_string);
|
||||
void reset();
|
||||
bool have_new_ephemeris();
|
||||
bool have_new_iono_and_GST();
|
||||
@ -109,7 +109,7 @@ public:
|
||||
bool FNAV_region4_1;
|
||||
bool FNAV_region5_1;
|
||||
double FNAV_BGD_1;
|
||||
double FNAV_E5ahs_1;
|
||||
int32_t FNAV_E5ahs_1;
|
||||
double FNAV_WN_1;
|
||||
double FNAV_TOW_1;
|
||||
bool FNAV_E5advs_1;
|
||||
@ -159,8 +159,8 @@ public:
|
||||
|
||||
// WORD 5 Almanac (SVID1 and SVID2(1/2)), Week Number and almanac reference time
|
||||
int32_t FNAV_IODa_5;
|
||||
double FNAV_WNa_5;
|
||||
double FNAV_t0a_5;
|
||||
int32_t FNAV_WNa_5;
|
||||
int32_t FNAV_t0a_5;
|
||||
int32_t FNAV_SVID1_5;
|
||||
double FNAV_Deltaa12_1_5;
|
||||
double FNAV_e_1_5;
|
||||
@ -185,7 +185,7 @@ public:
|
||||
double FNAV_M0_2_6;
|
||||
double FNAV_af0_2_6;
|
||||
double FNAV_af1_2_6;
|
||||
double FNAV_E5ahs_2_6;
|
||||
int32_t FNAV_E5ahs_2_6;
|
||||
int32_t FNAV_SVID3_6;
|
||||
double FNAV_Deltaa12_3_6;
|
||||
double FNAV_e_3_6;
|
||||
@ -196,13 +196,13 @@ public:
|
||||
double FNAV_M0_3_6;
|
||||
double FNAV_af0_3_6;
|
||||
double FNAV_af1_3_6;
|
||||
double FNAV_E5ahs_3_6;
|
||||
int32_t FNAV_E5ahs_3_6;
|
||||
|
||||
private:
|
||||
bool _CRC_test(std::bitset<GALILEO_FNAV_DATA_FRAME_BITS> bits, uint32_t checksum);
|
||||
void decode_page(std::string data);
|
||||
uint64_t read_navigation_unsigned(std::bitset<GALILEO_FNAV_DATA_FRAME_BITS> bits, const std::vector<std::pair<int32_t, int32_t>> parameter);
|
||||
int64_t read_navigation_signed(std::bitset<GALILEO_FNAV_DATA_FRAME_BITS> bits, const std::vector<std::pair<int32_t, int32_t>> parameter);
|
||||
void decode_page(const std::string& data);
|
||||
uint64_t read_navigation_unsigned(std::bitset<GALILEO_FNAV_DATA_FRAME_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter);
|
||||
int64_t read_navigation_signed(std::bitset<GALILEO_FNAV_DATA_FRAME_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter);
|
||||
|
||||
std::string omega0_1;
|
||||
//std::string omega0_2;
|
||||
|
@ -37,7 +37,7 @@
|
||||
#include <iostream>
|
||||
|
||||
|
||||
typedef boost::crc_optimal<24, 0x1864CFBu, 0x0, 0x0, false, false> CRC_Galileo_INAV_type;
|
||||
using CRC_Galileo_INAV_type = boost::crc_optimal<24, 0x1864CFBu, 0x0, 0x0, false, false>;
|
||||
|
||||
|
||||
void Galileo_Navigation_Message::reset()
|
||||
@ -139,15 +139,15 @@ void Galileo_Navigation_Message::reset()
|
||||
Delta_tLS_6 = 0.0;
|
||||
t0t_6 = 0.0;
|
||||
WNot_6 = 0.0;
|
||||
WN_LSF_6 = 0.0;
|
||||
DN_6 = 0.0;
|
||||
WN_LSF_6 = 0;
|
||||
DN_6 = 0;
|
||||
Delta_tLSF_6 = 0.0;
|
||||
TOW_6 = 0.0;
|
||||
|
||||
// Word type 7: Almanac for SVID1 (1/2), almanac reference time and almanac reference week number
|
||||
IOD_a_7 = 0;
|
||||
WN_a_7 = 0;
|
||||
t0a_7 = 0.0;
|
||||
t0a_7 = 0;
|
||||
SVID1_7 = 0;
|
||||
DELTA_A_7 = 0.0;
|
||||
e_7 = 0.0;
|
||||
@ -174,7 +174,7 @@ void Galileo_Navigation_Message::reset()
|
||||
// Word type 9: Almanac for SVID2 (2/2) and SVID3 (1/2)
|
||||
IOD_a_9 = 0;
|
||||
WN_a_9 = 0;
|
||||
t0a_9 = 0.0;
|
||||
t0a_9 = 0;
|
||||
M0_9 = 0.0;
|
||||
af0_9 = 0.0;
|
||||
af1_9 = 0.0;
|
||||
@ -260,7 +260,7 @@ bool Galileo_Navigation_Message::CRC_test(std::bitset<GALILEO_DATA_FRAME_BITS> b
|
||||
}
|
||||
|
||||
|
||||
uint64_t Galileo_Navigation_Message::read_navigation_unsigned(std::bitset<GALILEO_DATA_JK_BITS> bits, const std::vector<std::pair<int32_t, int32_t> > parameter)
|
||||
uint64_t Galileo_Navigation_Message::read_navigation_unsigned(std::bitset<GALILEO_DATA_JK_BITS> bits, const std::vector<std::pair<int32_t, int32_t> >& parameter)
|
||||
{
|
||||
uint64_t value = 0ULL;
|
||||
int32_t num_of_slices = parameter.size();
|
||||
@ -269,7 +269,7 @@ uint64_t Galileo_Navigation_Message::read_navigation_unsigned(std::bitset<GALILE
|
||||
for (int32_t j = 0; j < parameter[i].second; j++)
|
||||
{
|
||||
value <<= 1; // shift left
|
||||
if (bits[GALILEO_DATA_JK_BITS - parameter[i].first - j] == 1)
|
||||
if (static_cast<int>(bits[GALILEO_DATA_JK_BITS - parameter[i].first - j]) == 1)
|
||||
{
|
||||
value += 1; // insert the bit
|
||||
}
|
||||
@ -279,7 +279,7 @@ uint64_t Galileo_Navigation_Message::read_navigation_unsigned(std::bitset<GALILE
|
||||
}
|
||||
|
||||
|
||||
uint64_t Galileo_Navigation_Message::read_page_type_unsigned(std::bitset<GALILEO_PAGE_TYPE_BITS> bits, const std::vector<std::pair<int32_t, int32_t> > parameter)
|
||||
uint64_t Galileo_Navigation_Message::read_page_type_unsigned(std::bitset<GALILEO_PAGE_TYPE_BITS> bits, const std::vector<std::pair<int32_t, int32_t> >& parameter)
|
||||
{
|
||||
uint64_t value = 0ULL;
|
||||
int32_t num_of_slices = parameter.size();
|
||||
@ -288,7 +288,7 @@ uint64_t Galileo_Navigation_Message::read_page_type_unsigned(std::bitset<GALILEO
|
||||
for (int32_t j = 0; j < parameter[i].second; j++)
|
||||
{
|
||||
value <<= 1; // shift left
|
||||
if (bits[GALILEO_PAGE_TYPE_BITS - parameter[i].first - j] == 1)
|
||||
if (static_cast<int>(bits[GALILEO_PAGE_TYPE_BITS - parameter[i].first - j]) == 1)
|
||||
{
|
||||
value += 1ULL; // insert the bit
|
||||
}
|
||||
@ -298,13 +298,13 @@ uint64_t Galileo_Navigation_Message::read_page_type_unsigned(std::bitset<GALILEO
|
||||
}
|
||||
|
||||
|
||||
int64_t Galileo_Navigation_Message::read_navigation_signed(std::bitset<GALILEO_DATA_JK_BITS> bits, const std::vector<std::pair<int32_t, int32_t> > parameter)
|
||||
int64_t Galileo_Navigation_Message::read_navigation_signed(std::bitset<GALILEO_DATA_JK_BITS> bits, const std::vector<std::pair<int32_t, int32_t> >& parameter)
|
||||
{
|
||||
int64_t value = 0LL;
|
||||
int32_t num_of_slices = parameter.size();
|
||||
|
||||
// read the MSB and perform the sign extension
|
||||
if (bits[GALILEO_DATA_JK_BITS - parameter[0].first] == 1)
|
||||
if (static_cast<int>(bits[GALILEO_DATA_JK_BITS - parameter[0].first]) == 1)
|
||||
{
|
||||
value ^= 0xFFFFFFFFFFFFFFFFLL; // 64 bits variable
|
||||
}
|
||||
@ -319,7 +319,7 @@ int64_t Galileo_Navigation_Message::read_navigation_signed(std::bitset<GALILEO_D
|
||||
{
|
||||
value <<= 1; // shift left
|
||||
value &= 0xFFFFFFFFFFFFFFFE; // reset the corresponding bit (for the 64 bits variable)
|
||||
if (bits[GALILEO_DATA_JK_BITS - parameter[i].first - j] == 1)
|
||||
if (static_cast<int>(bits[GALILEO_DATA_JK_BITS - parameter[i].first - j]) == 1)
|
||||
{
|
||||
value += 1LL; // insert the bit
|
||||
}
|
||||
@ -329,10 +329,10 @@ int64_t Galileo_Navigation_Message::read_navigation_signed(std::bitset<GALILEO_D
|
||||
}
|
||||
|
||||
|
||||
bool Galileo_Navigation_Message::read_navigation_bool(std::bitset<GALILEO_DATA_JK_BITS> bits, const std::vector<std::pair<int32_t, int32_t> > parameter)
|
||||
bool Galileo_Navigation_Message::read_navigation_bool(std::bitset<GALILEO_DATA_JK_BITS> bits, const std::vector<std::pair<int32_t, int32_t> >& parameter)
|
||||
{
|
||||
bool value;
|
||||
if (bits[GALILEO_DATA_JK_BITS - parameter[0].first] == 1)
|
||||
if (static_cast<int>(static_cast<int>(bits[GALILEO_DATA_JK_BITS - parameter[0].first])) == 1)
|
||||
{
|
||||
value = true;
|
||||
}
|
||||
@ -356,7 +356,7 @@ void Galileo_Navigation_Message::split_page(std::string page_string, int32_t fla
|
||||
if (page_string.at(0) == '1') // if page is odd
|
||||
{
|
||||
// std::cout<< "page_string.at(0) split page="<<page_string.at(0) << std::endl;
|
||||
std::string page_Odd = page_string;
|
||||
const std::string& page_Odd = page_string;
|
||||
// std::cout<<"Page odd string in split page"<< std::endl << page_Odd << std::endl;
|
||||
|
||||
if (flag_even_word == 1) // An odd page has been received but the previous even page is kept in memory and it is considered to join pages
|
||||
@ -646,7 +646,7 @@ Galileo_Almanac_Helper Galileo_Navigation_Message::get_almanac()
|
||||
}
|
||||
|
||||
|
||||
int32_t Galileo_Navigation_Message::page_jk_decoder(const char *data_jk)
|
||||
int32_t Galileo_Navigation_Message::page_jk_decoder(const char* data_jk)
|
||||
{
|
||||
int32_t page_number = 0;
|
||||
|
||||
@ -816,9 +816,9 @@ int32_t Galileo_Navigation_Message::page_jk_decoder(const char *data_jk)
|
||||
DLOG(INFO) << "t0t_6= " << t0t_6;
|
||||
WNot_6 = static_cast<double>(read_navigation_unsigned(data_jk_bits, WNot_6_bit));
|
||||
DLOG(INFO) << "WNot_6= " << WNot_6;
|
||||
WN_LSF_6 = static_cast<double>(read_navigation_unsigned(data_jk_bits, WN_LSF_6_bit));
|
||||
WN_LSF_6 = static_cast<int32_t>(read_navigation_unsigned(data_jk_bits, WN_LSF_6_bit));
|
||||
DLOG(INFO) << "WN_LSF_6= " << WN_LSF_6;
|
||||
DN_6 = static_cast<double>(read_navigation_unsigned(data_jk_bits, DN_6_bit));
|
||||
DN_6 = static_cast<int32_t>(read_navigation_unsigned(data_jk_bits, DN_6_bit));
|
||||
DLOG(INFO) << "DN_6= " << DN_6;
|
||||
Delta_tLSF_6 = static_cast<double>(read_navigation_signed(data_jk_bits, Delta_tLSF_6_bit));
|
||||
DLOG(INFO) << "Delta_tLSF_6= " << Delta_tLSF_6;
|
||||
@ -831,14 +831,14 @@ int32_t Galileo_Navigation_Message::page_jk_decoder(const char *data_jk)
|
||||
break;
|
||||
|
||||
case 7: // Word type 7: Almanac for SVID1 (1/2), almanac reference time and almanac reference week number
|
||||
IOD_a_7 = static_cast<double>(read_navigation_unsigned(data_jk_bits, IOD_a_7_bit));
|
||||
IOD_a_7 = static_cast<int32_t>(read_navigation_unsigned(data_jk_bits, IOD_a_7_bit));
|
||||
DLOG(INFO) << "IOD_a_7= " << IOD_a_7;
|
||||
WN_a_7 = static_cast<int32_t>(read_navigation_unsigned(data_jk_bits, WN_a_7_bit));
|
||||
DLOG(INFO) << "WN_a_7= " << WN_a_7;
|
||||
t0a_7 = static_cast<double>(read_navigation_unsigned(data_jk_bits, t0a_7_bit));
|
||||
t0a_7 = static_cast<int32_t>(read_navigation_unsigned(data_jk_bits, t0a_7_bit));
|
||||
t0a_7 = t0a_7 * t0a_7_LSB;
|
||||
DLOG(INFO) << "t0a_7= " << t0a_7;
|
||||
SVID1_7 = static_cast<double>(read_navigation_unsigned(data_jk_bits, SVID1_7_bit));
|
||||
SVID1_7 = static_cast<int32_t>(read_navigation_unsigned(data_jk_bits, SVID1_7_bit));
|
||||
DLOG(INFO) << "SVID1_7= " << SVID1_7;
|
||||
DELTA_A_7 = static_cast<double>(read_navigation_signed(data_jk_bits, DELTA_A_7_bit));
|
||||
DELTA_A_7 = DELTA_A_7 * DELTA_A_7_LSB;
|
||||
@ -866,7 +866,7 @@ int32_t Galileo_Navigation_Message::page_jk_decoder(const char *data_jk)
|
||||
break;
|
||||
|
||||
case 8: // Word type 8: Almanac for SVID1 (2/2) and SVID2 (1/2)*/
|
||||
IOD_a_8 = static_cast<double>(read_navigation_unsigned(data_jk_bits, IOD_a_8_bit));
|
||||
IOD_a_8 = static_cast<int32_t>(read_navigation_unsigned(data_jk_bits, IOD_a_8_bit));
|
||||
DLOG(INFO) << "IOD_a_8= " << IOD_a_8;
|
||||
af0_8 = static_cast<double>(read_navigation_signed(data_jk_bits, af0_8_bit));
|
||||
af0_8 = af0_8 * af0_8_LSB;
|
||||
@ -903,11 +903,11 @@ int32_t Galileo_Navigation_Message::page_jk_decoder(const char *data_jk)
|
||||
break;
|
||||
|
||||
case 9: // Word type 9: Almanac for SVID2 (2/2) and SVID3 (1/2)
|
||||
IOD_a_9 = static_cast<double>(read_navigation_unsigned(data_jk_bits, IOD_a_9_bit));
|
||||
IOD_a_9 = static_cast<int32_t>(read_navigation_unsigned(data_jk_bits, IOD_a_9_bit));
|
||||
DLOG(INFO) << "IOD_a_9= " << IOD_a_9;
|
||||
WN_a_9 = static_cast<int32_t>(read_navigation_unsigned(data_jk_bits, WN_a_9_bit));
|
||||
DLOG(INFO) << "WN_a_9= " << WN_a_9;
|
||||
t0a_9 = static_cast<double>(read_navigation_unsigned(data_jk_bits, t0a_9_bit));
|
||||
t0a_9 = static_cast<int32_t>(read_navigation_unsigned(data_jk_bits, t0a_9_bit));
|
||||
t0a_9 = t0a_9 * t0a_9_LSB;
|
||||
DLOG(INFO) << "t0a_9= " << t0a_9;
|
||||
M0_9 = static_cast<double>(read_navigation_signed(data_jk_bits, M0_9_bit));
|
||||
@ -942,7 +942,7 @@ int32_t Galileo_Navigation_Message::page_jk_decoder(const char *data_jk)
|
||||
break;
|
||||
|
||||
case 10: // Word type 10: Almanac for SVID3 (2/2) and GST-GPS conversion parameters
|
||||
IOD_a_10 = static_cast<double>(read_navigation_unsigned(data_jk_bits, IOD_a_10_bit));
|
||||
IOD_a_10 = static_cast<int32_t>(read_navigation_unsigned(data_jk_bits, IOD_a_10_bit));
|
||||
DLOG(INFO) << "IOD_a_10= " << IOD_a_10;
|
||||
Omega0_10 = static_cast<double>(read_navigation_signed(data_jk_bits, Omega0_10_bit));
|
||||
Omega0_10 = Omega0_10 * Omega0_10_LSB;
|
||||
|
@ -55,10 +55,10 @@ class Galileo_Navigation_Message
|
||||
{
|
||||
private:
|
||||
bool CRC_test(std::bitset<GALILEO_DATA_FRAME_BITS> bits, uint32_t checksum);
|
||||
bool read_navigation_bool(std::bitset<GALILEO_DATA_JK_BITS> bits, const std::vector<std::pair<int32_t, int32_t> > parameter);
|
||||
uint64_t read_navigation_unsigned(std::bitset<GALILEO_DATA_JK_BITS> bits, const std::vector<std::pair<int32_t, int32_t> > parameter);
|
||||
uint64_t read_page_type_unsigned(std::bitset<GALILEO_PAGE_TYPE_BITS> bits, const std::vector<std::pair<int32_t, int32_t> > parameter);
|
||||
int64_t read_navigation_signed(std::bitset<GALILEO_DATA_JK_BITS> bits, const std::vector<std::pair<int32_t, int32_t> > parameter);
|
||||
bool read_navigation_bool(std::bitset<GALILEO_DATA_JK_BITS> bits, const std::vector<std::pair<int32_t, int32_t> >& parameter);
|
||||
uint64_t read_navigation_unsigned(std::bitset<GALILEO_DATA_JK_BITS> bits, const std::vector<std::pair<int32_t, int32_t> >& parameter);
|
||||
uint64_t read_page_type_unsigned(std::bitset<GALILEO_PAGE_TYPE_BITS> bits, const std::vector<std::pair<int32_t, int32_t> >& parameter);
|
||||
int64_t read_navigation_signed(std::bitset<GALILEO_DATA_JK_BITS> bits, const std::vector<std::pair<int32_t, int32_t> >& parameter);
|
||||
|
||||
public:
|
||||
int32_t Page_type_time_stamp;
|
||||
@ -159,15 +159,15 @@ public:
|
||||
double Delta_tLS_6;
|
||||
double t0t_6;
|
||||
double WNot_6;
|
||||
double WN_LSF_6;
|
||||
double DN_6;
|
||||
int32_t WN_LSF_6;
|
||||
int32_t DN_6;
|
||||
double Delta_tLSF_6;
|
||||
double TOW_6;
|
||||
|
||||
// Word type 7: Almanac for SVID1 (1/2), almanac reference time and almanac reference week number
|
||||
int32_t IOD_a_7;
|
||||
int32_t WN_a_7;
|
||||
double t0a_7;
|
||||
int32_t t0a_7;
|
||||
int32_t SVID1_7;
|
||||
double DELTA_A_7;
|
||||
double e_7;
|
||||
@ -194,7 +194,7 @@ public:
|
||||
// Word type 9: Almanac for SVID2 (2/2) and SVID3 (1/2)
|
||||
int32_t IOD_a_9;
|
||||
int32_t WN_a_9;
|
||||
double t0a_9;
|
||||
int32_t t0a_9;
|
||||
double M0_9;
|
||||
double af0_9;
|
||||
double af1_9;
|
||||
@ -250,7 +250,7 @@ public:
|
||||
*
|
||||
* Takes in input Data_jk (128 bit) and split it in ephemeris parameters according ICD 4.3.5
|
||||
*/
|
||||
int32_t page_jk_decoder(const char *data_jk);
|
||||
int32_t page_jk_decoder(const char* data_jk);
|
||||
|
||||
void reset();
|
||||
|
||||
|
@ -39,8 +39,8 @@ Galileo_Utc_Model::Galileo_Utc_Model()
|
||||
Delta_tLS_6 = 0.0;
|
||||
t0t_6 = 0.0;
|
||||
WNot_6 = 0.0;
|
||||
WN_LSF_6 = 0.0;
|
||||
DN_6 = 0.0;
|
||||
WN_LSF_6 = 0;
|
||||
DN_6 = 0;
|
||||
Delta_tLSF_6 = 0.0;
|
||||
flag_utc_model = false;
|
||||
// GPS to Galileo GST conversion parameters
|
||||
|
@ -34,6 +34,7 @@
|
||||
#define GNSS_SDR_GALILEO_UTC_MODEL_H_
|
||||
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
#include <cstdint>
|
||||
|
||||
/*!
|
||||
* \brief This class is a storage for the GALILEO UTC MODEL data as described in Galileo ICD
|
||||
@ -49,8 +50,8 @@ public:
|
||||
double Delta_tLS_6;
|
||||
double t0t_6; //!< UTC data reference Time of Week [s]
|
||||
double WNot_6; //!< UTC data reference Week number [week]
|
||||
double WN_LSF_6;
|
||||
double DN_6;
|
||||
int32_t WN_LSF_6;
|
||||
int32_t DN_6;
|
||||
double Delta_tLSF_6;
|
||||
bool flag_utc_model;
|
||||
|
||||
|
@ -47,9 +47,7 @@ Gnss_Satellite::Gnss_Satellite(const std::string& system_, uint32_t PRN_)
|
||||
}
|
||||
|
||||
|
||||
Gnss_Satellite::~Gnss_Satellite()
|
||||
{
|
||||
}
|
||||
Gnss_Satellite::~Gnss_Satellite() = default;
|
||||
|
||||
|
||||
void Gnss_Satellite::reset()
|
||||
@ -69,9 +67,9 @@ void Gnss_Satellite::reset()
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, const Gnss_Satellite& sat) // output
|
||||
{
|
||||
std::string tag("");
|
||||
std::string tag2("");
|
||||
if (sat.get_system().compare("Galileo") == 0) tag = "E";
|
||||
std::string tag;
|
||||
std::string tag2;
|
||||
if (sat.get_system() == "Galileo") tag = "E";
|
||||
if (sat.get_PRN() < 10) tag2 = "0";
|
||||
out << sat.get_system() << " PRN " << tag << tag2 << sat.get_PRN() << " (Block " << sat.get_block() << ")";
|
||||
return out;
|
||||
@ -81,9 +79,9 @@ std::ostream& operator<<(std::ostream& out, const Gnss_Satellite& sat) // outpu
|
||||
bool operator==(const Gnss_Satellite& sat1, const Gnss_Satellite& sat2)
|
||||
{
|
||||
bool equal = false;
|
||||
if (sat1.get_system().compare(sat2.get_system()) == 0)
|
||||
if (sat1.get_system() == sat2.get_system())
|
||||
{
|
||||
if (sat1.get_PRN() == (sat2.get_PRN()))
|
||||
if (sat1.get_PRN() == sat2.get_PRN())
|
||||
{
|
||||
equal = true;
|
||||
}
|
||||
@ -129,7 +127,7 @@ void Gnss_Satellite::set_system(const std::string& system_)
|
||||
|
||||
void Gnss_Satellite::update_PRN(uint32_t PRN_)
|
||||
{
|
||||
if (system.compare("Glonass") != 0)
|
||||
if (system != "Glonass")
|
||||
{
|
||||
DLOG(INFO) << "Trying to update PRN for not GLONASS system";
|
||||
PRN = 0;
|
||||
@ -153,12 +151,12 @@ void Gnss_Satellite::update_PRN(uint32_t PRN_)
|
||||
void Gnss_Satellite::set_PRN(uint32_t PRN_)
|
||||
{
|
||||
// Set satellite's PRN
|
||||
if (system.compare("") == 0)
|
||||
if (system.empty())
|
||||
{
|
||||
DLOG(INFO) << "Trying to define PRN while system is not defined";
|
||||
PRN = 0;
|
||||
}
|
||||
if (system.compare("GPS") == 0)
|
||||
if (system == "GPS")
|
||||
{
|
||||
if (PRN_ < 1 or PRN_ > 32)
|
||||
{
|
||||
@ -170,7 +168,7 @@ void Gnss_Satellite::set_PRN(uint32_t PRN_)
|
||||
PRN = PRN_;
|
||||
}
|
||||
}
|
||||
else if (system.compare("Glonass") == 0)
|
||||
else if (system == "Glonass")
|
||||
{
|
||||
if (PRN_ < 1 or PRN_ > 24)
|
||||
{
|
||||
@ -182,7 +180,7 @@ void Gnss_Satellite::set_PRN(uint32_t PRN_)
|
||||
PRN = PRN_;
|
||||
}
|
||||
}
|
||||
else if (system.compare("SBAS") == 0)
|
||||
else if (system == "SBAS")
|
||||
{
|
||||
if (PRN_ == 120)
|
||||
{
|
||||
@ -214,7 +212,7 @@ void Gnss_Satellite::set_PRN(uint32_t PRN_)
|
||||
PRN = 0;
|
||||
}
|
||||
}
|
||||
else if (system.compare("Galileo") == 0)
|
||||
else if (system == "Galileo")
|
||||
{
|
||||
if (PRN_ < 1 or PRN_ > 36)
|
||||
{
|
||||
@ -280,7 +278,7 @@ std::string Gnss_Satellite::get_block() const
|
||||
std::string Gnss_Satellite::what_block(const std::string& system_, uint32_t PRN_)
|
||||
{
|
||||
std::string block_ = "Unknown";
|
||||
if (system_.compare("GPS") == 0)
|
||||
if (system_ == "GPS")
|
||||
{
|
||||
// info from https://www.navcen.uscg.gov/?Do=constellationStatus
|
||||
switch (PRN_)
|
||||
@ -386,7 +384,7 @@ std::string Gnss_Satellite::what_block(const std::string& system_, uint32_t PRN_
|
||||
}
|
||||
}
|
||||
|
||||
if (system_.compare("Glonass") == 0)
|
||||
if (system_ == "Glonass")
|
||||
{
|
||||
// Info from http://www.sdcm.ru/smglo/grupglo?version=eng&site=extern
|
||||
// See also http://www.glonass-center.ru/en/GLONASS/
|
||||
@ -492,7 +490,7 @@ std::string Gnss_Satellite::what_block(const std::string& system_, uint32_t PRN_
|
||||
block_ = std::string("Unknown");
|
||||
}
|
||||
}
|
||||
if (system_.compare("SBAS") == 0)
|
||||
if (system_ == "SBAS")
|
||||
{
|
||||
switch (PRN_)
|
||||
{
|
||||
@ -518,7 +516,7 @@ std::string Gnss_Satellite::what_block(const std::string& system_, uint32_t PRN_
|
||||
block_ = std::string("Unknown");
|
||||
}
|
||||
}
|
||||
if (system_.compare("Galileo") == 0)
|
||||
if (system_ == "Galileo")
|
||||
{
|
||||
// Check http://en.wikipedia.org/wiki/List_of_Galileo_satellites and https://www.gsc-europa.eu/system-status/Constellation-Information
|
||||
switch (PRN_)
|
||||
|
@ -50,9 +50,7 @@ Gnss_Signal::Gnss_Signal(const Gnss_Satellite& satellite_, const std::string& si
|
||||
}
|
||||
|
||||
|
||||
Gnss_Signal::~Gnss_Signal()
|
||||
{
|
||||
}
|
||||
Gnss_Signal::~Gnss_Signal() = default;
|
||||
|
||||
|
||||
std::string Gnss_Signal::get_signal_str() const
|
||||
@ -80,7 +78,7 @@ bool operator==(const Gnss_Signal& sig1, const Gnss_Signal& sig2)
|
||||
|
||||
if (sig1.get_satellite() == sig2.get_satellite())
|
||||
{
|
||||
if (sig1.get_signal_str().compare(sig1.get_signal_str()) == 0)
|
||||
if (sig1.get_signal_str() == sig1.get_signal_str())
|
||||
{
|
||||
equal = true;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ Gps_Almanac::Gps_Almanac()
|
||||
{
|
||||
i_satellite_PRN = 0U;
|
||||
d_Delta_i = 0.0;
|
||||
i_Toa = 0.0;
|
||||
i_Toa = 0;
|
||||
i_WNa = 0;
|
||||
d_M_0 = 0.0;
|
||||
d_e_eccentricity = 0.0;
|
||||
|
@ -72,11 +72,11 @@ Gps_CNAV_Navigation_Message::Gps_CNAV_Navigation_Message()
|
||||
}
|
||||
|
||||
|
||||
bool Gps_CNAV_Navigation_Message::read_navigation_bool(std::bitset<GPS_CNAV_DATA_PAGE_BITS> bits, const std::vector<std::pair<int32_t, int32_t>> parameter)
|
||||
bool Gps_CNAV_Navigation_Message::read_navigation_bool(std::bitset<GPS_CNAV_DATA_PAGE_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter)
|
||||
{
|
||||
bool value;
|
||||
|
||||
if (bits[GPS_CNAV_DATA_PAGE_BITS - parameter[0].first] == 1)
|
||||
if (static_cast<int>(bits[GPS_CNAV_DATA_PAGE_BITS - parameter[0].first]) == 1)
|
||||
{
|
||||
value = true;
|
||||
}
|
||||
@ -88,7 +88,7 @@ bool Gps_CNAV_Navigation_Message::read_navigation_bool(std::bitset<GPS_CNAV_DATA
|
||||
}
|
||||
|
||||
|
||||
uint64_t Gps_CNAV_Navigation_Message::read_navigation_unsigned(std::bitset<GPS_CNAV_DATA_PAGE_BITS> bits, const std::vector<std::pair<int32_t, int32_t>> parameter)
|
||||
uint64_t Gps_CNAV_Navigation_Message::read_navigation_unsigned(std::bitset<GPS_CNAV_DATA_PAGE_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter)
|
||||
{
|
||||
uint64_t value = 0ULL;
|
||||
int32_t num_of_slices = parameter.size();
|
||||
@ -97,7 +97,7 @@ uint64_t Gps_CNAV_Navigation_Message::read_navigation_unsigned(std::bitset<GPS_C
|
||||
for (int32_t j = 0; j < parameter[i].second; j++)
|
||||
{
|
||||
value <<= 1; // shift left
|
||||
if (bits[GPS_CNAV_DATA_PAGE_BITS - parameter[i].first - j] == 1)
|
||||
if (static_cast<int>(bits[GPS_CNAV_DATA_PAGE_BITS - parameter[i].first - j]) == 1)
|
||||
{
|
||||
value += 1ULL; // insert the bit
|
||||
}
|
||||
@ -107,13 +107,13 @@ uint64_t Gps_CNAV_Navigation_Message::read_navigation_unsigned(std::bitset<GPS_C
|
||||
}
|
||||
|
||||
|
||||
int64_t Gps_CNAV_Navigation_Message::read_navigation_signed(std::bitset<GPS_CNAV_DATA_PAGE_BITS> bits, const std::vector<std::pair<int32_t, int32_t>> parameter)
|
||||
int64_t Gps_CNAV_Navigation_Message::read_navigation_signed(std::bitset<GPS_CNAV_DATA_PAGE_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter)
|
||||
{
|
||||
int64_t value = 0LL;
|
||||
int32_t num_of_slices = parameter.size();
|
||||
|
||||
// read the MSB and perform the sign extension
|
||||
if (bits[GPS_CNAV_DATA_PAGE_BITS - parameter[0].first] == 1)
|
||||
if (static_cast<int>(bits[GPS_CNAV_DATA_PAGE_BITS - parameter[0].first]) == 1)
|
||||
{
|
||||
value ^= 0xFFFFFFFFFFFFFFFFLL; // 64 bits variable
|
||||
}
|
||||
@ -128,7 +128,7 @@ int64_t Gps_CNAV_Navigation_Message::read_navigation_signed(std::bitset<GPS_CNAV
|
||||
{
|
||||
value <<= 1; // shift left
|
||||
value &= 0xFFFFFFFFFFFFFFFELL; // reset the corresponding bit (for the 64 bits variable)
|
||||
if (bits[GPS_CNAV_DATA_PAGE_BITS - parameter[i].first - j] == 1)
|
||||
if (static_cast<int>(bits[GPS_CNAV_DATA_PAGE_BITS - parameter[i].first - j]) == 1)
|
||||
{
|
||||
value += 1LL; // insert the bit
|
||||
}
|
||||
@ -306,13 +306,13 @@ void Gps_CNAV_Navigation_Message::decode_page(std::bitset<GPS_CNAV_DATA_PAGE_BIT
|
||||
utc_model_record.d_t_OT = static_cast<double>(read_navigation_signed(data_bits, CNAV_TOT));
|
||||
utc_model_record.d_t_OT = utc_model_record.d_t_OT * CNAV_TOT_LSB;
|
||||
|
||||
utc_model_record.i_WN_T = static_cast<double>(read_navigation_signed(data_bits, CNAV_WN_OT));
|
||||
utc_model_record.i_WN_T = static_cast<int32_t>(read_navigation_signed(data_bits, CNAV_WN_OT));
|
||||
utc_model_record.i_WN_T = utc_model_record.i_WN_T * CNAV_WN_OT_LSB;
|
||||
|
||||
utc_model_record.i_WN_LSF = static_cast<double>(read_navigation_signed(data_bits, CNAV_WN_LSF));
|
||||
utc_model_record.i_WN_LSF = static_cast<int32_t>(read_navigation_signed(data_bits, CNAV_WN_LSF));
|
||||
utc_model_record.i_WN_LSF = utc_model_record.i_WN_LSF * CNAV_WN_LSF_LSB;
|
||||
|
||||
utc_model_record.i_DN = static_cast<double>(read_navigation_signed(data_bits, CNAV_DN));
|
||||
utc_model_record.i_DN = static_cast<int32_t>(read_navigation_signed(data_bits, CNAV_DN));
|
||||
utc_model_record.i_DN = utc_model_record.i_DN * CNAV_DN_LSB;
|
||||
|
||||
utc_model_record.d_DeltaT_LSF = static_cast<double>(read_navigation_signed(data_bits, CNAV_DELTA_TLSF));
|
||||
|
@ -56,9 +56,9 @@
|
||||
class Gps_CNAV_Navigation_Message
|
||||
{
|
||||
private:
|
||||
uint64_t read_navigation_unsigned(std::bitset<GPS_CNAV_DATA_PAGE_BITS> bits, const std::vector<std::pair<int32_t, int32_t>> parameter);
|
||||
int64_t read_navigation_signed(std::bitset<GPS_CNAV_DATA_PAGE_BITS> bits, const std::vector<std::pair<int32_t, int32_t>> parameter);
|
||||
bool read_navigation_bool(std::bitset<GPS_CNAV_DATA_PAGE_BITS> bits, const std::vector<std::pair<int32_t, int32_t>> parameter);
|
||||
uint64_t read_navigation_unsigned(std::bitset<GPS_CNAV_DATA_PAGE_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter);
|
||||
int64_t read_navigation_signed(std::bitset<GPS_CNAV_DATA_PAGE_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter);
|
||||
bool read_navigation_bool(std::bitset<GPS_CNAV_DATA_PAGE_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter);
|
||||
|
||||
Gps_CNAV_Ephemeris ephemeris_record;
|
||||
Gps_CNAV_Iono iono_record;
|
||||
|
@ -84,7 +84,7 @@ double Gps_CNAV_Utc_Model::utc_time(double gpstime_corrected, int32_t i_GPS_week
|
||||
* proper accommodation of the leap second event with a possible week number
|
||||
* transition is provided by the following expression for UTC:
|
||||
*/
|
||||
int32_t W = fmod(gpstime_corrected - Delta_t_UTC - 43200, 86400) + 43200;
|
||||
int32_t W = static_cast<int32_t>(fmod(gpstime_corrected - Delta_t_UTC - 43200, 86400)) + 43200;
|
||||
t_utc_daytime = fmod(W, 86400 + d_DeltaT_LSF - d_DeltaT_LS);
|
||||
// implement something to handle a leap second event!
|
||||
}
|
||||
|
@ -31,8 +31,8 @@
|
||||
*/
|
||||
|
||||
#include "gps_ephemeris.h"
|
||||
#include "gnss_satellite.h"
|
||||
#include "GPS_L1_CA.h"
|
||||
#include "gnss_satellite.h"
|
||||
#include <cmath>
|
||||
|
||||
Gps_Ephemeris::Gps_Ephemeris()
|
||||
|
@ -160,11 +160,11 @@ void Gps_Navigation_Message::print_gps_word_bytes(uint32_t GPS_word)
|
||||
}
|
||||
|
||||
|
||||
bool Gps_Navigation_Message::read_navigation_bool(std::bitset<GPS_SUBFRAME_BITS> bits, const std::vector<std::pair<int32_t, int32_t>> parameter)
|
||||
bool Gps_Navigation_Message::read_navigation_bool(std::bitset<GPS_SUBFRAME_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter)
|
||||
{
|
||||
bool value;
|
||||
|
||||
if (bits[GPS_SUBFRAME_BITS - parameter[0].first] == 1)
|
||||
if (static_cast<int>(bits[GPS_SUBFRAME_BITS - parameter[0].first]) == 1)
|
||||
{
|
||||
value = true;
|
||||
}
|
||||
@ -176,7 +176,7 @@ bool Gps_Navigation_Message::read_navigation_bool(std::bitset<GPS_SUBFRAME_BITS>
|
||||
}
|
||||
|
||||
|
||||
uint64_t Gps_Navigation_Message::read_navigation_unsigned(std::bitset<GPS_SUBFRAME_BITS> bits, const std::vector<std::pair<int32_t, int32_t>> parameter)
|
||||
uint64_t Gps_Navigation_Message::read_navigation_unsigned(std::bitset<GPS_SUBFRAME_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter)
|
||||
{
|
||||
uint64_t value = 0ULL;
|
||||
int32_t num_of_slices = parameter.size();
|
||||
@ -185,7 +185,7 @@ uint64_t Gps_Navigation_Message::read_navigation_unsigned(std::bitset<GPS_SUBFRA
|
||||
for (int32_t j = 0; j < parameter[i].second; j++)
|
||||
{
|
||||
value <<= 1; // shift left
|
||||
if (bits[GPS_SUBFRAME_BITS - parameter[i].first - j] == 1)
|
||||
if (static_cast<int>(bits[GPS_SUBFRAME_BITS - parameter[i].first - j]) == 1)
|
||||
{
|
||||
value += 1ULL; // insert the bit
|
||||
}
|
||||
@ -195,13 +195,13 @@ uint64_t Gps_Navigation_Message::read_navigation_unsigned(std::bitset<GPS_SUBFRA
|
||||
}
|
||||
|
||||
|
||||
int64_t Gps_Navigation_Message::read_navigation_signed(std::bitset<GPS_SUBFRAME_BITS> bits, const std::vector<std::pair<int32_t, int32_t>> parameter)
|
||||
int64_t Gps_Navigation_Message::read_navigation_signed(std::bitset<GPS_SUBFRAME_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter)
|
||||
{
|
||||
int64_t value = 0LL;
|
||||
int32_t num_of_slices = parameter.size();
|
||||
|
||||
// read the MSB and perform the sign extension
|
||||
if (bits[GPS_SUBFRAME_BITS - parameter[0].first] == 1)
|
||||
if (static_cast<int>(bits[GPS_SUBFRAME_BITS - parameter[0].first]) == 1)
|
||||
{
|
||||
value ^= 0xFFFFFFFFFFFFFFFFLL; // 64 bits variable
|
||||
}
|
||||
@ -216,7 +216,7 @@ int64_t Gps_Navigation_Message::read_navigation_signed(std::bitset<GPS_SUBFRAME_
|
||||
{
|
||||
value <<= 1; // shift left
|
||||
value &= 0xFFFFFFFFFFFFFFFELL; // reset the corresponding bit (for the 64 bits variable)
|
||||
if (bits[GPS_SUBFRAME_BITS - parameter[i].first - j] == 1)
|
||||
if (static_cast<int>(bits[GPS_SUBFRAME_BITS - parameter[i].first - j]) == 1)
|
||||
{
|
||||
value += 1LL; // insert the bit
|
||||
}
|
||||
@ -226,7 +226,7 @@ int64_t Gps_Navigation_Message::read_navigation_signed(std::bitset<GPS_SUBFRAME_
|
||||
}
|
||||
|
||||
|
||||
int32_t Gps_Navigation_Message::subframe_decoder(char *subframe)
|
||||
int32_t Gps_Navigation_Message::subframe_decoder(char* subframe)
|
||||
{
|
||||
int32_t subframe_ID = 0;
|
||||
uint32_t gps_word;
|
||||
@ -351,7 +351,7 @@ int32_t Gps_Navigation_Message::subframe_decoder(char *subframe)
|
||||
if (SV_page > 24 && SV_page < 33) // Page 4 (from Table 20-V. Data IDs and SV IDs in Subframes 4 and 5, IS-GPS-200H, page 110)
|
||||
{
|
||||
//! \TODO read almanac
|
||||
if (SV_data_ID)
|
||||
if (SV_data_ID != 0)
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -428,7 +428,7 @@ int32_t Gps_Navigation_Message::subframe_decoder(char *subframe)
|
||||
if (SV_page_5 < 25)
|
||||
{
|
||||
//! \TODO read almanac
|
||||
if (SV_data_ID_5)
|
||||
if (SV_data_ID_5 != 0)
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -510,7 +510,7 @@ double Gps_Navigation_Message::utc_time(const double gpstime_corrected) const
|
||||
* proper accommodation of the leap second event with a possible week number
|
||||
* transition is provided by the following expression for UTC:
|
||||
*/
|
||||
int32_t W = fmod(gpstime_corrected - Delta_t_UTC - 43200, 86400) + 43200;
|
||||
int32_t W = static_cast<int32_t>(fmod(gpstime_corrected - Delta_t_UTC - 43200, 86400)) + 43200;
|
||||
t_utc_daytime = fmod(W, 86400 + d_DeltaT_LSF - d_DeltaT_LS);
|
||||
//implement something to handle a leap second event!
|
||||
}
|
||||
|
@ -54,9 +54,9 @@
|
||||
class Gps_Navigation_Message
|
||||
{
|
||||
private:
|
||||
uint64_t read_navigation_unsigned(std::bitset<GPS_SUBFRAME_BITS> bits, const std::vector<std::pair<int32_t, int32_t>> parameter);
|
||||
int64_t read_navigation_signed(std::bitset<GPS_SUBFRAME_BITS> bits, const std::vector<std::pair<int32_t, int32_t>> parameter);
|
||||
bool read_navigation_bool(std::bitset<GPS_SUBFRAME_BITS> bits, const std::vector<std::pair<int32_t, int32_t>> parameter);
|
||||
uint64_t read_navigation_unsigned(std::bitset<GPS_SUBFRAME_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter);
|
||||
int64_t read_navigation_signed(std::bitset<GPS_SUBFRAME_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter);
|
||||
bool read_navigation_bool(std::bitset<GPS_SUBFRAME_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter);
|
||||
void print_gps_word_bytes(uint32_t GPS_word);
|
||||
|
||||
public:
|
||||
@ -198,7 +198,7 @@ public:
|
||||
/*!
|
||||
* \brief Decodes the GPS NAV message
|
||||
*/
|
||||
int32_t subframe_decoder(char *subframe);
|
||||
int32_t subframe_decoder(char* subframe);
|
||||
|
||||
/*!
|
||||
* \brief Computes the Coordinated Universal Time (UTC) and
|
||||
|
@ -84,7 +84,7 @@ double Gps_Utc_Model::utc_time(double gpstime_corrected, int32_t i_GPS_week)
|
||||
* proper accommodation of the leap second event with a possible week number
|
||||
* transition is provided by the following expression for UTC:
|
||||
*/
|
||||
int32_t W = fmod(gpstime_corrected - Delta_t_UTC - 43200, 86400) + 43200;
|
||||
int32_t W = static_cast<int32_t>(fmod(gpstime_corrected - Delta_t_UTC - 43200, 86400)) + 43200;
|
||||
t_utc_daytime = fmod(W, 86400 + d_DeltaT_LSF - d_DeltaT_LS);
|
||||
// implement something to handle a leap second event!
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user