1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-01-16 04:05:46 +00:00

passing vectors by reference and not by value

This commit is contained in:
Carles Fernandez 2015-05-20 18:24:13 +02:00
parent 64a81d8c48
commit 490031b72c
2 changed files with 16 additions and 17 deletions

View File

@ -282,20 +282,20 @@ bool FrontEndCal::get_ephemeris()
}
arma::vec FrontEndCal::lla2ecef(arma::vec lla)
arma::vec FrontEndCal::lla2ecef(const arma::vec & lla)
{
// WGS84 flattening
double f = 1/298.257223563;
double f = 1.0 / 298.257223563;
// WGS84 equatorial radius
double R = 6378137;
double R = 6378137.0;
arma::vec ellipsoid = "0.0 0.0";
double phi = (lla(0)/360.0) * GPS_TWO_PI;
double lambda = (lla(1)/360.0) * GPS_TWO_PI;
double phi = (lla(0) / 360.0) * GPS_TWO_PI;
double lambda = (lla(1) / 360.0) * GPS_TWO_PI;
ellipsoid(0) = R;
ellipsoid(1) = sqrt(1-(1-f)*(1-f));
ellipsoid(1) = sqrt(1.0 - (1.0 - f)*(1.0 - f));
arma::vec ecef = "0.0 0.0 0.0 0.0";
ecef = geodetic2ecef(phi, lambda, lla(3), ellipsoid);
@ -304,18 +304,18 @@ arma::vec FrontEndCal::lla2ecef(arma::vec lla)
}
arma::vec FrontEndCal::geodetic2ecef(double phi, double lambda, double h, arma::vec ellipsoid)
arma::vec FrontEndCal::geodetic2ecef(double phi, double lambda, double h, const arma::vec & ellipsoid)
{
double a = ellipsoid(0);
double e2 = ellipsoid(1)*ellipsoid(1);
double sinphi = sin(phi);
double cosphi = cos(phi);
double N = a / sqrt(1 - e2 * sinphi*sinphi);
double N = a / sqrt(1.0 - e2 * sinphi*sinphi);
arma::vec ecef = "0.0 0.0 0.0 0.0";
ecef(0) = (N + h) * cosphi * cos(lambda);
ecef(1) = (N + h) * cosphi * sin(lambda);
ecef(2) = (N*(1 - e2) + h) * sinphi;
ecef(2) = (N*(1.0 - e2) + h) * sinphi;
return ecef;
}
@ -376,7 +376,6 @@ double FrontEndCal::estimate_doppler_from_eph(unsigned int PRN, double TOW, doub
double mean_Doppler_Hz;
mean_Doppler_Hz = arma::mean(Doppler_Hz);
return mean_Doppler_Hz;
return 0;
}
else
{
@ -389,13 +388,13 @@ void FrontEndCal::GPS_L1_front_end_model_E4000(double f_bb_true_Hz, double f_bb_
{
const double f_osc_n = 28.8e6;
//PLL registers settings (according to E4000 datasheet)
const double N = 109;
const double Y = 65536;
const double X = 26487;
const double R = 2;
const double N = 109.0;
const double Y = 65536.0;
const double X = 26487.0;
const double R = 2.0;
// Obtained RF center frequency
double f_rf_pll = (f_osc_n*(N+X/Y))/R;
double f_rf_pll = (f_osc_n * (N + X / Y)) /R;
// RF frequency error caused by fractional PLL roundings
double f_bb_err_pll = GPS_L1_FREQ_HZ - f_rf_pll;

View File

@ -49,7 +49,7 @@ private:
* coordinates, P. LLA is in [degrees degrees meters]. P is in meters.
* The default ellipsoid planet is WGS84. Original copyright (c) by Kai Borre.
*/
arma::vec lla2ecef(arma::vec lla);
arma::vec lla2ecef(const arma::vec & lla);
/*!
* GEODETIC2ECEF Convert geodetic to geocentric (ECEF) coordinates
* [X, Y, Z] = GEODETIC2ECEF(PHI, LAMBDA, H, ELLIPSOID) converts geodetic
@ -80,7 +80,7 @@ private:
* Paul R. Wolf and Bon A. Dewitt, "Elements of Photogrammetry with
* Applications in GIS," 3rd Ed., McGraw-Hill, 2000 (Appendix F-3).
*/
arma::vec geodetic2ecef(double phi, double lambda, double h, arma::vec ellipsoid);
arma::vec geodetic2ecef(double phi, double lambda, double h, const arma::vec & ellipsoid);
/*!
* \brief Reads the ephemeris data from an external XML file
*