40 #include "generated/airframe.h"
42 #define GPS_FIX_NONE 0x00
43 #define GPS_FIX_2D 0x02
44 #define GPS_FIX_3D 0x03
45 #define GPS_FIX_DGPS 0x04
46 #define GPS_FIX_RTK 0x05
48 #define GPS_VALID_POS_ECEF_BIT 0
49 #define GPS_VALID_POS_LLA_BIT 1
50 #define GPS_VALID_POS_UTM_BIT 2
51 #define GPS_VALID_VEL_ECEF_BIT 3
52 #define GPS_VALID_VEL_NED_BIT 4
53 #define GPS_VALID_HMSL_BIT 5
54 #define GPS_VALID_COURSE_BIT 6
56 #ifndef GPS_NB_CHANNELS
57 #define GPS_NB_CHANNELS 40
60 #define GPS_MODE_AUTO 0
61 #define GPS_MODE_PRIMARY 1
62 #define GPS_MODE_SECONDARY 2
64 #ifndef MULTI_GPS_MODE
65 #define MULTI_GPS_MODE GPS_MODE_AUTO
69 #define __GpsId(_x) _x ## _ID
70 #define _GpsId(_x) __GpsId(_x)
71 #define GpsId(_x) _GpsId(_x)
147 #ifdef GPS_SECONDARY_TYPE_H
148 #include GPS_SECONDARY_TYPE_H
168 #define GpsFixValid() gps_fix_valid()
170 #define GpsIsLost() !GpsFixValid()
177 #define GPS_TIMEOUT 2
188 static bool gps_had_valid_fix =
false;
190 gps_had_valid_fix =
true;
192 return gps_had_valid_fix;
int16_t azim
azimuth in deg
uint32_t tow
GPS time of week in ms.
float distance_acc
Distance accuracy in meters.
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)
float heading
Relative heading to the reference station in radians.
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.
float heading_acc
Heading accuracy in radians.
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)
double distance
Relative distance to the reference station in meters.
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
uint32_t tow
Time of week (GPS) in ms.
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.
struct NedCoor_f pos_acc
Position accuracy in meters.
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
struct NedCoor_d pos
Relative postion to the reference station in meters.
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
uint16_t reference_id
Reference station identification.
uint8_t num_sv
number of sat in fix
data structure for GPS information
data structure for GPS time sync
data structure for Space Vehicle Information of a single satellite
vector in North East Down coordinates Units: meters
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 double-precision floating point math for geodetic calculations.
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.