ISEarth.h
Go to the documentation of this file.
1 /*
2 MIT LICENSE
3 
4 Copyright (c) 2014-2021 Inertial Sense, Inc. - http://inertialsense.com
5 
6 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions :
7 
8 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 
10 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT, IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
11 */
12 
13 #ifndef ISEARTH_H_
14 #define ISEARTH_H_
15 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19 
20 #include <stdbool.h>
21 
22 #include "ISMatrix.h"
23 #include "ISConstants.h"
24 #include "ISPose.h"
25 
26 #define DEG2RAD_EARTH_RADIUS_F 111120.0f // = DEG2RAD * earth_radius_in_meters
27 #define INV_DEG2RAD_EARTH_RADIUS_F 8.99928005759539236861e-6f // = 1 / ( DEG2RAD * earth_radius_in_meters )
28 
29 #define EARTH_RADIUS_F 6366707.01949371f // = earth_radius_in_meters
30 #define INV_EARTH_RADIUS_F 1.5706706731410E-07f // = 1 / earth_radius_in_meters
31 
32 #if 0
33 typedef ixVector2 ixVector2;
34 typedef ixVector3 ixVector3;
35 typedef ixVector4 ixVector4;
36 typedef ixVector3 ixEuler; // phi, theta, psi (roll, pitch, yaw)
37 typedef ixVector4 ixQuat; // w, x, y, z
38 typedef ixMatrix2 ixMatrix2;
39 typedef ixMatrix3 ixMatrix3;
40 typedef ixMatrix4 ixMatrix4;
41 #else
42 
43 #endif
44 
45 
46 #if (!defined (__cplusplus) && (!defined (inline)))
47 # define inline __inline // allow "inline" keyword to work in windows w/ c program
48 #endif
49 
50 
51 //_____ G L O B A L S ______________________________________________________
52 
53 //_____ P R O T O T Y P E S ________________________________________________
54 
55 /*
56  * Coordinate transformation from ECEF coordinates to latitude/longitude/altitude (rad,rad,m)
57  */
58 void ecef2lla(const double *Pe, double *LLA, const int Niter);
59 
60 /*
61  * Coordinate transformation from latitude/longitude/altitude (rad,rad,m) to ECEF coordinates
62  */
63 void lla2ecef(const double *LLA, double *Pe);
64 
65 /*
66  * Find NED (north, east, down) from LLAref to LLA
67  *
68  * lla[0] = latitude (rad)
69  * lla[1] = longitude (rad)
70  * lla[2] = msl altitude (m)
71  */
72 void lla2ned( ixVector3 llaRef, ixVector3 lla, ixVector3 result );
73 void lla2ned_d( double llaRef[3], double lla[3], ixVector3 result ); // double precision
74 
75 /*
76  * Find NED (north, east, down) from LLAref to LLA
77  *
78  * lla[0] = latitude (degrees)
79  * lla[1] = longitude (degrees)
80  * lla[2] = msl altitude (m)
81  */
82 void llaDeg2ned_d(double llaRef[3], double lla[3], ixVector3 result);
83 
84 /*
85  * Find LLA of NED (north, east, down) from LLAref
86  *
87  * lla[0] = latitude (rad)
88  * lla[1] = longitude (rad)
89  * lla[2] = msl altitude (m)
90  */
91 void ned2lla( ixVector3 ned, ixVector3 llaRef, ixVector3 result );
92 void ned2lla_d( ixVector3 ned, double llaRef[3], double result[3] ); // double precision
93 
94 /*
95 * Find LLA of NED (north, east, down) from LLAref (WGS-84 standard)
96 *
97 * lla[0] = latitude (degrees)
98 * lla[1] = longitude (degrees)
99 * lla[2] = msl altitude (m)
100 */
101 void ned2llaDeg_d(ixVector3 ned, double llaRef[3], double result[3]);
102 
103 /*
104  * Find Delta LLA of NED (north, east, down) from LLAref
105  *
106  * lla[0] = latitude (rad)
107  * lla[1] = longitude (rad)
108  * lla[2] = msl altitude (m)
109  */
110 void ned2DeltaLla(ixVector3 ned, ixVector3 llaRef, ixVector3 deltaLLA);
111 void ned2DeltaLla_d(ixVector3 ned, double llaRef[3], double deltaLLA[3]);
112 
113 /*
114 * Find Delta LLA of NED (north, east, down) from LLAref
115 *
116 * lla[0] = latitude (degrees)
117 * lla[1] = longitude (degrees)
118 * lla[2] = msl altitude (m)
119 */
120 void ned2DeltaLlaDeg_d(ixVector3 ned, double llaRef[3], double deltaLLA[3]);
121 
122 // Convert LLA from radians to degrees
123 void lla_Rad2Deg_d(double result[3], double lla[3]);
124 
125 // Convert LLA from degrees to radians
126 void lla_Deg2Rad_d(double result[3], double lla[3]);
127 void lla_Deg2Rad_d2(double result[3], double lat, double lon, double alt);
128 
129 /*
130  * Find msl altitude based on barometric pressure
131  * https://en.wikipedia.org/wiki/Atmospheric_pressure
132  *
133  * baroKPa = (kPa) barometric pressure in kilopascals
134  * return = (m) MSL altitude in meters
135  */
136 f_t baro2msl( f_t pKPa );
137 
138 /*
139  * Find linear distance between lat,lon,alt (rad,rad,m) coordinates.
140  *
141  * return = (m) distance in meters
142  */
143 f_t llaRadDistance( double lla1[3], double lla2[3] );
144 f_t llaDegDistance( double lla1[3], double lla2[3] );
145 
146 /*
147  * Check if lat,lon,alt (deg,deg,m) coordinates are valid.
148  *
149  * return 0 on success, -1 on failure.
150  */
151 int llaDegValid( double lla[3] );
152 
153 /*
154  * IGF-80 gravity model with WGS-84 ellipsoid refinement
155 */
156 float gravity_igf80(double lat, double alt);
157 
158 #ifdef __cplusplus
159 }
160 #endif
161 
162 #endif /* ISEARTH_H_ */
ixVector4 ixQuat
Definition: ISConstants.h:796
void lla_Deg2Rad_d(double result[3], double lla[3])
Definition: ISEarth.c:318
f_t ixVector3[3]
Definition: ISConstants.h:791
float f_t
Definition: ISConstants.h:786
float gravity_igf80(double lat, double alt)
Definition: ISEarth.c:352
f_t llaRadDistance(double lla1[3], double lla2[3])
Definition: ISEarth.c:265
void lla_Deg2Rad_d2(double result[3], double lat, double lon, double alt)
Definition: ISEarth.c:325
f_t ixMatrix4[16]
Definition: ISConstants.h:800
void lla2ned_d(double llaRef[3], double lla[3], ixVector3 result)
Definition: ISEarth.c:147
f_t ixVector2[2]
Definition: ISConstants.h:789
void llaDeg2ned_d(double llaRef[3], double lla[3], ixVector3 result)
Definition: ISEarth.c:170
void lla2ecef(const double *LLA, double *Pe)
Definition: ISEarth.c:91
void ned2DeltaLla(ixVector3 ned, ixVector3 llaRef, ixVector3 deltaLLA)
Definition: ISEarth.c:288
f_t ixMatrix2[4]
Definition: ISConstants.h:798
void ned2lla(ixVector3 ned, ixVector3 llaRef, ixVector3 result)
Definition: ISEarth.c:194
void lla_Rad2Deg_d(double result[3], double lla[3])
Definition: ISEarth.c:310
ixVector3 ixEuler
Definition: ISConstants.h:797
f_t ixMatrix3[9]
Definition: ISConstants.h:799
void ned2DeltaLlaDeg_d(ixVector3 ned, double llaRef[3], double deltaLLA[3])
Definition: ISEarth.c:302
void ned2DeltaLla_d(ixVector3 ned, double llaRef[3], double deltaLLA[3])
Definition: ISEarth.c:295
void ned2lla_d(ixVector3 ned, double llaRef[3], double result[3])
Definition: ISEarth.c:213
void ecef2lla(const double *Pe, double *LLA, const int Niter)
Definition: ISEarth.c:54
f_t baro2msl(f_t pKPa)
Definition: ISEarth.c:251
void ned2llaDeg_d(ixVector3 ned, double llaRef[3], double result[3])
Definition: ISEarth.c:232
f_t ixVector4[4]
Definition: ISConstants.h:793
void lla2ned(ixVector3 llaRef, ixVector3 lla, ixVector3 result)
Definition: ISEarth.c:123
int llaDegValid(double lla[3])
Definition: ISEarth.c:337
f_t llaDegDistance(double lla1[3], double lla2[3])
Definition: ISEarth.c:279


inertial_sense_ros
Author(s):
autogenerated on Sun Feb 28 2021 03:17:57