1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-01-07 07:50:32 +00:00

Fix defects detected by Coverity Scan

This commit is contained in:
Carles Fernandez 2018-11-08 15:34:58 +01:00
parent 79fa7ce6ca
commit a544112a84
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
3 changed files with 17 additions and 15 deletions

View File

@ -301,7 +301,7 @@ double mstokph(double MetersPerSeconds)
arma::vec CTM_to_Euler(const arma::mat &C) arma::vec CTM_to_Euler(const arma::mat &C)
{ {
// Calculate Euler angles using (2.23) // Calculate Euler angles using (2.23)
arma::mat CTM = C; arma::mat CTM(C);
arma::vec eul = arma::zeros(3, 1); arma::vec eul = arma::zeros(3, 1);
eul(0) = atan2(CTM(1, 2), CTM(2, 2)); // roll eul(0) = atan2(CTM(1, 2), CTM(2, 2)); // roll
if (CTM(0, 2) < -1.0) CTM(0, 2) = -1.0; if (CTM(0, 2) < -1.0) CTM(0, 2) = -1.0;

View File

@ -94,6 +94,7 @@ ControlThread::ControlThread(std::shared_ptr<ConfigurationInterface> configurati
{ {
configuration_ = configuration; configuration_ = configuration;
delete_configuration_ = false; delete_configuration_ = false;
restart_ = false;
init(); init();
} }
@ -112,6 +113,7 @@ void ControlThread::telecommand_listener()
cmd_interface_.run_cmd_server(tcp_cmd_port); cmd_interface_.run_cmd_server(tcp_cmd_port);
} }
/* /*
* Runs the control thread that manages the receiver control plane * Runs the control thread that manages the receiver control plane
* *
@ -164,7 +166,6 @@ int ControlThread::run()
cmd_interface_.set_pvt(flowgraph_->get_pvt()); cmd_interface_.set_pvt(flowgraph_->get_pvt());
cmd_interface_thread_ = boost::thread(&ControlThread::telecommand_listener, this); cmd_interface_thread_ = boost::thread(&ControlThread::telecommand_listener, this);
bool enable_FPGA = configuration_->property("Channel.enable_FPGA", false); bool enable_FPGA = configuration_->property("Channel.enable_FPGA", false);
if (enable_FPGA == true) if (enable_FPGA == true)
{ {
@ -764,7 +765,8 @@ void ControlThread::apply_action(unsigned int what)
} }
} }
std::vector<std::pair<int, Gnss_Satellite>> ControlThread::get_visible_sats(time_t rx_utc_time, arma::vec LLH)
std::vector<std::pair<int, Gnss_Satellite>> ControlThread::get_visible_sats(time_t rx_utc_time, const arma::vec &LLH)
{ {
// 1. Compute rx ECEF position from LLH WGS84 // 1. Compute rx ECEF position from LLH WGS84
arma::vec LLH_rad = arma::vec{degtorad(LLH(0)), degtorad(LLH(1)), LLH(2)}; arma::vec LLH_rad = arma::vec{degtorad(LLH(0)), degtorad(LLH(1)), LLH(2)};
@ -779,7 +781,7 @@ std::vector<std::pair<int, Gnss_Satellite>> ControlThread::get_visible_sats(time
utc_gtime.sec = 0; utc_gtime.sec = 0;
gtime_t gps_gtime = utc2gpst(utc_gtime); gtime_t gps_gtime = utc2gpst(utc_gtime);
//2. loop throught all the available ephemeris or almanac and compute satellite positions and elevations // 3. loop through all the available ephemeris or almanac and compute satellite positions and elevations
// store visible satellites in a vector of pairs <int,Gnss_Satellite> to associate an elevation to the each satellite // store visible satellites in a vector of pairs <int,Gnss_Satellite> to associate an elevation to the each satellite
std::vector<std::pair<int, Gnss_Satellite>> available_satellites; std::vector<std::pair<int, Gnss_Satellite>> available_satellites;

View File

@ -148,8 +148,8 @@ private:
* Compute elevations for the specified time and position for all the available satellites in ephemeris and almanac queues * Compute elevations for the specified time and position for all the available satellites in ephemeris and almanac queues
* returns a vector filled with the available satellites ordered from high elevation to low elevation angle. * returns a vector filled with the available satellites ordered from high elevation to low elevation angle.
*/ */
std::vector<std::pair<int, Gnss_Satellite>> get_visible_sats(time_t rx_utc_time, const arma::vec& LLH);
std::vector<std::pair<int, Gnss_Satellite>> get_visible_sats(time_t rx_utc_time, arma::vec LLH);
/* /*
* Read initial GNSS assistance from SUPL server or local XML files * Read initial GNSS assistance from SUPL server or local XML files
*/ */