Paparazzi UAS
v5.14.0_stable-0-g3f680d1
Paparazzi is a free software Unmanned Aircraft System.
|
Device independent GPS code (interface) More...
#include "std.h"
#include "math/pprz_geodetic_int.h"
#include "math/pprz_geodetic_float.h"
#include "mcu_periph/sys_time.h"
Go to the source code of this file.
Data Structures | |
struct | SVinfo |
data structure for Space Vehicle Information of a single satellite More... | |
struct | GpsState |
data structure for GPS information More... | |
struct | GpsTimeSync |
data structure for GPS time sync More... | |
struct | GpsRelposNED |
data structures for GPS with RTK capabilities More... | |
struct | RtcmMan |
Macros | |
#define | GPS_FIX_NONE 0x00 |
No GPS fix. More... | |
#define | GPS_FIX_2D 0x02 |
2D GPS fix More... | |
#define | GPS_FIX_3D 0x03 |
3D GPS fix More... | |
#define | GPS_FIX_DGPS 0x04 |
DGPS fix. More... | |
#define | GPS_FIX_RTK 0x05 |
RTK GPS fix. More... | |
#define | GpsFixValid() (gps.fix >= GPS_FIX_3D) |
#define | GpsIsLost() !GpsFixValid() |
#define | GPS_VALID_POS_ECEF_BIT 0 |
#define | GPS_VALID_POS_LLA_BIT 1 |
#define | GPS_VALID_POS_UTM_BIT 2 |
#define | GPS_VALID_VEL_ECEF_BIT 3 |
#define | GPS_VALID_VEL_NED_BIT 4 |
#define | GPS_VALID_HMSL_BIT 5 |
#define | GPS_VALID_COURSE_BIT 6 |
#define | GPS_NB_CHANNELS 16 |
#define | GPS_MODE_AUTO 0 |
#define | GPS_MODE_PRIMARY 1 |
#define | GPS_MODE_SECONDARY 2 |
#define | MULTI_GPS_MODE GPS_MODE_AUTO |
#define | GPS_TIMEOUT 2 |
GPS timeout in seconds. More... | |
Functions | |
void | gps_init (void) |
initialize the global GPS state More... | |
void | gps_inject_data (uint8_t packet_id, uint8_t length, uint8_t *data) |
GPS packet injection (default empty) More... | |
static bool | gps_has_been_good (void) |
void | gps_periodic_check (struct GpsState *gps_s) |
Periodic GPS check. More... | |
uint32_t | gps_tow_from_sys_ticks (uint32_t sys_ticks) |
Convert time in sys_time ticks to GPS time of week. More... | |
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. More... | |
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. More... | |
Variables | |
uint8_t | multi_gps_mode |
struct GpsState | gps |
global GPS state More... | |
struct GpsTimeSync | gps_time_sync |
Device independent GPS code (interface)
Definition in file gps.h.
struct SVinfo |
data structure for Space Vehicle Information of a single satellite
Data Fields | ||
---|---|---|
int16_t | azim | azimuth in deg |
uint8_t | cno | Carrier to Noise Ratio (Signal Strength) in dbHz. |
int8_t | elev | elevation in deg |
uint8_t | flags | bitfield with GPS receiver specific flags |
uint8_t | qi | quality bitfield (GPS receiver specific) |
uint8_t | svid | Satellite ID. |
struct GpsState |
Data Fields | ||
---|---|---|
uint32_t | cacc | course accuracy in rad*1e7 |
uint8_t | comp_id | id of current gps |
int32_t | course | GPS course over ground in rad*1e7, [0, 2*Pi]*1e7 (CW/north) |
struct EcefCoor_i | ecef_pos | position in ECEF in cm |
struct EcefCoor_i | ecef_vel | speed ECEF in cm/s |
uint8_t | fix | status of fix |
uint16_t | gspeed | norm of 2d ground speed in cm/s |
int32_t | hmsl | height above mean sea level (MSL) in mm |
uint32_t | last_3dfix_ticks | cpu time ticks at last valid 3D fix |
uint32_t | last_3dfix_time | cpu time in sec at last valid 3D fix |
uint32_t | last_msg_ticks | cpu time ticks at last received GPS message |
uint32_t | last_msg_time | cpu time in sec at last received GPS message |
struct LlaCoor_i | lla_pos | position in LLA (lat,lon: deg*1e7; alt: mm over ellipsoid) |
uint8_t | nb_channels | Number of scanned satellites. |
struct NedCoor_i | ned_vel | speed NED in cm/s |
uint8_t | num_sv | number of sat in fix |
uint32_t | pacc | position accuracy in cm |
uint16_t | pdop | position dilution of precision scaled by 100 |
uint16_t | reset | hotstart, warmstart, coldstart |
uint32_t | sacc | speed accuracy in cm/s |
uint16_t | speed_3d | norm of 3d speed in cm/s |
struct SVinfo | svinfos[GPS_NB_CHANNELS] | holds information from the Space Vehicles (Satellites) |
uint32_t | tow | GPS time of week in ms. |
struct UtmCoor_i | utm_pos | position in UTM (north,east: cm; alt: mm over MSL) |
uint8_t | valid_fields | bitfield indicating valid fields (GPS_VALID_x_BIT) |
uint16_t | week | GPS week. |
struct GpsTimeSync |
struct GpsRelposNED |
struct RtcmMan |
#define GPS_FIX_2D 0x02 |
2D GPS fix
Definition at line 38 of file gps.h.
Referenced by gps_mtk_read_message(), gps_skytraq_read_message(), parse_xsens700_msg(), and sirf_parse_41().
#define GPS_FIX_3D 0x03 |
3D GPS fix
Definition at line 39 of file gps.h.
Referenced by ahrs_dcm_update_gps(), ahrs_fc_update_gps(), ahrs_icq_update_gps(), error_output(), get_fix_mode(), gps_cb(), gps_feed_value(), gps_mtk_msg(), gps_mtk_read_message(), gps_piksi_publish(), gps_sim_hitl_event(), gps_sim_publish(), gps_sirf_msg(), gps_skytraq_msg(), gps_skytraq_read_message(), gps_ubx_msg(), gps_ubx_read_message(), gps_udp_parse(), handle_ins_msg(), ins_alt_float_update_gps(), ins_float_invariant_update_gps(), ins_int_update_gps(), ins_reset_local_origin(), ins_vectornav_propagate(), intermcu_parse_msg(), nmea_gps_msg(), parse_gps_datalink(), parse_gps_datalink_local(), parse_gps_datalink_small(), parse_xsens700_msg(), parse_xsens_msg(), sbp_pos_ecef_callback(), send_gps_dw1000_small(), send_svinfo_available(), sirf_parse_2(), and sirf_parse_41().
#define GPS_FIX_DGPS 0x04 |
#define GPS_FIX_NONE 0x00 |
No GPS fix.
Definition at line 37 of file gps.h.
Referenced by dw1000_arduino_init(), get_fix_mode(), gps_datalink_init(), gps_feed_value(), gps_init(), gps_mtk_read_message(), gps_periodic_check(), gps_piksi_event(), gps_sim_hitl_init(), gps_sim_init(), gps_skytraq_read_message(), gps_udp_init(), ins_vectornav_monitor(), intermcu_init(), parse_xsens700_msg(), parse_xsens_msg(), and sirf_parse_41().
#define GPS_FIX_RTK 0x05 |
#define GPS_NB_CHANNELS 16 |
Definition at line 57 of file gps.h.
Referenced by gps_ubx_read_message(), mavlink_send_gps_status(), parse_xsens700_msg(), parse_xsens_msg(), send_svinfo_available(), and send_svinfo_id().
#define GPS_TIMEOUT 2 |
#define GPS_VALID_COURSE_BIT 6 |
Definition at line 54 of file gps.h.
Referenced by gps_feed_value(), gps_mtk_read_message(), gps_skytraq_read_message(), gps_ubx_read_message(), handle_ins_msg(), ins_vectornav_propagate(), intermcu_parse_msg(), nmea_parse_RMC(), parse_gps_datalink(), parse_gps_datalink_local(), parse_gps_datalink_small(), sbp_vel_ned_callback(), sim_use_gps_pos(), and sirf_parse_41().
#define GPS_VALID_HMSL_BIT 5 |
Definition at line 53 of file gps.h.
Referenced by gps_feed_value(), gps_mtk_read_message(), gps_skytraq_read_message(), gps_ubx_read_message(), gps_udp_parse(), ins_vectornav_propagate(), intermcu_parse_msg(), nmea_parse_GGA(), parse_gps_datalink(), parse_gps_datalink_local(), parse_gps_datalink_small(), parse_xsens700_msg(), parse_xsens_msg(), sbp_pos_llh_callback(), send_gps_dw1000_small(), sim_use_gps_pos(), sirf_parse_41(), update_geoid_height(), utm_float_from_gps(), and utm_int_from_gps().
#define GPS_VALID_POS_ECEF_BIT 0 |
Definition at line 48 of file gps.h.
Referenced by gps_feed_value(), gps_skytraq_read_message(), gps_ubx_read_message(), gps_udp_parse(), ins_module_update_gps(), ins_vectornav_propagate(), intermcu_parse_msg(), nmea_parse_GGA(), parse_gps_datalink(), parse_gps_datalink_local(), parse_gps_datalink_small(), sbp_pos_ecef_callback(), send_gps_dw1000_small(), and sirf_parse_2().
#define GPS_VALID_POS_LLA_BIT 1 |
Definition at line 49 of file gps.h.
Referenced by gps_feed_value(), gps_mtk_read_message(), gps_skytraq_read_message(), gps_ubx_read_message(), gps_udp_parse(), ins_vectornav_propagate(), nmea_parse_GGA(), parse_gps_datalink(), parse_gps_datalink_local(), parse_gps_datalink_small(), parse_xsens_msg(), sbp_pos_llh_callback(), send_gps_dw1000_small(), sim_use_gps_pos(), sirf_parse_41(), update_geoid_height(), utm_float_from_gps(), and utm_int_from_gps().
#define GPS_VALID_POS_UTM_BIT 2 |
Definition at line 50 of file gps.h.
Referenced by gps_ubx_read_message(), ins_reset_utm_zone(), sim_use_gps_pos(), utm_float_from_gps(), and utm_int_from_gps().
#define GPS_VALID_VEL_ECEF_BIT 3 |
Definition at line 51 of file gps.h.
Referenced by gps_feed_value(), gps_skytraq_read_message(), gps_ubx_read_message(), gps_udp_parse(), ins_module_update_gps(), intermcu_parse_msg(), parse_gps_datalink(), parse_gps_datalink_local(), parse_gps_datalink_small(), sbp_vel_ecef_callback(), and sirf_parse_2().
#define GPS_VALID_VEL_NED_BIT 4 |
Definition at line 52 of file gps.h.
Referenced by gps_feed_value(), gps_skytraq_read_message(), gps_ubx_msg(), gps_ubx_read_message(), ins_module_update_gps(), parse_gps_datalink(), parse_gps_datalink_local(), parse_gps_datalink_small(), parse_xsens700_msg(), parse_xsens_msg(), sbp_vel_ned_callback(), and sim_use_gps_pos().
#define GpsFixValid | ( | ) | (gps.fix >= GPS_FIX_3D) |
Definition at line 43 of file gps.h.
Referenced by ahrs_chimu_update_gps(), alt_filter_periodic(), geo_mag_periodic(), gps_has_been_good(), ins_reset_altitude_ref(), and ins_reset_local_origin().
#define GpsIsLost | ( | ) | !GpsFixValid() |
Definition at line 45 of file gps.h.
Referenced by autopilot_static_on_rc_frame(), and failsafe_check().
#define MULTI_GPS_MODE GPS_MODE_AUTO |
Definition at line 65 of file gps.h.
Referenced by gps_init().
|
inlinestatic |
Definition at line 171 of file gps.h.
References GpsFixValid.
void gps_init | ( | void | ) |
initialize the global GPS state
Definition at line 315 of file gps.c.
References ABI_BROADCAST, GpsState::cacc, RtcmMan::Cnt105, RtcmMan::Cnt177, RtcmMan::Cnt187, RtcmMan::Crc105, RtcmMan::Crc177, RtcmMan::Crc187, DefaultPeriodic, GpsState::fix, gpio_setup_output(), gps, gps_cb(), GPS_FIX_NONE, GPS_POWER_GPIO, GpsState::last_3dfix_ticks, GpsState::last_3dfix_time, GpsState::last_msg_ticks, GpsState::last_msg_time, LED_OFF, MULTI_GPS_MODE, register_periodic_telemetry(), rtcm_man, send_gps(), send_gps_int(), send_gps_lla(), send_gps_rtk(), send_gps_rxmrtcm(), send_gps_sol(), send_svinfo(), GpsState::tow, GpsState::valid_fields, and GpsState::week.
GPS packet injection (default empty)
GPS packet injection (default empty)
Definition at line 408 of file gps_piksi.c.
References gps_piksi_write(), and sbp_state.
Referenced by dl_parse_msg().
void gps_periodic_check | ( | struct GpsState * | gps_s | ) |
Periodic GPS check.
Marks GPS as lost when no GPS message was received for GPS_TIMEOUT seconds
Definition at line 270 of file gps.c.
References GpsState::comp_id, GpsState::fix, gps, GPS_FIX_NONE, GPS_TIMEOUT, GpsState::last_msg_time, and sys_time::nb_sec.
Referenced by dw1000_arduino_periodic(), and intermcu_periodic().
Convert time in sys_time ticks to GPS time of week.
The resolution is sys_time.resolution
Definition at line 360 of file gps.c.
References gps_time_sync, msec_of_sys_time_ticks(), MSEC_PER_WEEK, GpsTimeSync::t0_ticks, and GpsTimeSync::t0_tow.
Referenced by acInfoSetPositionEnu_f(), acInfoSetPositionEnu_i(), acInfoSetPositionLla_f(), acInfoSetPositionLla_i(), acInfoSetPositionUtm_f(), acInfoSetPositionUtm_i(), acInfoSetVelocityEnu_f(), acInfoSetVelocityEnu_i(), parse_acinfo_dl(), trigger_ext_periodic(), and windturbine_periodic().
Convenience function to get utm position in float from GPS structure.
Beware that altitude is initialized to zero but not set to the correct value
[in] | gps_s | pointer to the gps structure |
[in] | zone | set the utm zone in which the position should be computed, 0 to try to get it automatically from lla position |
Convenience function to get utm position in float from GPS structure.
Definition at line 393 of file gps.c.
References UtmCoor_f::alt, UtmCoor_f::east, GPS_VALID_HMSL_BIT, GPS_VALID_POS_LLA_BIT, GPS_VALID_POS_UTM_BIT, UTM_FLOAT_OF_BFP, utm_of_lla_i(), wgs84_ellipsoid_to_geoid_i(), UtmCoor_f::zone, and UtmCoor_i::zone.
Referenced by gps_cb(), ins_alt_float_update_gps(), ins_float_invariant_update_gps(), and ins_reset_local_origin().
Convenience function to get utm position in int from GPS structure.
Beware that altitude is initialized to zero but not set to the correct value
[in] | gps_s | pointer to the gps structure |
[in] | zone | set the utm zone in which the position should be computed, 0 to try to get it automatically from lla position |
Definition at line 419 of file gps.c.
References UtmCoor_i::alt, UtmCoor_i::east, GPS_VALID_HMSL_BIT, GPS_VALID_POS_LLA_BIT, GPS_VALID_POS_UTM_BIT, UTM_COPY, utm_of_lla_i(), wgs84_ellipsoid_to_geoid_i(), and UtmCoor_i::zone.
Referenced by send_gps().
struct GpsState gps |
global GPS state
Definition at line 75 of file gps.c.
Referenced by airspeed_ets_read_event(), alt_filter_periodic(), apogee_baro_event(), ArduIMU_periodicGPS(), baro_sim_periodic(), dc_send_shot_position(), error_output(), formation_flight(), generic_com_periodic(), geo_mag_event(), get_fix_mode(), gps_cb(), gps_init(), gps_periodic_check(), gps_sim_hitl_event(), gps_sim_hitl_init(), gps_sim_init(), gps_sim_publish(), gps_vectornav_init(), gsm_send_report_continue(), gx3_packet_read_message(), hff_update_gps(), humid_sht_periodic(), ins_reset_altitude_ref(), ins_reset_local_origin(), ins_reset_utm_zone(), ins_vectornav_monitor(), ins_vectornav_propagate(), ins_vectornav_set_pacc(), ins_vectornav_set_sacc(), mavlink_send_gps_raw_int(), mavlink_send_gps_status(), meteo_stick_periodic(), mf_daq_send_report(), mf_ptu_periodic(), parse_xsens_msg(), potential_task(), push_gps_to_vision(), send_fp_min(), send_gps(), send_gps_int(), send_gps_lla(), send_gps_sol(), send_status(), send_svinfo(), send_svinfo_available(), send_svinfo_id(), sim_use_gps_pos(), snav_on_time(), tcas_periodic_task_1Hz(), temod_event(), thd_startlog(), and update_geoid_height().
struct GpsTimeSync gps_time_sync |
Definition at line 77 of file gps.c.
Referenced by gps_cb(), and gps_tow_from_sys_ticks().