mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-01-05 15:00:33 +00:00
Use std::array for compile-time bound checking
This commit is contained in:
parent
04a62b813f
commit
1cd7ca301d
@ -441,7 +441,7 @@ std::string Nmea_Printer::get_GPGSA()
|
|||||||
// GSA-GNSS DOP and Active Satellites
|
// GSA-GNSS DOP and Active Satellites
|
||||||
std::stringstream sentence_str;
|
std::stringstream sentence_str;
|
||||||
unsigned char buff[1024] = {0};
|
unsigned char buff[1024] = {0};
|
||||||
outnmea_gsa(buff, &d_PVT_data->pvt_sol, d_PVT_data->pvt_ssat);
|
outnmea_gsa(buff, &d_PVT_data->pvt_sol, d_PVT_data->pvt_ssat.data());
|
||||||
sentence_str << buff;
|
sentence_str << buff;
|
||||||
return sentence_str.str();
|
return sentence_str.str();
|
||||||
}
|
}
|
||||||
@ -454,7 +454,7 @@ std::string Nmea_Printer::get_GPGSV()
|
|||||||
// Notice that NMEA 2.1 only supports 12 channels
|
// Notice that NMEA 2.1 only supports 12 channels
|
||||||
std::stringstream sentence_str;
|
std::stringstream sentence_str;
|
||||||
unsigned char buff[1024] = {0};
|
unsigned char buff[1024] = {0};
|
||||||
outnmea_gsv(buff, &d_PVT_data->pvt_sol, d_PVT_data->pvt_ssat);
|
outnmea_gsv(buff, &d_PVT_data->pvt_sol, d_PVT_data->pvt_ssat.data());
|
||||||
sentence_str << buff;
|
sentence_str << buff;
|
||||||
return sentence_str.str();
|
return sentence_str.str();
|
||||||
}
|
}
|
||||||
|
@ -507,9 +507,9 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
|
|||||||
int valid_obs = 0; // valid observations counter
|
int valid_obs = 0; // valid observations counter
|
||||||
int glo_valid_obs = 0; // GLONASS L1/L2 valid observations counter
|
int glo_valid_obs = 0; // GLONASS L1/L2 valid observations counter
|
||||||
|
|
||||||
obsd_t obs_data[MAXOBS];
|
std::array<obsd_t, MAXOBS> obs_data;
|
||||||
eph_t eph_data[MAXOBS];
|
std::array<eph_t, MAXOBS> eph_data;
|
||||||
geph_t geph_data[MAXOBS];
|
std::array<geph_t, MAXOBS> geph_data;
|
||||||
|
|
||||||
// Workaround for NAV/CNAV clash problem
|
// Workaround for NAV/CNAV clash problem
|
||||||
bool gps_dual_band = false;
|
bool gps_dual_band = false;
|
||||||
@ -894,8 +894,8 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
|
|||||||
int result = 0;
|
int result = 0;
|
||||||
int sat = 0;
|
int sat = 0;
|
||||||
nav_t nav_data;
|
nav_t nav_data;
|
||||||
nav_data.eph = eph_data;
|
nav_data.eph = eph_data.data();
|
||||||
nav_data.geph = geph_data;
|
nav_data.geph = geph_data.data();
|
||||||
nav_data.n = valid_obs;
|
nav_data.n = valid_obs;
|
||||||
nav_data.ng = glo_valid_obs;
|
nav_data.ng = glo_valid_obs;
|
||||||
|
|
||||||
@ -915,7 +915,7 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
result = rtkpos(&rtk_, obs_data, valid_obs + glo_valid_obs, &nav_data);
|
result = rtkpos(&rtk_, obs_data.data(), valid_obs + glo_valid_obs, &nav_data);
|
||||||
|
|
||||||
if (result == 0)
|
if (result == 0)
|
||||||
{
|
{
|
||||||
@ -976,7 +976,7 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
|
|||||||
}
|
}
|
||||||
this->set_rx_pos(rx_position_and_time.rows(0, 2)); // save ECEF position for the next iteration
|
this->set_rx_pos(rx_position_and_time.rows(0, 2)); // save ECEF position for the next iteration
|
||||||
|
|
||||||
//compute Ground speed and COG
|
// compute Ground speed and COG
|
||||||
double ground_speed_ms = 0.0;
|
double ground_speed_ms = 0.0;
|
||||||
double pos[3];
|
double pos[3];
|
||||||
double enuv[3];
|
double enuv[3];
|
||||||
@ -1015,9 +1015,7 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
|
|||||||
<< " [deg], Height= " << this->get_height() << " [m]"
|
<< " [deg], Height= " << this->get_height() << " [m]"
|
||||||
<< " RX time offset= " << this->get_time_offset_s() << " [s]";
|
<< " RX time offset= " << this->get_time_offset_s() << " [s]";
|
||||||
|
|
||||||
|
// ######## PVT MONITOR #########
|
||||||
// PVT MONITOR
|
|
||||||
|
|
||||||
// TOW
|
// TOW
|
||||||
monitor_pvt.TOW_at_current_symbol_ms = gnss_observables_map.begin()->second.TOW_at_current_symbol_ms;
|
monitor_pvt.TOW_at_current_symbol_ms = gnss_observables_map.begin()->second.TOW_at_current_symbol_ms;
|
||||||
// WEEK
|
// WEEK
|
||||||
@ -1067,7 +1065,6 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
|
|||||||
monitor_pvt.hdop = dop_[2];
|
monitor_pvt.hdop = dop_[2];
|
||||||
monitor_pvt.vdop = dop_[3];
|
monitor_pvt.vdop = dop_[3];
|
||||||
|
|
||||||
|
|
||||||
// ######## LOG FILE #########
|
// ######## LOG FILE #########
|
||||||
if (d_flag_dump_enabled == true)
|
if (d_flag_dump_enabled == true)
|
||||||
{
|
{
|
||||||
|
@ -84,7 +84,7 @@
|
|||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief This class implements a simple PVT Least Squares solution
|
* \brief This class implements a PVT solution based on RTKLIB
|
||||||
*/
|
*/
|
||||||
class Rtklib_Solver : public Pvt_Solution
|
class Rtklib_Solver : public Pvt_Solution
|
||||||
{
|
{
|
||||||
@ -107,7 +107,7 @@ public:
|
|||||||
bool get_PVT(const std::map<int, Gnss_Synchro>& gnss_observables_map, bool flag_averaging);
|
bool get_PVT(const std::map<int, Gnss_Synchro>& gnss_observables_map, bool flag_averaging);
|
||||||
|
|
||||||
sol_t pvt_sol;
|
sol_t pvt_sol;
|
||||||
ssat_t pvt_ssat[MAXSAT];
|
std::array<ssat_t, MAXSAT> pvt_ssat;
|
||||||
double get_hdop() const;
|
double get_hdop() const;
|
||||||
double get_vdop() const;
|
double get_vdop() const;
|
||||||
double get_pdop() const;
|
double get_pdop() const;
|
||||||
|
Loading…
Reference in New Issue
Block a user