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

Simplify initializations

This commit is contained in:
Carles Fernandez 2019-07-07 19:56:23 +02:00
parent cf8f4af527
commit 29a910df30
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
9 changed files with 17 additions and 127 deletions

View File

@ -42,34 +42,6 @@ Monitor_Pvt_Udp_Sink::Monitor_Pvt_Udp_Sink(const std::vector<std::string>& addre
boost::asio::ip::udp::endpoint endpoint(boost::asio::ip::address::from_string(address, error), port);
endpoints.push_back(endpoint);
}
monitor_pvt.TOW_at_current_symbol_ms = 0U;
monitor_pvt.week = 0U;
monitor_pvt.RX_time = 0.0;
monitor_pvt.user_clk_offset = 0.0;
monitor_pvt.pos_x = 0.0;
monitor_pvt.pos_y = 0.0;
monitor_pvt.pos_z = 0.0;
monitor_pvt.vel_x = 0.0;
monitor_pvt.vel_y = 0.0;
monitor_pvt.vel_z = 0.0;
monitor_pvt.cov_xx = 0.0;
monitor_pvt.cov_yy = 0.0;
monitor_pvt.cov_zz = 0.0;
monitor_pvt.cov_xy = 0.0;
monitor_pvt.cov_yz = 0.0;
monitor_pvt.cov_zx = 0.0;
monitor_pvt.latitude = 0.0;
monitor_pvt.longitude = 0.0;
monitor_pvt.height = 0.0;
monitor_pvt.valid_sats = 0;
monitor_pvt.solution_status = 0;
monitor_pvt.solution_type = 0;
monitor_pvt.AR_ratio_factor = 0.0;
monitor_pvt.AR_ratio_threshold = 0.0;
monitor_pvt.gdop = 0.0;
monitor_pvt.pdop = 0.0;
monitor_pvt.hdop = 0.0;
monitor_pvt.vdop = 0.0;
use_protobuf = protobuf_enabled;
if (use_protobuf)

View File

@ -53,7 +53,7 @@ private:
boost::asio::ip::udp::socket socket;
boost::system::error_code error;
std::vector<boost::asio::ip::udp::endpoint> endpoints;
Monitor_Pvt monitor_pvt;
Monitor_Pvt monitor_pvt{};
Serdes_Monitor_Pvt serdes;
bool use_protobuf;
};

View File

@ -77,16 +77,7 @@ Rtklib_Solver::Rtklib_Solver(int nchannels, std::string dump_filename, bool flag
count_valid_position = 0;
this->set_averaging_flag(false);
rtk_ = rtk;
for (double &i : dop_)
{
i = 0.0;
}
pvt_sol = {{0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, '0', '0', '0', 0, 0, 0};
ssat_t ssat0 = {0, 0, {0.0}, {0.0}, {0.0}, {'0'}, {'0'}, {'0'}, {'0'}, {'0'}, {}, {}, {}, {}, 0.0, 0.0, 0.0, 0.0, {{{0, 0}}, {{0, 0}}}, {{}, {}}};
for (auto &i : pvt_ssat)
{
i = ssat0;
}
// ############# ENABLE DATA FILE LOG #################
if (d_flag_dump_enabled == true)
{
@ -104,35 +95,6 @@ Rtklib_Solver::Rtklib_Solver(int nchannels, std::string dump_filename, bool flag
}
}
}
// PVT MONITOR
monitor_pvt.TOW_at_current_symbol_ms = 0U;
monitor_pvt.week = 0U;
monitor_pvt.RX_time = 0.0;
monitor_pvt.user_clk_offset = 0.0;
monitor_pvt.pos_x = 0.0;
monitor_pvt.pos_y = 0.0;
monitor_pvt.pos_z = 0.0;
monitor_pvt.vel_x = 0.0;
monitor_pvt.vel_y = 0.0;
monitor_pvt.vel_z = 0.0;
monitor_pvt.cov_xx = 0.0;
monitor_pvt.cov_yy = 0.0;
monitor_pvt.cov_zz = 0.0;
monitor_pvt.cov_xy = 0.0;
monitor_pvt.cov_yz = 0.0;
monitor_pvt.cov_zx = 0.0;
monitor_pvt.latitude = 0.0;
monitor_pvt.longitude = 0.0;
monitor_pvt.height = 0.0;
monitor_pvt.valid_sats = 0;
monitor_pvt.solution_status = 0;
monitor_pvt.solution_type = 0;
monitor_pvt.AR_ratio_factor = 0.0;
monitor_pvt.AR_ratio_threshold = 0.0;
monitor_pvt.gdop = 0.0;
monitor_pvt.pdop = 0.0;
monitor_pvt.hdop = 0.0;
monitor_pvt.vdop = 0.0;
}
bool Rtklib_Solver::save_matfile()
@ -450,9 +412,9 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
int valid_obs = 0; // valid observations counter
int glo_valid_obs = 0; // GLONASS L1/L2 valid observations counter
std::array<obsd_t, MAXOBS> obs_data;
std::array<eph_t, MAXOBS> eph_data;
std::array<geph_t, MAXOBS> geph_data;
std::array<obsd_t, MAXOBS> obs_data{};
std::array<eph_t, MAXOBS> eph_data{};
std::array<geph_t, MAXOBS> geph_data{};
// Workaround for NAV/CNAV clash problem
bool gps_dual_band = false;

View File

@ -94,8 +94,8 @@ public:
bool get_PVT(const std::map<int, Gnss_Synchro>& gnss_observables_map, bool flag_averaging);
sol_t pvt_sol;
std::array<ssat_t, MAXSAT> pvt_ssat;
sol_t pvt_sol{};
std::array<ssat_t, MAXSAT> pvt_ssat{};
double get_hdop() const;
double get_vdop() const;
double get_pdop() const;
@ -129,15 +129,15 @@ public:
int count_valid_position;
private:
rtk_t rtk_;
rtk_t rtk_{};
std::string d_dump_filename;
std::ofstream d_dump_file;
bool save_matfile();
bool d_flag_dump_enabled;
bool d_flag_dump_mat_enabled;
int d_nchannels; // Number of available channels for positioning
std::array<double, 4> dop_;
Monitor_Pvt monitor_pvt;
std::array<double, 4> dop_{};
Monitor_Pvt monitor_pvt{};
};
#endif

View File

@ -55,6 +55,7 @@ public:
// google::protobuf::ShutdownProtobufLibrary();
}
/*
inline Serdes_Monitor_Pvt(Serdes_Monitor_Pvt&& other) //!< Copy constructor
{
this->monitor_ = other.monitor_;
@ -83,7 +84,7 @@ public:
this->monitor_ = std::move(other.monitor_);
}
return *this;
}
}*/
inline std::string createProtobuffer(const Monitor_Pvt& monitor) //!< Serialization into a string
{
@ -161,7 +162,7 @@ public:
}
private:
gnss_sdr::MonitorPvt monitor_;
gnss_sdr::MonitorPvt monitor_{};
};
#endif // GNSS_SDR_SERDES_MONITOR_PVT_H_

View File

@ -56,7 +56,7 @@ public:
{
google::protobuf::ShutdownProtobufLibrary();
}
/*
inline Serdes_Gnss_Synchro(Serdes_Gnss_Synchro&& other) //!< Copy constructor
{
this->observables = other.observables;
@ -85,7 +85,7 @@ public:
this->observables = std::move(other.observables);
}
return *this;
}
}*/
inline std::string createProtobuffer(const std::vector<Gnss_Synchro>& vgs) //!< Serialization into a string
{
@ -179,7 +179,7 @@ public:
}
private:
gnss_sdr::Observables observables;
gnss_sdr::Observables observables{};
};
#endif // GNSS_SDR_SERDES_GNSS_SYNCHRO_H_

View File

@ -79,7 +79,7 @@ private:
std::shared_ptr<INIReader> ini_reader_;
std::shared_ptr<InMemoryConfiguration> overrided_;
std::unique_ptr<StringConverter> converter_;
int error_;
int error_{};
};
#endif /*GNSS_SDR_FILE_CONFIGURATION_H_*/

View File

@ -50,47 +50,6 @@ Gnss_Signal::Gnss_Signal(const Gnss_Satellite& satellite_, const std::string& si
}
/*
// Copy constructor
Gnss_Signal::Gnss_Signal(Gnss_Signal&& other)
{
*this = std::move(other);
}
// Copy assignment operator
Gnss_Signal& Gnss_Signal::operator=(const Gnss_Signal& rhs)
{
// Only do assignment if RHS is a different object from this.
if (this != &rhs)
{
// Deallocate, allocate new space, copy values...
this->satellite = rhs.get_satellite();
this->signal = rhs.get_signal_str();
}
return *this;
}
// Move constructor
Gnss_Signal::Gnss_Signal(const Gnss_Signal& other)
{
*this = other;
}
// Move assignment operator
Gnss_Signal& Gnss_Signal::operator=(Gnss_Signal&& other)
{
if (this != &other)
{
this->satellite = std::move(other.get_satellite());
this->signal = std::move(other.get_signal_str());
}
return *this;
}
*/
std::string Gnss_Signal::get_signal_str() const
{
return this->signal;

View File

@ -54,10 +54,6 @@ public:
friend bool operator==(const Gnss_Signal& /*sig1*/, const Gnss_Signal& /*sig2*/); //!< operator== for comparison
friend std::ostream& operator<<(std::ostream& /*out*/, const Gnss_Signal& /*sig*/); //!< operator<< for pretty printing
/*Gnss_Signal(Gnss_Signal&& other); //!< Copy constructor
Gnss_Signal& operator=(const Gnss_Signal&); //!< Copy assignment operator
Gnss_Signal(const Gnss_Signal& other); //!< Move constructor
Gnss_Signal& operator=(Gnss_Signal&& other); //!< Move assignment operator */
private:
Gnss_Satellite satellite{};
std::string signal{};