Paparazzi UAS  v5.2.2_stable-0-gd6b9f29
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
ins.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2012 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, write to
18  * the Free Software Foundation, 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21 
28 #include "subsystems/ins.h"
29 
30 #if USE_GPS
31 // for ins_reset_utm_zone
32 #include "subsystems/gps.h"
33 #include "state.h"
34 #endif
35 
36 struct Ins ins;
37 
38 
39 #define WEAK __attribute__((weak))
40 // weak functions, used if not explicitly provided by implementation
41 
42 void WEAK ins_periodic(void) {}
43 
45 
47 
48 #if USE_GPS
49 void WEAK ins_reset_utm_zone(struct UtmCoor_f * utm) {
50  struct LlaCoor_f lla0;
51  lla_of_utm_f(&lla0, utm);
52 #ifdef GPS_USE_LATLONG
53  utm->zone = (gps.lla_pos.lon/1e7 + 180) / 6 + 1;
54 #else
55  utm->zone = gps.utm_pos.zone;
56 #endif
57  utm_of_lla_f(utm, &lla0);
58 
60 }
61 #else
62 void WEAK ins_reset_utm_zone(struct UtmCoor_f * utm __attribute__((unused))) {}
63 #endif
64 
65 void WEAK ins_propagate(void) {}
66 
67 void WEAK ins_update_gps(void) {}
68 
struct Ins ins
global INS state
Definition: ins.c:36
struct LlaCoor_i lla_pos
position in LLA (lat,lon: deg*1e7; alt: mm over ellipsoid)
Definition: gps.h:65
void WEAK ins_reset_utm_zone(struct UtmCoor_f *utm)
INS utm zone reset.
Definition: ins.c:49
uint8_t zone
UTM zone number.
Inertial Navigation System state.
Definition: ins.h:46
void WEAK ins_update_gps(void)
Update INS state with GPS measurements.
Definition: ins.c:67
Integrated Navigation System interface.
vector in Latitude, Longitude and Altitude
void WEAK ins_reset_altitude_ref(void)
INS altitude reference reset.
Definition: ins.c:46
uint8_t zone
UTM zone number.
Device independent GPS code (interface)
void lla_of_utm_f(struct LlaCoor_f *lla, struct UtmCoor_f *utm)
position in UTM coordinates Units: meters
#define WEAK
Definition: ins.c:39
void WEAK ins_reset_local_origin(void)
INS local origin reset.
Definition: ins.c:44
API to get/set the generic vehicle states.
int32_t lon
in degrees*1e7
struct UtmCoor_i utm_pos
position in UTM (north,east: cm; alt: mm over ellipsoid)
Definition: gps.h:66
void WEAK ins_propagate(void)
Propagation.
Definition: ins.c:65
static void stateSetLocalUtmOrigin_f(struct UtmCoor_f *utm_def)
Set the local (flat earth) coordinate frame origin from UTM (float).
Definition: state.h:459
struct GpsState gps
global GPS state
Definition: gps.c:41
void WEAK ins_periodic(void)
INS periodic call.
Definition: ins.c:42
void utm_of_lla_f(struct UtmCoor_f *utm, struct LlaCoor_f *lla)