39 #include "generated/airframe.h"
41 #define GPS_FIX_NONE 0x00
42 #define GPS_FIX_2D 0x02
43 #define GPS_FIX_3D 0x03
44 #define GPS_FIX_DGPS 0x04
45 #define GPS_FIX_RTK 0x05
47 #define GPS_VALID_POS_ECEF_BIT 0
48 #define GPS_VALID_POS_LLA_BIT 1
49 #define GPS_VALID_POS_UTM_BIT 2
50 #define GPS_VALID_VEL_ECEF_BIT 3
51 #define GPS_VALID_VEL_NED_BIT 4
52 #define GPS_VALID_HMSL_BIT 5
53 #define GPS_VALID_COURSE_BIT 6
55 #ifndef GPS_NB_CHANNELS
56 #define GPS_NB_CHANNELS 40
59 #define GPS_MODE_AUTO 0
60 #define GPS_MODE_PRIMARY 1
61 #define GPS_MODE_SECONDARY 2
63 #ifndef MULTI_GPS_MODE
64 #define MULTI_GPS_MODE GPS_MODE_AUTO
68 #define __GpsId(_x) _x ## _ID
69 #define _GpsId(_x) __GpsId(_x)
70 #define GpsId(_x) _GpsId(_x)
155 #ifdef GPS_SECONDARY_TYPE_H
156 #include GPS_SECONDARY_TYPE_H
176 #define GpsFixValid() gps_fix_valid()
178 #define GpsIsLost() !GpsFixValid()
185 #define GPS_TIMEOUT 2
196 static bool gps_had_valid_fix =
false;
198 gps_had_valid_fix =
true;
200 return gps_had_valid_fix;
int16_t azim
azimuth in deg
uint32_t tow
GPS time of week in ms.
uint8_t qi
quality bitfield (GPS receiver specific)
int32_t hmsl
height above mean sea level (MSL) in mm
struct UtmCoor_f utm_float_from_gps(struct GpsState *gps_s, uint8_t zone)
Convenience function to get utm position in float from GPS structure.
static float gps_time_since_last_3dfix(void)
Returns the time since last 3D fix in seconds (float)
struct NedCoor_f ned_vel_float_from_gps(struct GpsState *gps_s)
Get GPS ned velocity (float) Converted on the fly if not available.
int8_t elev
elevation in deg
struct LlaCoor_i lla_pos
position in LLA (lat,lon: deg*1e7; alt: mm over ellipsoid)
uint32_t sacc
speed accuracy in cm/s
struct UtmCoor_i utm_pos
position in UTM (north,east: cm; alt: mm over MSL)
uint32_t cacc
course accuracy in rad*1e7
int32_t course
GPS course over ground in rad*1e7, [0, 2*Pi]*1e7 (CW/north)
int32_t t0_tow_frac
fractional ns remainder of tow [ms], range -500000 .. 500000
uint8_t cno
Carrier to Noise Ratio (Signal Strength) in dbHz.
struct EcefCoor_f ecef_vel_float_from_gps(struct GpsState *gps_s)
Get GPS ecef velocity (float) Converted on the fly if not available.
struct EcefCoor_i ecef_pos
position in ECEF in cm
struct GpsTimeSync gps_time_sync
struct UtmCoor_i utm_int_from_gps(struct GpsState *gps_s, uint8_t zone)
Convenience function to get utm position in int from GPS structure.
uint32_t hacc
horizontal accuracy in cm
uint16_t gps_week_number(uint16_t year, uint8_t month, uint8_t day)
Number of weeks since navigation epoch (6 January 1980)
void gps_parse_GPS_INJECT(uint8_t *buf)
uint32_t last_3dfix_ticks
cpu time ticks at last valid 3D fix
struct GpsState gps
global GPS state
struct LlaCoor_i lla_int_from_gps(struct GpsState *gps_s)
Get GPS lla (integer) Converted on the fly if not available.
struct EcefCoor_i ecef_vel_int_from_gps(struct GpsState *gps_s)
Get GPS ecef velocity (integer) Converted on the fly if not available.
struct EcefCoor_i ecef_vel
speed ECEF in cm/s
uint32_t t0_ticks
hw clock ticks when GPS message is received
struct EcefCoor_f ecef_float_from_gps(struct GpsState *gps_s)
Get GPS ecef pos (float) Converted on the fly if not available.
void gps_parse_RTCM_INJECT(uint8_t *buf)
uint16_t pdop
position dilution of precision scaled by 100
struct NedCoor_i ned_vel
speed NED in cm/s
uint32_t last_msg_time
cpu time in sec at last received GPS message
uint32_t t0_tow
GPS time of week in ms from last message.
void gps_inject_data(uint8_t packet_id, uint8_t length, uint8_t *data)
GPS packet injection (default empty)
uint8_t svid
Satellite ID.
uint8_t nb_channels
Number of scanned satellites.
uint32_t last_3dfix_time
cpu time in sec at last valid 3D fix
uint32_t pacc
position accuracy in cm
struct EcefCoor_i ecef_int_from_gps(struct GpsState *gps_s)
Get GPS ecef pos (integer) Converted on the fly if not available.
uint16_t gspeed
norm of 2d ground speed in cm/s
uint8_t valid_fields
bitfield indicating valid fields (GPS_VALID_x_BIT)
uint8_t comp_id
id of current gps
struct NedCoor_i ned_vel_int_from_gps(struct GpsState *gps_s)
Get GPS ned velocity (integer) Converted on the fly if not available.
struct LlaCoor_f lla_float_from_gps(struct GpsState *gps_s)
Get GPS lla (float) Converted on the fly if not available.
uint32_t vacc
vertical accuracy in cm
void gps_init(void)
initialize the global GPS state
uint16_t speed_3d
norm of 3d speed in cm/s
uint32_t gps_tow_from_sys_ticks(uint32_t sys_ticks)
Convert time in sys_time ticks to GPS time of week.
uint16_t gps_day_number(uint16_t year, uint8_t month, uint8_t day)
Number of days since navigation epoch (6 January 1980)
bool gps_fix_valid(void)
Check if GPS fix is valid.
struct SVinfo svinfos[GPS_NB_CHANNELS]
holds information from the Space Vehicles (Satellites)
static bool gps_has_been_good(void)
void gps_periodic_check(struct GpsState *gps_s)
Periodic GPS check.
uint8_t flags
bitfield with GPS receiver specific flags
uint16_t reset
hotstart, warmstart, coldstart
uint32_t last_msg_ticks
cpu time ticks at last received GPS message
struct GpsRelposNED gps_relposned
uint8_t num_sv
number of sat in fix
data structures for GPS with RTK capabilities
data structure for GPS information
data structure for GPS time sync
data structure for Space Vehicle Information of a single satellite
uint8_t zone
UTM zone number.
vector in EarthCenteredEarthFixed coordinates
vector in Latitude, Longitude and Altitude
vector in North East Down coordinates
position in UTM coordinates
Paparazzi floating point math for geodetic calculations.
uint8_t zone
UTM zone number.
vector in EarthCenteredEarthFixed coordinates
vector in Latitude, Longitude and Altitude
vector in North East Down coordinates Units: meters
position in UTM coordinates Units: meters
Paparazzi fixed point math for geodetic calculations.
Architecture independent timing functions.
uint32_t cpu_ticks_per_sec
cpu ticks per second
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
int int32_t
Typedef defining 32 bit int type.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
short int16_t
Typedef defining 16 bit short type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
signed char int8_t
Typedef defining 8 bit char type.