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
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 Freek van Tienen
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
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  */
30 #include "subsystems/gps.h"
32 bool_t gps_available;
35 void gps_impl_init(void) {
38  gps.gspeed = 700; // To enable course setting
39  gps.cacc = 0; // To enable course setting
40 }
43 void parse_gps_datalink(uint8_t numsv, int32_t ecef_x, int32_t ecef_y, int32_t ecef_z, int32_t lat, int32_t lon, int32_t alt,
44  int32_t hmsl, int32_t ecef_xd, int32_t ecef_yd, int32_t ecef_zd, uint32_t tow, int32_t course) {
46 = lat;
47  gps.lla_pos.lon = lon;
48  gps.lla_pos.alt = alt;
49  gps.hmsl = hmsl;
51  gps.ecef_pos.x = ecef_x;
52  gps.ecef_pos.y = ecef_y;
53  gps.ecef_pos.z = ecef_z;
55  gps.ecef_vel.x = ecef_xd;
56  gps.ecef_vel.y = ecef_yd;
57  gps.ecef_vel.z = ecef_zd;
59  gps.course = course;
60  gps.num_sv = numsv;
61  gps.tow = tow;
62  gps.fix = GPS_FIX_3D;
66  // Computes from (lat, long) in the referenced UTM zone
67  struct LlaCoor_f lla_f;
69  struct UtmCoor_f utm_f;
70 = nav_utm_zone0;
71  // convert to utm
72  utm_of_lla_f(&utm_f, &lla_f);
73  // copy results of utm conversion
74  gps.utm_pos.east = utm_f.east*100;
75  gps.utm_pos.north = utm_f.north*100;
78 #endif
79 }
int32_t y
in centimeters
struct LlaCoor_i lla_pos
position in LLA (lat,lon: deg*1e7; alt: mm over ellipsoid)
Definition: gps.h:65
int32_t lat
in degrees*1e7
struct EcefCoor_i ecef_vel
speed ECEF in cm/s
Definition: gps.h:68
int32_t course
GPS course over ground in rad*1e7, [0, 2*Pi]*1e7 (CW/north)
Definition: gps.h:72
uint8_t zone
UTM zone number.
uint32_t cacc
course accuracy in rad*1e7
Definition: gps.h:75
uint8_t nav_utm_zone0
Definition: common_nav.c:44
int32_t hmsl
height above mean sea level in mm
Definition: gps.h:67
uint8_t fix
status of fix
Definition: gps.h:78
#define GPS_FIX_3D
Definition: gps.h:43
int32_t z
in centimeters
struct EcefCoor_i ecef_pos
position in ECEF in cm
Definition: gps.h:64
vector in Latitude, Longitude and Altitude
#define FALSE
Definition: imu_chimu.h:141
int32_t alt
in millimeters above WGS84 reference ellipsoid
uint32_t tow
GPS time of week in ms.
Definition: gps.h:80
uint8_t zone
UTM zone number.
int16_t gspeed
norm of 2d ground speed in cm/s
Definition: gps.h:70
float north
in meters
#define GPS_FIX_NONE
Definition: gps.h:41
Device independent GPS code (interface)
position in UTM coordinates Units: meters
unsigned long uint32_t
Definition: types.h:18
int32_t alt
in millimeters above WGS84 reference ellipsoid
int32_t north
in centimeters
int32_t x
in centimeters
signed long int32_t
Definition: types.h:19
#define TRUE
Definition: imu_chimu.h:144
int32_t east
in centimeters
unsigned char uint8_t
Definition: types.h:14
int32_t lon
in degrees*1e7
#define LLA_FLOAT_OF_BFP(_o, _i)
struct UtmCoor_i utm_pos
position in UTM (north,east: cm; alt: mm over ellipsoid)
Definition: gps.h:66
float east
in meters
struct GpsState gps
global GPS state
Definition: gps.c:41
void utm_of_lla_f(struct UtmCoor_f *utm, struct LlaCoor_f *lla)
uint8_t num_sv
number of sat in fix
Definition: gps.h:77