Paparazzi UAS  v4.0.4_stable-3-gf39211a
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
pprz_geodetic_int.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2011 The Paparazzi Team
3  *
4  * This file is part of paparazzi.
5  *
6  * paparazzi is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * paparazzi is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with paparazzi; see the file COPYING. If not, see
18  * <http://www.gnu.org/licenses/>.
19  *
20  */
21 
30 #ifndef PPRZ_GEODETIC_INT_H
31 #define PPRZ_GEODETIC_INT_H
32 
33 #include "pprz_geodetic.h"
34 
35 #include "std.h"
36 #include "pprz_algebra_int.h"
37 
38 
45 struct EcefCoor_i {
49 };
50 
56 struct LlaCoor_i {
60 };
61 
65 struct NedCoor_i {
69 };
70 
74 struct EnuCoor_i {
78 };
79 
83 struct UtmCoor_i {
88 };
89 
95 struct LtpDef_i {
96  struct EcefCoor_i ecef;
97  struct LlaCoor_i lla;
100 };
101 
102 extern void ltp_def_from_ecef_i(struct LtpDef_i* def, struct EcefCoor_i* ecef);
103 extern void ltp_def_from_lla_i(struct LtpDef_i* def, struct LlaCoor_i* lla);
104 extern void lla_of_ecef_i(struct LlaCoor_i* out, struct EcefCoor_i* in);
105 extern void ecef_of_lla_i(struct EcefCoor_i* out, struct LlaCoor_i* in);
106 extern void enu_of_ecef_point_i(struct EnuCoor_i* enu, struct LtpDef_i* def, struct EcefCoor_i* ecef);
107 extern void ned_of_ecef_point_i(struct NedCoor_i* ned, struct LtpDef_i* def, struct EcefCoor_i* ecef);
108 extern void enu_of_ecef_vect_i(struct EnuCoor_i* enu, struct LtpDef_i* def, struct EcefCoor_i* ecef);
109 extern void ned_of_ecef_vect_i(struct NedCoor_i* ned, struct LtpDef_i* def, struct EcefCoor_i* ecef);
110 extern void enu_of_lla_point_i(struct EnuCoor_i* enu, struct LtpDef_i* def, struct LlaCoor_i* lla);
111 extern void ned_of_lla_point_i(struct NedCoor_i* ned, struct LtpDef_i* def, struct LlaCoor_i* lla);
112 extern void enu_of_lla_vect_i(struct EnuCoor_i* enu, struct LtpDef_i* def, struct LlaCoor_i* lla);
113 extern void ned_of_lla_vect_i(struct NedCoor_i* ned, struct LtpDef_i* def, struct LlaCoor_i* lla);
114 extern void ecef_of_enu_point_i(struct EcefCoor_i* ecef, struct LtpDef_i* def, struct EnuCoor_i* enu);
115 extern void ecef_of_ned_point_i(struct EcefCoor_i* ecef, struct LtpDef_i* def, struct NedCoor_i* ned);
116 extern void ecef_of_enu_vect_i(struct EcefCoor_i* ecef, struct LtpDef_i* def, struct EnuCoor_i* enu);
117 extern void ecef_of_ned_vect_i(struct EcefCoor_i* ecef, struct LtpDef_i* def, struct NedCoor_i* ned);
118 
119 #define CM_OF_M(_m) ((_m)*1e2)
120 #define M_OF_CM(_cm) ((_cm)/1e2)
121 #define MM_OF_M(_m) ((_m)*1e3)
122 #define M_OF_MM(_mm) ((_mm)/1e3)
123 #define EM7RAD_OF_RAD(_r) ((_r)*1e7)
124 #define RAD_OF_EM7RAD(_r) ((_r)/1e7)
125 
126 #define INT32_VECT3_ENU_OF_NED(_o, _i) { \
127  (_o).x = (_i).y; \
128  (_o).y = (_i).x; \
129  (_o).z = -(_i).z; \
130  }
131 
132 #define INT32_VECT3_NED_OF_ENU(_o, _i) INT32_VECT3_ENU_OF_NED(_o,_i)
133 
134 #define ECEF_BFP_OF_REAL(_o, _i) { \
135  (_o).x = (int32_t)CM_OF_M((_i).x); \
136  (_o).y = (int32_t)CM_OF_M((_i).y); \
137  (_o).z = (int32_t)CM_OF_M((_i).z); \
138  }
139 
140 #define ECEF_FLOAT_OF_BFP(_o, _i) { \
141  (_o).x = (float)M_OF_CM((_i).x); \
142  (_o).y = (float)M_OF_CM((_i).y); \
143  (_o).z = (float)M_OF_CM((_i).z); \
144  }
145 
146 #define LLA_BFP_OF_REAL(_o, _i) { \
147  (_o).lat = (int32_t)EM7RAD_OF_RAD((_i).lat); \
148  (_o).lon = (int32_t)EM7RAD_OF_RAD((_i).lon); \
149  (_o).alt = (int32_t)MM_OF_M((_i).alt); \
150  }
151 
152 #define LLA_FLOAT_OF_BFP(_o, _i) { \
153  (_o).lat = (float)RAD_OF_EM7RAD((_i).lat); \
154  (_o).lon = (float)RAD_OF_EM7RAD((_i).lon); \
155  (_o).alt = (float)M_OF_MM((_i).alt); \
156  }
157 
158 #define NED_BFP_OF_REAL(_o, _i) { \
159  (_o).x = POS_BFP_OF_REAL((_i).x); \
160  (_o).y = POS_BFP_OF_REAL((_i).y); \
161  (_o).z = POS_BFP_OF_REAL((_i).z); \
162  }
163 
164 #define ENU_BFP_OF_REAL(_o, _i) NED_BFP_OF_REAL(_o, _i)
165 
166 #define NED_FLOAT_OF_BFP(_o, _i) { \
167  (_o).x = POS_FLOAT_OF_BFP((_i).x); \
168  (_o).y = POS_FLOAT_OF_BFP((_i).y); \
169  (_o).z = POS_FLOAT_OF_BFP((_i).z); \
170  }
171 
172 #define ENU_FLOAT_OF_BFP(_o, _i) NED_FLOAT_OF_BFP(_o, _i)
173 
174 #define INT32_VECT2_ENU_OF_NED(_o, _i) { \
175  (_o).x = (_i).y; \
176  (_o).y = (_i).x; \
177  }
178 
179 #define INT32_VECT2_NED_OF_ENU(_o, _i) INT32_VECT2_ENU_OF_NED(_o,_i)
180 
181 #endif /* PPRZ_GEODETIC_INT_H */
int32_t y
in centimeters
int32_t lat
in radians*1e7
void enu_of_ecef_point_i(struct EnuCoor_i *enu, struct LtpDef_i *def, struct EcefCoor_i *ecef)
struct Int32Mat33 ltp_of_ecef
Rotation matrix.
vector in EarthCenteredEarthFixed coordinates
uint8_t zone
UTM zone number.
void enu_of_ecef_vect_i(struct EnuCoor_i *enu, struct LtpDef_i *def, struct EcefCoor_i *ecef)
void ned_of_ecef_point_i(struct NedCoor_i *ned, struct LtpDef_i *def, struct EcefCoor_i *ecef)
struct LlaCoor_i lla
Reference point in lla.
vector in Latitude, Longitude and Altitude
void lla_of_ecef_i(struct LlaCoor_i *out, struct EcefCoor_i *in)
int32_t z
in centimeters
void ltp_def_from_ecef_i(struct LtpDef_i *def, struct EcefCoor_i *ecef)
void enu_of_lla_vect_i(struct EnuCoor_i *enu, struct LtpDef_i *def, struct LlaCoor_i *lla)
int32_t alt
in millimeters above WGS84 reference ellipsoid
vector in North East Down coordinates
void ecef_of_lla_i(struct EcefCoor_i *out, struct LlaCoor_i *in)
definition of the local (flat earth) coordinate system
void ecef_of_ned_vect_i(struct EcefCoor_i *ecef, struct LtpDef_i *def, struct NedCoor_i *ned)
void ned_of_lla_point_i(struct NedCoor_i *ned, struct LtpDef_i *def, struct LlaCoor_i *lla)
void ecef_of_enu_vect_i(struct EcefCoor_i *ecef, struct LtpDef_i *def, struct EnuCoor_i *enu)
int32_t alt
in millimeters above WGS84 reference ellipsoid
void ned_of_lla_vect_i(struct NedCoor_i *ned, struct LtpDef_i *def, struct LlaCoor_i *lla)
int32_t north
in centimeters
int32_t x
in centimeters
position in UTM coordinates
signed long int32_t
Definition: types.h:19
int32_t east
in centimeters
unsigned char uint8_t
Definition: types.h:14
int32_t lon
in radians*1e7
int32_t hmsl
Height above mean sea level in mm.
struct EcefCoor_i ecef
Reference point in ecef.
void ecef_of_enu_point_i(struct EcefCoor_i *ecef, struct LtpDef_i *def, struct EnuCoor_i *enu)
void ecef_of_ned_point_i(struct EcefCoor_i *ecef, struct LtpDef_i *def, struct NedCoor_i *ned)
void ned_of_ecef_vect_i(struct NedCoor_i *ned, struct LtpDef_i *def, struct EcefCoor_i *ecef)
void ltp_def_from_lla_i(struct LtpDef_i *def, struct LlaCoor_i *lla)
void enu_of_lla_point_i(struct EnuCoor_i *enu, struct LtpDef_i *def, struct LlaCoor_i *lla)
vector in East North Up coordinates
Paparazzi fixed point algebra.