1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-08-09 04:10:35 +00:00

Merge branch 'next' of https://github.com/gnss-sdr/gnss-sdr into next

This commit is contained in:
Carles Fernandez 2018-08-30 20:10:04 +02:00
commit 5c379ee155
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
2 changed files with 65 additions and 46 deletions

View File

@ -70,10 +70,7 @@ double WGS84_geocentric_radius(double Lat_geodetic_rad)
double WGS84_E = (sqrt(2 * WGS84_F - WGS84_F * WGS84_F)); // Eccentricity of the Earth double WGS84_E = (sqrt(2 * WGS84_F - WGS84_F * WGS84_F)); // Eccentricity of the Earth
// transverse radius of curvature // transverse radius of curvature
double R_E = WGS84_A / sqrt(1 - double R_E = WGS84_A / sqrt(1 - WGS84_E * WGS84_E * sin(Lat_geodetic_rad) * sin(Lat_geodetic_rad)); // (Eq. 2.66)
WGS84_E * WGS84_E *
sin(Lat_geodetic_rad) *
sin(Lat_geodetic_rad)); // (Eq. 2.66)
// geocentric radius at the Earth surface // geocentric radius at the Earth surface
double r_eS = R_E * sqrt(cos(Lat_geodetic_rad) * cos(Lat_geodetic_rad) + double r_eS = R_E * sqrt(cos(Lat_geodetic_rad) * cos(Lat_geodetic_rad) +
@ -99,19 +96,9 @@ int topocent(double *Az, double *El, double *D, const arma::vec &x, const arma::
double cb = cos(phi * dtr); double cb = cos(phi * dtr);
double sb = sin(phi * dtr); double sb = sin(phi * dtr);
arma::mat F = arma::zeros(3, 3); arma::mat F = {{-sl, -sb * cl, cb * cl},
{cl, -sb * sl, cb * sl},
F(0, 0) = -sl; {0.0, cb, sb}};
F(0, 1) = -sb * cl;
F(0, 2) = cb * cl;
F(1, 0) = cl;
F(1, 1) = -sb * sl;
F(1, 2) = cb * sl;
F(2, 0) = 0;
F(2, 1) = cb;
F(2, 2) = sb;
arma::vec local_vector; arma::vec local_vector;
@ -126,8 +113,8 @@ int topocent(double *Az, double *El, double *D, const arma::vec &x, const arma::
if (hor_dis < 1.0E-20) if (hor_dis < 1.0E-20)
{ {
*Az = 0; *Az = 0.0;
*El = 90; *El = 90.0;
} }
else else
{ {
@ -147,7 +134,7 @@ int topocent(double *Az, double *El, double *D, const arma::vec &x, const arma::
int togeod(double *dphi, double *dlambda, double *h, double a, double finv, double X, double Y, double Z) int togeod(double *dphi, double *dlambda, double *h, double a, double finv, double X, double Y, double Z)
{ {
*h = 0; *h = 0.0;
const double tolsq = 1.e-10; // tolerance to accept convergence const double tolsq = 1.e-10; // tolerance to accept convergence
const int maxit = 10; // max number of iterations const int maxit = 10; // max number of iterations
const double rtd = 180.0 / STRP_PI; const double rtd = 180.0 / STRP_PI;
@ -199,7 +186,7 @@ int togeod(double *dphi, double *dlambda, double *h, double a, double finv, doub
// approximate distance from origin to surface of ellipsoid // approximate distance from origin to surface of ellipsoid
if (r < 1.0E-20) if (r < 1.0E-20)
{ {
*h = 0; *h = 0.0;
return 1; return 1;
} }
@ -341,17 +328,10 @@ arma::mat Euler_to_CTM(const arma::vec &eul)
double sin_psi = sin(eul(2)); double sin_psi = sin(eul(2));
double cos_psi = cos(eul(2)); double cos_psi = cos(eul(2));
arma::mat C = arma::zeros(3, 3);
// Calculate coordinate transformation matrix using (2.22) // Calculate coordinate transformation matrix using (2.22)
C(0, 0) = cos_theta * cos_psi; arma::mat C = {{cos_theta * cos_psi, cos_theta * sin_psi, -sin_theta},
C(0, 1) = cos_theta * sin_psi; {-cos_phi * sin_psi + sin_phi * sin_theta * cos_psi, cos_phi * cos_psi + sin_phi * sin_theta * sin_psi, sin_phi * cos_theta},
C(0, 2) = -sin_theta; {sin_phi * sin_psi + cos_phi * sin_theta * cos_psi, -sin_phi * cos_psi + cos_phi * sin_theta * sin_psi, cos_phi * cos_theta}};
C(1, 0) = -cos_phi * sin_psi + sin_phi * sin_theta * cos_psi;
C(1, 1) = cos_phi * cos_psi + sin_phi * sin_theta * sin_psi;
C(1, 2) = sin_phi * cos_theta;
C(2, 0) = sin_phi * sin_psi + cos_phi * sin_theta * cos_psi;
C(2, 1) = -sin_phi * cos_psi + cos_phi * sin_theta * sin_psi;
C(2, 2) = cos_phi * cos_theta;
return C; return C;
} }

View File

@ -31,6 +31,60 @@
#include "spirent_motion_csv_dump_reader.h" #include "spirent_motion_csv_dump_reader.h"
#include <iostream> #include <iostream>
spirent_motion_csv_dump_reader::spirent_motion_csv_dump_reader()
{
header_lines = 2;
TOW_ms = 0.0;
Pos_X = 0.0;
Pos_Y = 0.0;
Pos_Z = 0.0;
Vel_X = 0.0;
Vel_Y = 0.0;
Vel_Z = 0.0;
Acc_X = 0.0;
Acc_Y = 0.0;
Acc_Z = 0.0;
Jerk_X = 0.0;
Jerk_Y = 0.0;
Jerk_Z = 0.0;
Lat = 0.0;
Long = 0.0;
Height = 0.0;
Heading = 0.0;
Elevation = 0.0;
Bank = 0.0;
Ang_vel_X = 0.0;
Ang_vel_Y = 0.0;
Ang_vel_Z = 0.0;
Ang_acc_X = 0.0;
Ang_acc_Y = 0.0;
Ang_acc_Z = 0.0;
Ant1_Pos_X = 0.0;
Ant1_Pos_Y = 0.0;
Ant1_Pos_Z = 0.0;
Ant1_Vel_X = 0.0;
Ant1_Vel_Y = 0.0;
Ant1_Vel_Z = 0.0;
Ant1_Acc_X = 0.0;
Ant1_Acc_Y = 0.0;
Ant1_Acc_Z = 0.0;
Ant1_Lat = 0.0;
Ant1_Long = 0.0;
Ant1_Height = 0.0;
Ant1_DOP = 0.0;
}
spirent_motion_csv_dump_reader::~spirent_motion_csv_dump_reader()
{
if (d_dump_file.is_open() == true)
{
d_dump_file.close();
}
}
bool spirent_motion_csv_dump_reader::read_csv_obs() bool spirent_motion_csv_dump_reader::read_csv_obs()
{ {
try try
@ -193,18 +247,3 @@ void spirent_motion_csv_dump_reader::close_obs_file()
d_dump_file.close(); d_dump_file.close();
} }
} }
spirent_motion_csv_dump_reader::spirent_motion_csv_dump_reader()
{
header_lines = 2;
}
spirent_motion_csv_dump_reader::~spirent_motion_csv_dump_reader()
{
if (d_dump_file.is_open() == true)
{
d_dump_file.close();
}
}