Paparazzi UAS  v5.0.5_stable-7-g4b8bbb7
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
gps_ardrone2.c
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (C) 2013 Freek van Tienen <freek.v.tienen@gmail.com>
4  *
5  * This file is part of paparazzi.
6  *
7  * paparazzi is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2, or (at your option)
10  * any later version.
11  *
12  * paparazzi is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with paparazzi; see the file COPYING. If not, write to
19  * the Free Software Foundation, 59 Temple Place - Suite 330,
20  * Boston, MA 02111-1307, USA.
21  *
22  */
23 
29 #include "subsystems/gps.h"
31 
33 
34 void gps_impl_init( void ) {
36 }
37 
38 void gps_ardrone2_parse(navdata_gps_t *navdata_gps) {
39  int i;
40  // Set the lla double struct from the navdata
41  struct LlaCoor_d gps_lla_d;
42  gps_lla_d.lat = RadOfDeg(navdata_gps->lat);
43  gps_lla_d.lon = RadOfDeg(navdata_gps->lon);
44  gps_lla_d.alt = navdata_gps->elevation;
45 
46  // Convert it to ecef
47  struct EcefCoor_d gps_ecef_d;
48  ecef_of_lla_d(&gps_ecef_d, &gps_lla_d);
49 
50  // Convert the lla and ecef to int and set them in gps
51  ECEF_BFP_OF_REAL(gps.ecef_pos, gps_ecef_d);
52  LLA_BFP_OF_REAL(gps.lla_pos, gps_lla_d);
53 
54  // TODO: parse other stuff
56 
57  for(i = 0; i < GPS_NB_CHANNELS; i++) {
58  gps.svinfos[i].svid = navdata_gps->channels[i].sat;
59  gps.svinfos[i].cno = navdata_gps->channels[i].cn0;
60  }
61 
62  // Check if we have a fix TODO: check if 2D or 3D fix?
63  if (navdata_gps->gps_state == 1)
64  gps.fix = GPS_FIX_3D;
65  else
67 
68  // Set that there is a packet
70 }
struct LlaCoor_i lla_pos
position in LLA (lat,lon: rad*1e7; alt: mm over ellipsoid)
Definition: gps.h:65
double alt
in meters above WGS84 reference ellipsoid
float64_t elevation
Definition: at_com.h:162
#define ECEF_BFP_OF_REAL(_o, _i)
void gps_impl_init(void)
Definition: gps_ardrone2.c:34
uint8_t fix
status of fix
Definition: gps.h:78
#define GPS_FIX_3D
Definition: gps.h:43
float64_t lat
Definition: at_com.h:160
struct EcefCoor_i ecef_pos
position in ECEF in cm
Definition: gps.h:64
#define GPS_NB_CHANNELS
Definition: gps_ardrone2.h:33
#define FALSE
Definition: imu_chimu.h:141
Paparazzi double-precision floating point math for geodetic calculations.
void ecef_of_lla_d(struct EcefCoor_d *ecef, struct LlaCoor_d *lla)
struct _navdata_gps_t::@10 channels[12]
uint8_t sat
Definition: at_com.h:180
vector in EarthCenteredEarthFixed coordinates
#define GPS_FIX_NONE
Definition: gps.h:41
Device independent GPS code (interface)
#define LLA_BFP_OF_REAL(_o, _i)
double lon
in radians
uint32_t gps_state
Definition: at_com.h:170
float64_t lon
Definition: at_com.h:161
bool_t gps_ardrone2_available
Definition: gps_ardrone2.c:32
struct SVinfo svinfos[GPS_NB_CHANNELS]
holds information from the Space Vehicles (Satellites)
Definition: gps.h:83
#define TRUE
Definition: imu_chimu.h:144
void gps_ardrone2_parse(navdata_gps_t *navdata_gps)
Definition: gps_ardrone2.c:38
double lat
in radians
uint8_t svid
Satellite ID.
Definition: gps.h:54
vector in Latitude, Longitude and Altitude
struct GpsState gps
global GPS state
Definition: gps.c:33
uint8_t cn0
Definition: at_com.h:181
uint8_t cno
Carrier to Noise Ratio (Signal Strength) in dbHz.
Definition: gps.h:57
uint8_t nb_channels
Number of scanned satellites.
Definition: gps.h:82