|
Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
Go to the documentation of this file.
41 const double sin_lat = sin(def->
lla.
lat);
42 const double cos_lat = cos(def->
lla.
lat);
43 const double sin_lon = sin(def->
lla.
lon);
44 const double cos_lon = cos(def->
lla.
lon);
65 const double sin_lat = sin(def->
lla.
lat);
66 const double cos_lat = cos(def->
lla.
lat);
67 const double sin_lon = sin(def->
lla.
lon);
68 const double cos_lon = cos(def->
lla.
lon);
87 static const double a = 6378137.0;
88 static const double f = 1. / 298.257223563;
89 const double b = a * (1. -
f);
90 const double b2 =
b *
b;
92 const double e2 = 2.*
f - (
f *
f);
93 const double ep2 =
f * (2. -
f) / ((1. -
f) * (1. -
f));
94 const double E2 = a * a - b2;
97 const double z2 = ecef->
z * ecef->
z;
98 const double r2 = ecef->
x * ecef->
x + ecef->
y * ecef->
y;
99 const double r = sqrt(r2);
100 const double F = 54.*b2 *
z2;
101 const double G = r2 + (1 - e2) *
z2 - e2 * E2;
102 const double c = (e2 * e2 * F * r2) / (G * G * G);
103 const double s = pow((1 +
c + sqrt(
c *
c + 2 *
c)), 1. / 3.);
104 const double s1 = 1 +
s + 1 /
s;
105 const double P = F / (3 *
s1 *
s1 * G * G);
106 const double Q = sqrt(1 + 2 * e2 * e2 *
P);
107 const double ro = -(e2 *
P * r) / (1 + Q) + sqrt((a * a / 2) * (1 + 1 / Q) - ((1 - e2) *
P *
z2) / (Q *
108 (1 + Q)) -
P * r2 / 2);
109 const double tmp = (r - e2 * ro) * (r - e2 * ro);
110 const double U = sqrt(tmp +
z2);
111 const double V = sqrt(tmp + (1 - e2) *
z2);
112 const double zo = (b2 * ecef->
z) / (a * V);
114 lla->
alt = U * (1 - b2 / (a * V));
115 lla->
lat = atan((ecef->
z + ep2 * zo) / r);
116 lla->
lon = atan2(ecef->
y, ecef->
x);
124 static const double a = 6378137.0;
125 static const double f = 1. / 298.257223563;
126 const double e2 = 2.*
f - (
f *
f);
128 const double sin_lat = sin(lla->
lat);
129 const double cos_lat = cos(lla->
lat);
130 const double sin_lon = sin(lla->
lon);
131 const double cos_lon = cos(lla->
lon);
132 const double chi = sqrt(1. - e2 * sin_lat * sin_lat);
133 const double a_chi = a / chi;
135 ecef->
x = (a_chi + lla->
alt) * cos_lat * cos_lon;
136 ecef->
y = (a_chi + lla->
alt) * cos_lat * sin_lon;
137 ecef->
z = (a_chi * (1. - e2) + lla->
alt) * sin_lat;
212 const double a = 6378137.0;
213 const double f = 1. / 298.257223563;
214 const double c2 = (1. -
f) * (1. -
f);
216 double ls = atan(
c2 * tan(gd_lat));
217 return atan2(hmsl * sin(gd_lat) + a * sin(ls), hmsl * cos(gd_lat) + a * cos(ls));
225 return log(tan(M_PI_4 + phi / 2.0)) - e / 2.0 * log((1.0 + e * sin(phi)) / (1.0 - e * sin(phi)));
230 return log(tan(M_PI_4 + phi / 2.0));
235 double exp_l = exp(lat);
236 double phi0 = 2 * atan(exp_l) - M_PI_2;
242 double sin_phi = e * sin(phi_);
243 phi0 = 2 * atan(pow((1 + sin_phi) / (1. - sin_phi), e / 2.) * exp_l) - M_PI_2;
245 }
while (max_iter && fabs(phi_ - phi0) >
epsilon);
257 double e = exp(v.x);\
264 struct DoubleVect2 vstar = {-v.x, -v.y}; \
267 VECT2_SUB(v, vstar);\
268 VECT2_SMUL(v, v, -0.5); \
279 if (utm->
zone == 0) {
285 double dl = lla->
lon - lambda_c;
286 double phi_ = asin(sin(dl) / cosh(ll));
288 double lambda_ = atan(sinh(ll) / cos(dl));
292 for (k = 1; k < 3; k++) {
328 lla->
lon = lambda_c + atan(sinh(z.
y) / cos(z.
x));
329 double phi = asin(sin(z.
x) / cosh(z.
y));
VIC slots used for the LPC2148 define name e g gps UART1_VIC_SLOT e g modem SPI1_VIC_SLOT SPI1 in mcu_periph spi_arch c or spi_slave_hs_arch c(and some others not using the SPI peripheral yet..) I2C0_VIC_SLOT 8 mcu_periph/i2c_arch.c I2C1_VIC_SLOT 9 mcu_periph/i2c_arch.c USB_VIC_SLOT 10 usb
void ltp_def_from_ecef_d(struct LtpDef_d *def, struct EcefCoor_d *ecef)
#define VECT2_SMUL(_vo, _vi, _s)
vector in East North Up coordinates Units: meters
vector in Latitude, Longitude and Altitude
#define LLA_COPY(_pos1, _pos2)
static double isometric_latitude_d(double phi, double e)
void ecef_of_lla_d(struct EcefCoor_d *ecef, struct LlaCoor_d *lla)
double alt
in meters above WGS84 reference ellipsoid
void ltp_def_from_lla_d(struct LtpDef_d *def, struct LlaCoor_d *lla)
static const float scale[]
#define UtmZoneOfLlaLonRad(lla_lon)
void ecef_of_enu_point_d(struct EcefCoor_d *ecef, struct LtpDef_d *def, struct EnuCoor_d *enu)
struct DoubleRMat ltp_of_ecef
rotation from ECEF to local frame
#define VECT3_DIFF(_c, _a, _b)
#define VECT2_ADD(_a, _b)
#define VECT3_ADD(_a, _b)
static const float serie_coeff_proj_mercator_inverse[5]
struct EcefCoor_d ecef
origin of local frame in ECEF
void ecef_of_ned_vect_d(struct EcefCoor_d *ecef, struct LtpDef_d *def, struct NedCoor_d *ned)
void ecef_of_ned_point_d(struct EcefCoor_d *ecef, struct LtpDef_d *def, struct NedCoor_d *ned)
void lla_of_utm_d(struct LlaCoor_d *lla, struct UtmCoor_d *utm)
Constants UTM (Mercator) projections.
static double isometric_latitude_fast_d(double phi)
vector in North East Down coordinates Units: meters
Paparazzi double-precision floating point math for geodetic calculations.
void ned_of_lla_point_d(struct NedCoor_d *ned, struct LtpDef_d *def, struct LlaCoor_d *lla)
definition of the local (flat earth) coordinate system
void enu_of_lla_point_d(struct EnuCoor_d *enu, struct LtpDef_d *def, struct LlaCoor_d *lla)
uint16_t f
Camera baseline, in meters (i.e. horizontal distance between the two cameras of the stereo setup)
position in UTM coordinates Units: meters
#define LambdaOfUtmZone(utm_zone)
#define VECT2_SUB(_a, _b)
#define MAT33_VECT3_MUL(_vout, _mat, _vin)
static double inverse_isometric_latitude_d(double lat, double e, double epsilon)
void ned_of_ecef_point_d(struct NedCoor_d *ned, struct LtpDef_d *def, struct EcefCoor_d *ecef)
vector in EarthCenteredEarthFixed coordinates
void lla_of_ecef_d(struct LlaCoor_d *lla, struct EcefCoor_d *ecef)
static const float serie_coeff_proj_mercator[5]
double gc_of_gd_lat_d(double gd_lat, double hmsl)
void ned_of_ecef_vect_d(struct NedCoor_d *ned, struct LtpDef_d *def, struct EcefCoor_d *ecef)
void enu_of_ecef_vect_d(struct EnuCoor_d *enu, struct LtpDef_d *def, struct EcefCoor_d *ecef)
uint8_t zone
UTM zone number.
#define ENU_OF_TO_NED(_po, _pi)
#define MAT33_VECT3_TRANSP_MUL(_vout, _mat, _vin)
struct LlaCoor_d lla
origin of local frame in LLA
void enu_of_ecef_point_d(struct EnuCoor_d *enu, struct LtpDef_d *def, struct EcefCoor_d *ecef)
#define VECT3_COPY(_a, _b)
void utm_of_lla_d(struct UtmCoor_d *utm, struct LlaCoor_d *lla)
double alt
in meters (above WGS84 reference ellipsoid or above MSL)
void ecef_of_enu_vect_d(struct EcefCoor_d *ecef, struct LtpDef_d *def, struct EnuCoor_d *enu)