APM:Libraries
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Attributes | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
AP_GPS Class Reference

#include <AP_GPS.h>

Collaboration diagram for AP_GPS:
[legend]

Classes

struct  detect_state
 
struct  GPS_State
 
struct  GPS_timing
 
struct  rtcm_buffer
 

Public Types

enum  GPS_Type {
  GPS_TYPE_NONE = 0, GPS_TYPE_AUTO = 1, GPS_TYPE_UBLOX = 2, GPS_TYPE_MTK = 3,
  GPS_TYPE_MTK19 = 4, GPS_TYPE_NMEA = 5, GPS_TYPE_SIRF = 6, GPS_TYPE_HIL = 7,
  GPS_TYPE_SBP = 8, GPS_TYPE_UAVCAN = 9, GPS_TYPE_SBF = 10, GPS_TYPE_GSOF = 11,
  GPS_TYPE_ERB = 13, GPS_TYPE_MAV = 14, GPS_TYPE_NOVA = 15
}
 
enum  GPS_Status {
  NO_GPS = GPS_FIX_TYPE_NO_GPS, NO_FIX = GPS_FIX_TYPE_NO_FIX, GPS_OK_FIX_2D = GPS_FIX_TYPE_2D_FIX, GPS_OK_FIX_3D = GPS_FIX_TYPE_3D_FIX,
  GPS_OK_FIX_3D_DGPS = GPS_FIX_TYPE_DGPS, GPS_OK_FIX_3D_RTK_FLOAT = GPS_FIX_TYPE_RTK_FLOAT, GPS_OK_FIX_3D_RTK_FIXED = GPS_FIX_TYPE_RTK_FIXED
}
 GPS status codes. More...
 
enum  GPS_Engine_Setting {
  GPS_ENGINE_NONE = -1, GPS_ENGINE_PORTABLE = 0, GPS_ENGINE_STATIONARY = 2, GPS_ENGINE_PEDESTRIAN = 3,
  GPS_ENGINE_AUTOMOTIVE = 4, GPS_ENGINE_SEA = 5, GPS_ENGINE_AIRBORNE_1G = 6, GPS_ENGINE_AIRBORNE_2G = 7,
  GPS_ENGINE_AIRBORNE_4G = 8
}
 
enum  GPS_Config { GPS_ALL_CONFIGURED = 255 }
 

Public Member Functions

 AP_GPS ()
 
 AP_GPS (const AP_GPS &other)=delete
 
AP_GPSoperator= (const AP_GPS &)=delete
 
void init (const AP_SerialManager &serial_manager)
 Startup initialisation. More...
 
void update (void)
 
void handle_msg (const mavlink_message_t *msg)
 
uint8_t num_sensors (void) const
 
uint8_t primary_sensor (void) const
 
GPS_Status status (uint8_t instance) const
 Query GPS status. More...
 
GPS_Status status (void) const
 
GPS_Status highest_supported_status (uint8_t instance) const
 
const Locationlocation (uint8_t instance) const
 
const Locationlocation () const
 
bool speed_accuracy (uint8_t instance, float &sacc) const
 
bool speed_accuracy (float &sacc) const
 
bool horizontal_accuracy (uint8_t instance, float &hacc) const
 
bool horizontal_accuracy (float &hacc) const
 
bool vertical_accuracy (uint8_t instance, float &vacc) const
 
bool vertical_accuracy (float &vacc) const
 
const Vector3fvelocity (uint8_t instance) const
 
const Vector3fvelocity () const
 
float ground_speed (uint8_t instance) const
 
float ground_speed () const
 
uint32_t ground_speed_cm (void)
 
float ground_course (uint8_t instance) const
 
float ground_course () const
 
int32_t ground_course_cd (uint8_t instance) const
 
int32_t ground_course_cd () const
 
uint8_t num_sats (uint8_t instance) const
 
uint8_t num_sats () const
 
uint32_t time_week_ms (uint8_t instance) const
 
uint32_t time_week_ms () const
 
uint16_t time_week (uint8_t instance) const
 
uint16_t time_week () const
 
uint16_t get_hdop (uint8_t instance) const
 
uint16_t get_hdop () const
 
uint16_t get_vdop (uint8_t instance) const
 
uint16_t get_vdop () const
 
uint32_t last_fix_time_ms (uint8_t instance) const
 
uint32_t last_fix_time_ms (void) const
 
uint32_t last_message_time_ms (uint8_t instance) const
 
uint32_t last_message_time_ms (void) const
 
uint16_t last_message_delta_time_ms (uint8_t instance) const
 
uint16_t last_message_delta_time_ms (void) const
 
bool have_vertical_velocity (uint8_t instance) const
 
bool have_vertical_velocity (void) const
 
uint8_t rtk_num_sats (uint8_t instance) const
 
uint8_t rtk_num_sats (void) const
 
uint32_t rtk_age_ms (uint8_t instance) const
 
uint32_t rtk_age_ms (void) const
 
bool get_lag (uint8_t instance, float &lag_sec) const
 
bool get_lag (float &lag_sec) const
 
const Vector3fget_antenna_offset (uint8_t instance) const
 
void setHIL (uint8_t instance, GPS_Status status, uint64_t time_epoch_ms, const Location &location, const Vector3f &velocity, uint8_t num_sats, uint16_t hdop)
 
void setHIL_Accuracy (uint8_t instance, float vdop, float hacc, float vacc, float sacc, bool _have_vertical_velocity, uint32_t sample_ms)
 
void lock_port (uint8_t instance, bool locked)
 
void send_mavlink_gps_raw (mavlink_channel_t chan)
 
void send_mavlink_gps2_raw (mavlink_channel_t chan)
 
void send_mavlink_gps_rtk (mavlink_channel_t chan, uint8_t inst)
 
uint8_t first_unconfigured_gps (void) const
 
void broadcast_first_configuration_failure_reason (void) const
 
bool all_configured (void) const
 
bool all_consistent (float &distance) const
 
bool blend_health_check () const
 
void send_blob_start (uint8_t instance, const char *_blob, uint16_t size)
 
void send_blob_update (uint8_t instance)
 
uint64_t time_epoch_usec (uint8_t instance) const
 
uint64_t time_epoch_usec (void) const
 
void Write_DataFlash_Log_Startup_messages ()
 
void set_log_gps_bit (uint32_t bit)
 
bool is_healthy (uint8_t instance) const
 
bool is_healthy (void) const
 
bool prepare_for_arming (void)
 

Static Public Member Functions

static AP_GPSgps ()
 
static uint64_t time_epoch_convert (uint16_t gps_week, uint32_t gps_ms)
 

Static Public Attributes

static const struct AP_Param::GroupInfo var_info []
 

Protected Attributes

AP_Int8 _type [GPS_MAX_RECEIVERS]
 
AP_Int8 _navfilter
 
AP_Int8 _auto_switch
 
AP_Int8 _min_dgps
 
AP_Int16 _sbp_logmask
 
AP_Int8 _inject_to
 
uint32_t _last_instance_swap_ms
 
AP_Int8 _sbas_mode
 
AP_Int8 _min_elevation
 
AP_Int8 _raw_data
 
AP_Int8 _gnss_mode [GPS_MAX_RECEIVERS]
 
AP_Int16 _rate_ms [GPS_MAX_RECEIVERS]
 
AP_Int8 _save_config
 
AP_Int8 _auto_config
 
AP_Vector3f _antenna_offset [GPS_MAX_RECEIVERS]
 
AP_Int16 _delay_ms [GPS_MAX_RECEIVERS]
 
AP_Int8 _blend_mask
 
AP_Float _blend_tc
 
uint32_t _log_gps_bit = -1
 

Private Types

enum  GPS_AUTO_CONFIG { GPS_AUTO_CONFIG_DISABLE = 0, GPS_AUTO_CONFIG_ENABLE = 1 }
 

Private Member Functions

uint16_t get_rate_ms (uint8_t instance) const
 
void detect_instance (uint8_t instance)
 
void update_instance (uint8_t instance)
 
void handle_gps_rtcm_data (const mavlink_message_t *msg)
 
void handle_gps_inject (const mavlink_message_t *msg)
 
void inject_data (uint8_t *data, uint16_t len)
 
void inject_data (uint8_t instance, uint8_t *data, uint16_t len)
 
bool calc_blend_weights (void)
 
void calc_blended_state (void)
 
bool should_df_log () const
 

Private Attributes

GPS_timing timing [GPS_MAX_RECEIVERS+1]
 
GPS_State state [GPS_MAX_RECEIVERS+1]
 
AP_GPS_Backenddrivers [GPS_MAX_RECEIVERS]
 
AP_HAL::UARTDriver_port [GPS_MAX_RECEIVERS]
 
uint8_t primary_instance:2
 primary GPS instance More...
 
uint8_t num_instances:2
 number of GPS instances present More...
 
uint8_t locked_ports:2
 
struct AP_GPS::detect_state detect_state [GPS_MAX_RECEIVERS]
 
struct {
   const char *   blob
 
   uint16_t   remaining
 
initblob_state [GPS_MAX_RECEIVERS]
 
struct AP_GPS::rtcm_bufferrtcm_buffer
 
Vector2f _NE_pos_offset_m [GPS_MAX_RECEIVERS]
 
float _hgt_offset_cm [GPS_MAX_RECEIVERS]
 
Vector3f _blended_antenna_offset
 
float _blended_lag_sec = 0.001f * GPS_MAX_RATE_MS
 
float _blend_weights [GPS_MAX_RECEIVERS]
 
uint32_t _last_time_updated [GPS_MAX_RECEIVERS]
 
float _omega_lpf
 
bool _output_is_blended
 
uint8_t _blend_health_counter
 

Static Private Attributes

static AP_GPS_singleton
 
static const uint32_t _baudrates [] = {9600U, 115200U, 4800U, 19200U, 38400U, 57600U, 230400U}
 
static const char _initialisation_blob [] = UBLOX_SET_BINARY MTK_SET_BINARY SIRF_SET_BINARY
 
static const char _initialisation_raw_blob []
 

Friends

class AP_GPS_ERB
 
class AP_GPS_GSOF
 
class AP_GPS_MAV
 
class AP_GPS_MTK
 
class AP_GPS_MTK19
 
class AP_GPS_NMEA
 
class AP_GPS_NOVA
 
class AP_GPS_PX4
 
class AP_GPS_SBF
 
class AP_GPS_SBP
 
class AP_GPS_SBP2
 
class AP_GPS_SIRF
 
class AP_GPS_UBLOX
 
class AP_GPS_Backend
 

Detailed Description

GPS driver main class

Definition at line 48 of file AP_GPS.h.

Member Enumeration Documentation

◆ GPS_AUTO_CONFIG

Enumerator
GPS_AUTO_CONFIG_DISABLE 
GPS_AUTO_CONFIG_ENABLE 

Definition at line 555 of file AP_GPS.h.

◆ GPS_Config

Enumerator
GPS_ALL_CONFIGURED 

Definition at line 120 of file AP_GPS.h.

◆ GPS_Engine_Setting

Enumerator
GPS_ENGINE_NONE 
GPS_ENGINE_PORTABLE 
GPS_ENGINE_STATIONARY 
GPS_ENGINE_PEDESTRIAN 
GPS_ENGINE_AUTOMOTIVE 
GPS_ENGINE_SEA 
GPS_ENGINE_AIRBORNE_1G 
GPS_ENGINE_AIRBORNE_2G 
GPS_ENGINE_AIRBORNE_4G 

Definition at line 108 of file AP_GPS.h.

◆ GPS_Status

GPS status codes.

Enumerator
NO_GPS 

No GPS connected/detected.

NO_FIX 

Receiving valid GPS messages but no lock.

GPS_OK_FIX_2D 

Receiving valid messages and 2D lock.

GPS_OK_FIX_3D 

Receiving valid messages and 3D lock.

GPS_OK_FIX_3D_DGPS 

Receiving valid messages and 3D lock with differential improvements.

GPS_OK_FIX_3D_RTK_FLOAT 

Receiving valid messages and 3D RTK Float.

GPS_OK_FIX_3D_RTK_FIXED 

Receiving valid messages and 3D RTK Fixed.

Definition at line 96 of file AP_GPS.h.

◆ GPS_Type

Enumerator
GPS_TYPE_NONE 
GPS_TYPE_AUTO 
GPS_TYPE_UBLOX 
GPS_TYPE_MTK 
GPS_TYPE_MTK19 
GPS_TYPE_NMEA 
GPS_TYPE_SIRF 
GPS_TYPE_HIL 
GPS_TYPE_SBP 
GPS_TYPE_UAVCAN 
GPS_TYPE_SBF 
GPS_TYPE_GSOF 
GPS_TYPE_ERB 
GPS_TYPE_MAV 
GPS_TYPE_NOVA 

Definition at line 77 of file AP_GPS.h.

Constructor & Destructor Documentation

◆ AP_GPS() [1/2]

AP_GPS::AP_GPS ( )

Definition at line 265 of file AP_GPS.cpp.

Here is the call graph for this function:

◆ AP_GPS() [2/2]

AP_GPS::AP_GPS ( const AP_GPS other)
delete

Member Function Documentation

◆ all_configured()

bool AP_GPS::all_configured ( void  ) const
inline

Definition at line 381 of file AP_GPS.h.

Referenced by get_lag().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ all_consistent()

bool AP_GPS::all_consistent ( float &  distance) const

Definition at line 1002 of file AP_GPS.cpp.

Referenced by all_configured(), and AP_Arming::gps_checks().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ blend_health_check()

bool AP_GPS::blend_health_check ( ) const

Definition at line 1018 of file AP_GPS.cpp.

Referenced by all_configured(), and AP_Arming::gps_checks().

Here is the caller graph for this function:

◆ broadcast_first_configuration_failure_reason()

void AP_GPS::broadcast_first_configuration_failure_reason ( void  ) const

Definition at line 991 of file AP_GPS.cpp.

Referenced by get_lag(), and AP_Arming::gps_checks().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ calc_blend_weights()

bool AP_GPS::calc_blend_weights ( void  )
private

Definition at line 1165 of file AP_GPS.cpp.

Referenced by update().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ calc_blended_state()

void AP_GPS::calc_blended_state ( void  )
private

Definition at line 1327 of file AP_GPS.cpp.

Referenced by update().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ detect_instance()

void AP_GPS::detect_instance ( uint8_t  instance)
private

Definition at line 408 of file AP_GPS.cpp.

Referenced by update_instance().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ first_unconfigured_gps()

uint8_t AP_GPS::first_unconfigured_gps ( void  ) const

Definition at line 981 of file AP_GPS.cpp.

Referenced by all_configured(), broadcast_first_configuration_failure_reason(), get_lag(), and AP_Arming::gps_checks().

Here is the caller graph for this function:

◆ get_antenna_offset()

const Vector3f & AP_GPS::get_antenna_offset ( uint8_t  instance) const

Definition at line 1137 of file AP_GPS.cpp.

Referenced by get_lag(), NavEKF2_core::SelectVelPosFusion(), and NavEKF3_core::SelectVelPosFusion().

Here is the caller graph for this function:

◆ get_hdop() [1/2]

uint16_t AP_GPS::get_hdop ( uint8_t  instance) const
inline

Definition at line 284 of file AP_GPS.h.

Referenced by AP_Frsky_Telem::calc_gps_status(), NavEKF2_core::calcGpsGoodToAlign(), NavEKF3_core::calcGpsGoodToAlign(), and DataFlash_Class::Log_Write_GPS().

Here is the caller graph for this function:

◆ get_hdop() [2/2]

uint16_t AP_GPS::get_hdop ( ) const
inline

Definition at line 287 of file AP_GPS.h.

Referenced by send_mavlink_gps2_raw(), and send_mavlink_gps_raw().

Here is the caller graph for this function:

◆ get_lag() [1/2]

bool AP_GPS::get_lag ( uint8_t  instance,
float &  lag_sec 
) const

Definition at line 1107 of file AP_GPS.cpp.

Referenced by calc_blended_state(), get_lag(), AP_AHRS_DCM::get_position(), NavEKF3_core::readGpsData(), and rtk_age_ms().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_lag() [2/2]

bool AP_GPS::get_lag ( float &  lag_sec) const
inline

Definition at line 352 of file AP_GPS.h.

Here is the call graph for this function:

◆ get_rate_ms()

uint16_t AP_GPS::get_rate_ms ( uint8_t  instance) const
private

Definition at line 1153 of file AP_GPS.cpp.

Referenced by AP_GPS_UBLOX::_configure_rate(), and calc_blend_weights().

Here is the caller graph for this function:

◆ get_vdop() [1/2]

uint16_t AP_GPS::get_vdop ( uint8_t  instance) const
inline

Definition at line 292 of file AP_GPS.h.

Referenced by DataFlash_Class::Log_Write_GPS().

Here is the caller graph for this function:

◆ get_vdop() [2/2]

uint16_t AP_GPS::get_vdop ( ) const
inline

Definition at line 295 of file AP_GPS.h.

Referenced by send_mavlink_gps2_raw(), and send_mavlink_gps_raw().

Here is the caller graph for this function:

◆ gps()

static AP_GPS& AP_GPS::gps ( )
inlinestatic

Definition at line 72 of file AP_GPS.h.

Referenced by AP::gps().

Here is the caller graph for this function:

◆ ground_course() [1/2]

float AP_GPS::ground_course ( uint8_t  instance) const
inline

Definition at line 245 of file AP_GPS.h.

Referenced by DataFlash_Class::Log_Write_GPS().

Here is the caller graph for this function:

◆ ground_course() [2/2]

float AP_GPS::ground_course ( ) const
inline

Definition at line 248 of file AP_GPS.h.

Referenced by send_mavlink_gps2_raw(), and send_mavlink_gps_raw().

Here is the caller graph for this function:

◆ ground_course_cd() [1/2]

int32_t AP_GPS::ground_course_cd ( uint8_t  instance) const
inline

Definition at line 252 of file AP_GPS.h.

Referenced by AP_AHRS_DCM::drift_correction_yaw(), AR_AttitudeControl::get_forward_speed(), AP_AHRS_DCM::get_position(), and loop().

Here is the caller graph for this function:

◆ ground_course_cd() [2/2]

int32_t AP_GPS::ground_course_cd ( ) const
inline

Definition at line 255 of file AP_GPS.h.

◆ ground_speed() [1/2]

float AP_GPS::ground_speed ( uint8_t  instance) const
inline

◆ ground_speed() [2/2]

float AP_GPS::ground_speed ( ) const
inline

Definition at line 235 of file AP_GPS.h.

Referenced by send_mavlink_gps2_raw(), and send_mavlink_gps_raw().

Here is the caller graph for this function:

◆ ground_speed_cm()

uint32_t AP_GPS::ground_speed_cm ( void  )
inline

Definition at line 240 of file AP_GPS.h.

◆ handle_gps_inject()

void AP_GPS::handle_gps_inject ( const mavlink_message_t *  msg)
private

Definition at line 777 of file AP_GPS.cpp.

Referenced by handle_msg().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle_gps_rtcm_data()

void AP_GPS::handle_gps_rtcm_data ( const mavlink_message_t *  msg)
private

Definition at line 1026 of file AP_GPS.cpp.

Referenced by handle_msg().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle_msg()

void AP_GPS::handle_msg ( const mavlink_message_t *  msg)

Definition at line 789 of file AP_GPS.cpp.

Referenced by GCS_MAVLINK::handle_common_gps_message().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ have_vertical_velocity() [1/2]

bool AP_GPS::have_vertical_velocity ( uint8_t  instance) const
inline

Definition at line 326 of file AP_GPS.h.

Referenced by NavEKF2_core::calcGpsGoodToAlign(), NavEKF3_core::calcGpsGoodToAlign(), DataFlash_Class::Log_Write_GPS(), NavEKF2_core::readGpsData(), and NavEKF3_core::readGpsData().

Here is the caller graph for this function:

◆ have_vertical_velocity() [2/2]

bool AP_GPS::have_vertical_velocity ( void  ) const
inline

Definition at line 329 of file AP_GPS.h.

Referenced by calc_blended_state().

Here is the caller graph for this function:

◆ highest_supported_status()

AP_GPS::GPS_Status AP_GPS::highest_supported_status ( uint8_t  instance) const

Definition at line 571 of file AP_GPS.cpp.

Referenced by status().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ horizontal_accuracy() [1/2]

bool AP_GPS::horizontal_accuracy ( uint8_t  instance,
float &  hacc 
) const

Definition at line 325 of file AP_GPS.cpp.

Referenced by calc_blend_weights(), calc_blended_state(), NavEKF2_core::calcGpsGoodToAlign(), NavEKF3_core::calcGpsGoodToAlign(), DataFlash_Class::Log_Write_GPS(), NavEKF2_core::readGpsData(), NavEKF3_core::readGpsData(), AP_ADSB::send_dynamic_out(), and send_mavlink_gps_raw().

Here is the caller graph for this function:

◆ horizontal_accuracy() [2/2]

bool AP_GPS::horizontal_accuracy ( float &  hacc) const
inline

Definition at line 214 of file AP_GPS.h.

◆ init()

void AP_GPS::init ( const AP_SerialManager serial_manager)

Startup initialisation.

Definition at line 279 of file AP_GPS.cpp.

Referenced by setup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ inject_data() [1/2]

void AP_GPS::inject_data ( uint8_t *  data,
uint16_t  len 
)
private

Definition at line 880 of file AP_GPS.cpp.

Referenced by handle_gps_inject(), and handle_gps_rtcm_data().

Here is the caller graph for this function:

◆ inject_data() [2/2]

void AP_GPS::inject_data ( uint8_t  instance,
uint8_t *  data,
uint16_t  len 
)
private

Definition at line 892 of file AP_GPS.cpp.

Here is the call graph for this function:

◆ is_healthy() [1/2]

bool AP_GPS::is_healthy ( uint8_t  instance) const

Definition at line 1532 of file AP_GPS.cpp.

Referenced by AP_Arming::gps_checks().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_healthy() [2/2]

bool AP_GPS::is_healthy ( void  ) const
inline

Definition at line 414 of file AP_GPS.h.

Referenced by is_healthy(), and set_log_gps_bit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ last_fix_time_ms() [1/2]

uint32_t AP_GPS::last_fix_time_ms ( uint8_t  instance) const
inline

Definition at line 301 of file AP_GPS.h.

Referenced by AP_AdvancedFailsafe::check(), AP_AHRS_DCM::drift_correction(), and AP_AHRS_DCM::drift_correction_yaw().

Here is the caller graph for this function:

◆ last_fix_time_ms() [2/2]

uint32_t AP_GPS::last_fix_time_ms ( void  ) const
inline

Definition at line 304 of file AP_GPS.h.

Referenced by calc_blended_state(), send_mavlink_gps2_raw(), and send_mavlink_gps_raw().

Here is the caller graph for this function:

◆ last_message_delta_time_ms() [1/2]

uint16_t AP_GPS::last_message_delta_time_ms ( uint8_t  instance) const
inline

Definition at line 318 of file AP_GPS.h.

Referenced by DataFlash_Class::Log_Write_GPS().

Here is the caller graph for this function:

◆ last_message_delta_time_ms() [2/2]

uint16_t AP_GPS::last_message_delta_time_ms ( void  ) const
inline

Definition at line 321 of file AP_GPS.h.

Referenced by is_healthy().

Here is the caller graph for this function:

◆ last_message_time_ms() [1/2]

uint32_t AP_GPS::last_message_time_ms ( uint8_t  instance) const
inline

Definition at line 310 of file AP_GPS.h.

Referenced by DataFlash_Class::Log_Write_GPS(), loop(), NavEKF2_core::readGpsData(), and NavEKF3_core::readGpsData().

Here is the caller graph for this function:

◆ last_message_time_ms() [2/2]

uint32_t AP_GPS::last_message_time_ms ( void  ) const
inline

Definition at line 313 of file AP_GPS.h.

Referenced by calc_blended_state(), send_mavlink_gps2_raw(), send_mavlink_gps_raw(), and update_instance().

Here is the caller graph for this function:

◆ location() [1/2]

const Location& AP_GPS::location ( uint8_t  instance) const
inline

◆ location() [2/2]

const Location& AP_GPS::location ( ) const
inline

Definition at line 203 of file AP_GPS.h.

Referenced by all_consistent(), calc_blended_state(), send_mavlink_gps2_raw(), and send_mavlink_gps_raw().

Here is the caller graph for this function:

◆ lock_port()

void AP_GPS::lock_port ( uint8_t  instance,
bool  lock 
)

Lock a GPS port, preventing the GPS driver from using it. This can be used to allow a user to control a GPS port via the SERIAL_CONTROL protocol

Definition at line 866 of file AP_GPS.cpp.

Referenced by get_lag(), and GCS_MAVLINK::handle_serial_control().

Here is the caller graph for this function:

◆ num_sats() [1/2]

uint8_t AP_GPS::num_sats ( uint8_t  instance) const
inline

Definition at line 260 of file AP_GPS.h.

Referenced by AP_Frsky_Telem::calc_gps_status(), NavEKF2_core::calcGpsGoodToAlign(), NavEKF3_core::calcGpsGoodToAlign(), AP_AHRS_DCM::drift_correction(), DataFlash_Class::Log_Write_GPS(), loop(), NavEKF2_core::readGpsData(), NavEKF3_core::readGpsData(), and AP_ADSB::send_dynamic_out().

Here is the caller graph for this function:

◆ num_sats() [2/2]

uint8_t AP_GPS::num_sats ( ) const
inline

Definition at line 263 of file AP_GPS.h.

Referenced by calc_blended_state(), send_mavlink_gps2_raw(), send_mavlink_gps_raw(), and update().

Here is the caller graph for this function:

◆ num_sensors()

uint8_t AP_GPS::num_sensors ( void  ) const

Definition at line 307 of file AP_GPS.cpp.

◆ operator=()

AP_GPS& AP_GPS::operator= ( const AP_GPS )
delete

◆ prepare_for_arming()

bool AP_GPS::prepare_for_arming ( void  )

Definition at line 1538 of file AP_GPS.cpp.

Referenced by is_healthy().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ primary_sensor()

uint8_t AP_GPS::primary_sensor ( void  ) const
inline

Definition at line 184 of file AP_GPS.h.

Referenced by DataFlash_Class::Log_Write_GPS(), NavEKF2_core::readGpsData(), and NavEKF3_core::readGpsData().

Here is the caller graph for this function:

◆ rtk_age_ms() [1/2]

uint32_t AP_GPS::rtk_age_ms ( uint8_t  instance) const
inline

Definition at line 342 of file AP_GPS.h.

◆ rtk_age_ms() [2/2]

uint32_t AP_GPS::rtk_age_ms ( void  ) const
inline

Definition at line 345 of file AP_GPS.h.

Referenced by send_mavlink_gps2_raw().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rtk_num_sats() [1/2]

uint8_t AP_GPS::rtk_num_sats ( uint8_t  instance) const
inline

Definition at line 334 of file AP_GPS.h.

◆ rtk_num_sats() [2/2]

uint8_t AP_GPS::rtk_num_sats ( void  ) const
inline

Definition at line 337 of file AP_GPS.h.

Referenced by send_mavlink_gps2_raw().

Here is the caller graph for this function:

◆ send_blob_start()

void AP_GPS::send_blob_start ( uint8_t  instance,
const char *  _blob,
uint16_t  size 
)

Definition at line 371 of file AP_GPS.cpp.

Referenced by all_configured(), AP_GPS_MTK::AP_GPS_MTK(), AP_GPS_SIRF::AP_GPS_SIRF(), AP_GPS_UBLOX::AP_GPS_UBLOX(), detect_instance(), and AP_GPS_MTK::send_init_blob().

Here is the caller graph for this function:

◆ send_blob_update()

void AP_GPS::send_blob_update ( uint8_t  instance)

Definition at line 381 of file AP_GPS.cpp.

Referenced by all_configured(), detect_instance(), and update_instance().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_mavlink_gps2_raw()

void AP_GPS::send_mavlink_gps2_raw ( mavlink_channel_t  chan)

Definition at line 942 of file AP_GPS.cpp.

Referenced by get_lag(), and GCS_MAVLINK::try_send_gps_message().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_mavlink_gps_raw()

void AP_GPS::send_mavlink_gps_raw ( mavlink_channel_t  chan)

Definition at line 899 of file AP_GPS.cpp.

Referenced by get_lag(), and GCS_MAVLINK::try_send_gps_message().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_mavlink_gps_rtk()

void AP_GPS::send_mavlink_gps_rtk ( mavlink_channel_t  chan,
uint8_t  inst 
)

Definition at line 971 of file AP_GPS.cpp.

Referenced by get_lag(), and GCS_MAVLINK::try_send_gps_message().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_log_gps_bit()

void AP_GPS::set_log_gps_bit ( uint32_t  bit)
inline

Definition at line 409 of file AP_GPS.h.

Here is the call graph for this function:

◆ setHIL()

void AP_GPS::setHIL ( uint8_t  instance,
GPS_Status  status,
uint64_t  time_epoch_ms,
const Location location,
const Vector3f velocity,
uint8_t  num_sats,
uint16_t  hdop 
)

Definition at line 814 of file AP_GPS.cpp.

Referenced by get_lag().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setHIL_Accuracy()

void AP_GPS::setHIL_Accuracy ( uint8_t  instance,
float  vdop,
float  hacc,
float  vacc,
float  sacc,
bool  _have_vertical_velocity,
uint32_t  sample_ms 
)

Definition at line 841 of file AP_GPS.cpp.

Referenced by get_lag().

Here is the caller graph for this function:

◆ should_df_log()

bool AP_GPS::should_df_log ( ) const
private

Definition at line 579 of file AP_GPS.cpp.

Referenced by AP_GPS_Backend::should_df_log(), and update_instance().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ speed_accuracy() [1/2]

bool AP_GPS::speed_accuracy ( uint8_t  instance,
float &  sacc 
) const

Definition at line 316 of file AP_GPS.cpp.

Referenced by calc_blend_weights(), calc_blended_state(), DataFlash_Class::Log_Write_GPS(), NavEKF2_core::readGpsData(), NavEKF3_core::readGpsData(), AP_ADSB::send_dynamic_out(), and send_mavlink_gps_raw().

Here is the caller graph for this function:

◆ speed_accuracy() [2/2]

bool AP_GPS::speed_accuracy ( float &  sacc) const
inline

Definition at line 209 of file AP_GPS.h.

◆ status() [1/2]

GPS_Status AP_GPS::status ( uint8_t  instance) const
inline

◆ status() [2/2]

GPS_Status AP_GPS::status ( void  ) const
inline

Definition at line 192 of file AP_GPS.h.

Referenced by calc_blend_weights(), calc_blended_state(), get_lag(), send_mavlink_gps2_raw(), send_mavlink_gps_raw(), update(), update_instance(), and Write_DataFlash_Log_Startup_messages().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ time_epoch_convert()

uint64_t AP_GPS::time_epoch_convert ( uint16_t  gps_week,
uint32_t  gps_ms 
)
static

convert GPS week and milliseconds to unix epoch in milliseconds

Definition at line 347 of file AP_GPS.cpp.

Referenced by time_epoch_usec().

Here is the caller graph for this function:

◆ time_epoch_usec() [1/2]

uint64_t AP_GPS::time_epoch_usec ( uint8_t  instance) const

calculate current time since the unix epoch in microseconds

Definition at line 356 of file AP_GPS.cpp.

Referenced by AP_ADSB::genICAO(), and AP_ADSB::send_dynamic_out().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ time_epoch_usec() [2/2]

uint64_t AP_GPS::time_epoch_usec ( void  ) const
inline

Definition at line 397 of file AP_GPS.h.

Referenced by all_configured().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ time_week() [1/2]

uint16_t AP_GPS::time_week ( uint8_t  instance) const
inline

Definition at line 276 of file AP_GPS.h.

Referenced by DataFlash_Class::Log_Write_CameraInfo(), DataFlash_Class::Log_Write_GPS(), and loop().

Here is the caller graph for this function:

◆ time_week() [2/2]

uint16_t AP_GPS::time_week ( ) const
inline

Definition at line 279 of file AP_GPS.h.

Referenced by calc_blended_state().

Here is the caller graph for this function:

◆ time_week_ms() [1/2]

uint32_t AP_GPS::time_week_ms ( uint8_t  instance) const
inline

Definition at line 268 of file AP_GPS.h.

Referenced by DataFlash_Class::Log_Write_CameraInfo(), DataFlash_Class::Log_Write_GPS(), and loop().

Here is the caller graph for this function:

◆ time_week_ms() [2/2]

uint32_t AP_GPS::time_week_ms ( ) const
inline

Definition at line 271 of file AP_GPS.h.

Referenced by calc_blended_state().

Here is the caller graph for this function:

◆ update()

void AP_GPS::update ( void  )

Update GPS state based on possible bytes received from the module. This routine must be called periodically (typically at 10Hz or more) to process incoming data.

Definition at line 678 of file AP_GPS.cpp.

Referenced by loop().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_instance()

void AP_GPS::update_instance ( uint8_t  instance)
private

Definition at line 598 of file AP_GPS.cpp.

Referenced by update().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ velocity() [1/2]

const Vector3f& AP_GPS::velocity ( uint8_t  instance) const
inline

Definition at line 224 of file AP_GPS.h.

Referenced by AP_AHRS_DCM::drift_correction(), DataFlash_Class::Log_Write_GPS(), NavEKF2_core::readGpsData(), NavEKF3_core::readGpsData(), and AP_ADSB::send_dynamic_out().

Here is the caller graph for this function:

◆ velocity() [2/2]

const Vector3f& AP_GPS::velocity ( ) const
inline

Definition at line 227 of file AP_GPS.h.

Referenced by calc_blended_state().

Here is the caller graph for this function:

◆ vertical_accuracy() [1/2]

bool AP_GPS::vertical_accuracy ( uint8_t  instance,
float &  vacc 
) const

Definition at line 334 of file AP_GPS.cpp.

Referenced by calc_blend_weights(), calc_blended_state(), NavEKF2_core::calcGpsGoodToAlign(), NavEKF3_core::calcGpsGoodToAlign(), DataFlash_Class::Log_Write_GPS(), NavEKF2_core::readGpsData(), NavEKF3_core::readGpsData(), AP_ADSB::send_dynamic_out(), and send_mavlink_gps_raw().

Here is the caller graph for this function:

◆ vertical_accuracy() [2/2]

bool AP_GPS::vertical_accuracy ( float &  vacc) const
inline

Definition at line 219 of file AP_GPS.h.

◆ Write_DataFlash_Log_Startup_messages()

void AP_GPS::Write_DataFlash_Log_Startup_messages ( )

Definition at line 1093 of file AP_GPS.cpp.

Here is the call graph for this function:

Friends And Related Function Documentation

◆ AP_GPS_Backend

friend class AP_GPS_Backend
friend

Definition at line 63 of file AP_GPS.h.

◆ AP_GPS_ERB

friend class AP_GPS_ERB
friend

Definition at line 50 of file AP_GPS.h.

Referenced by detect_instance().

◆ AP_GPS_GSOF

friend class AP_GPS_GSOF
friend

Definition at line 51 of file AP_GPS.h.

Referenced by detect_instance().

◆ AP_GPS_MAV

friend class AP_GPS_MAV
friend

Definition at line 52 of file AP_GPS.h.

Referenced by detect_instance().

◆ AP_GPS_MTK

friend class AP_GPS_MTK
friend

Definition at line 53 of file AP_GPS.h.

Referenced by detect_instance().

◆ AP_GPS_MTK19

friend class AP_GPS_MTK19
friend

Definition at line 54 of file AP_GPS.h.

Referenced by detect_instance().

◆ AP_GPS_NMEA

friend class AP_GPS_NMEA
friend

Definition at line 55 of file AP_GPS.h.

Referenced by detect_instance().

◆ AP_GPS_NOVA

friend class AP_GPS_NOVA
friend

Definition at line 56 of file AP_GPS.h.

Referenced by detect_instance().

◆ AP_GPS_PX4

friend class AP_GPS_PX4
friend

Definition at line 57 of file AP_GPS.h.

◆ AP_GPS_SBF

friend class AP_GPS_SBF
friend

Definition at line 58 of file AP_GPS.h.

Referenced by detect_instance().

◆ AP_GPS_SBP

friend class AP_GPS_SBP
friend

Definition at line 59 of file AP_GPS.h.

Referenced by detect_instance().

◆ AP_GPS_SBP2

friend class AP_GPS_SBP2
friend

Definition at line 60 of file AP_GPS.h.

Referenced by detect_instance().

◆ AP_GPS_SIRF

friend class AP_GPS_SIRF
friend

Definition at line 61 of file AP_GPS.h.

Referenced by detect_instance().

◆ AP_GPS_UBLOX

friend class AP_GPS_UBLOX
friend

Definition at line 62 of file AP_GPS.h.

Referenced by detect_instance().

Member Data Documentation

◆ _antenna_offset

AP_Vector3f AP_GPS::_antenna_offset[GPS_MAX_RECEIVERS]
protected

Definition at line 436 of file AP_GPS.h.

Referenced by calc_blended_state(), get_antenna_offset(), and update().

◆ _auto_config

AP_Int8 AP_GPS::_auto_config
protected

◆ _auto_switch

AP_Int8 AP_GPS::_auto_switch
protected

Definition at line 424 of file AP_GPS.h.

Referenced by update().

◆ _baudrates

const uint32_t AP_GPS::_baudrates = {9600U, 115200U, 4800U, 19200U, 38400U, 57600U, 230400U}
staticprivate

Definition at line 499 of file AP_GPS.h.

Referenced by AP_GPS_Backend::_detection_message(), and detect_instance().

◆ _blend_health_counter

uint8_t AP_GPS::_blend_health_counter
private

Definition at line 544 of file AP_GPS.h.

Referenced by blend_health_check(), and update().

◆ _blend_mask

AP_Int8 AP_GPS::_blend_mask
protected

Definition at line 438 of file AP_GPS.h.

Referenced by calc_blend_weights().

◆ _blend_tc

AP_Float AP_GPS::_blend_tc
protected

Definition at line 439 of file AP_GPS.h.

Referenced by init().

◆ _blend_weights

float AP_GPS::_blend_weights[GPS_MAX_RECEIVERS]
private

Definition at line 540 of file AP_GPS.h.

Referenced by calc_blend_weights(), and calc_blended_state().

◆ _blended_antenna_offset

Vector3f AP_GPS::_blended_antenna_offset
private

Definition at line 538 of file AP_GPS.h.

Referenced by calc_blended_state(), get_antenna_offset(), and update().

◆ _blended_lag_sec

float AP_GPS::_blended_lag_sec = 0.001f * GPS_MAX_RATE_MS
private

Definition at line 539 of file AP_GPS.h.

Referenced by calc_blended_state(), and get_lag().

◆ _delay_ms

AP_Int16 AP_GPS::_delay_ms[GPS_MAX_RECEIVERS]
protected

Definition at line 437 of file AP_GPS.h.

Referenced by get_lag().

◆ _gnss_mode

AP_Int8 AP_GPS::_gnss_mode[GPS_MAX_RECEIVERS]
protected

Definition at line 432 of file AP_GPS.h.

Referenced by AP_GPS_UBLOX::_parse_gps().

◆ _hgt_offset_cm

float AP_GPS::_hgt_offset_cm[GPS_MAX_RECEIVERS]
private

Definition at line 537 of file AP_GPS.h.

Referenced by calc_blended_state().

◆ _initialisation_blob

const char AP_GPS::_initialisation_blob = UBLOX_SET_BINARY MTK_SET_BINARY SIRF_SET_BINARY
staticprivate

Definition at line 500 of file AP_GPS.h.

Referenced by AP_GPS(), and detect_instance().

◆ _initialisation_raw_blob

const char AP_GPS::_initialisation_raw_blob[]
staticprivate

Definition at line 501 of file AP_GPS.h.

◆ _inject_to

AP_Int8 AP_GPS::_inject_to
protected

Definition at line 427 of file AP_GPS.h.

Referenced by inject_data().

◆ _last_instance_swap_ms

uint32_t AP_GPS::_last_instance_swap_ms
protected

Definition at line 428 of file AP_GPS.h.

Referenced by init(), and update().

◆ _last_time_updated

uint32_t AP_GPS::_last_time_updated[GPS_MAX_RECEIVERS]
private

Definition at line 541 of file AP_GPS.h.

Referenced by calc_blended_state().

◆ _log_gps_bit

uint32_t AP_GPS::_log_gps_bit = -1
protected

Definition at line 441 of file AP_GPS.h.

Referenced by set_log_gps_bit(), and should_df_log().

◆ _min_dgps

AP_Int8 AP_GPS::_min_dgps
protected

Definition at line 425 of file AP_GPS.h.

◆ _min_elevation

AP_Int8 AP_GPS::_min_elevation
protected

Definition at line 430 of file AP_GPS.h.

Referenced by AP_GPS_UBLOX::_parse_gps().

◆ _navfilter

AP_Int8 AP_GPS::_navfilter
protected

Definition at line 423 of file AP_GPS.h.

Referenced by AP_GPS_UBLOX::_parse_gps().

◆ _NE_pos_offset_m

Vector2f AP_GPS::_NE_pos_offset_m[GPS_MAX_RECEIVERS]
private

Definition at line 536 of file AP_GPS.h.

Referenced by calc_blended_state().

◆ _omega_lpf

float AP_GPS::_omega_lpf
private

Definition at line 542 of file AP_GPS.h.

Referenced by calc_blended_state(), and init().

◆ _output_is_blended

bool AP_GPS::_output_is_blended
private

Definition at line 543 of file AP_GPS.h.

Referenced by num_sensors(), and update().

◆ _port

AP_HAL::UARTDriver* AP_GPS::_port[GPS_MAX_RECEIVERS]
private

Definition at line 466 of file AP_GPS.h.

Referenced by detect_instance(), init(), and send_blob_update().

◆ _rate_ms

AP_Int16 AP_GPS::_rate_ms[GPS_MAX_RECEIVERS]
protected

Definition at line 433 of file AP_GPS.h.

Referenced by AP_GPS_UBLOX::_parse_gps(), get_rate_ms(), and init().

◆ _raw_data

AP_Int8 AP_GPS::_raw_data
protected

◆ _save_config

AP_Int8 AP_GPS::_save_config
protected

Definition at line 434 of file AP_GPS.h.

Referenced by AP_GPS_UBLOX::read().

◆ _sbas_mode

AP_Int8 AP_GPS::_sbas_mode
protected

Definition at line 429 of file AP_GPS.h.

Referenced by AP_GPS_UBLOX::_parse_gps(), and AP_GPS_UBLOX::_request_next_config().

◆ _sbp_logmask

AP_Int16 AP_GPS::_sbp_logmask
protected

Definition at line 426 of file AP_GPS.h.

Referenced by AP_GPS_SBP::logging_log_raw_sbp(), and AP_GPS_SBP2::logging_log_raw_sbp().

◆ _singleton

AP_GPS * AP_GPS::_singleton
staticprivate

Definition at line 444 of file AP_GPS.h.

Referenced by AP_GPS(), and gps().

◆ _type

AP_Int8 AP_GPS::_type[GPS_MAX_RECEIVERS]
protected

◆ blob

const char* AP_GPS::blob

Definition at line 495 of file AP_GPS.h.

Referenced by send_blob_update().

◆ detect_state

◆ drivers

AP_GPS_Backend* AP_GPS::drivers[GPS_MAX_RECEIVERS]
private

◆ initblob_state

struct { ... } AP_GPS::initblob_state[GPS_MAX_RECEIVERS]

◆ locked_ports

uint8_t AP_GPS::locked_ports
private

Definition at line 475 of file AP_GPS.h.

Referenced by lock_port(), and update_instance().

◆ num_instances

uint8_t AP_GPS::num_instances
private

◆ primary_instance

uint8_t AP_GPS::primary_instance
private

◆ remaining

uint16_t AP_GPS::remaining

Definition at line 496 of file AP_GPS.h.

Referenced by detect_instance(), and send_blob_update().

◆ rtcm_buffer

◆ state

GPS_State AP_GPS::state[GPS_MAX_RECEIVERS+1]
private

◆ timing

GPS_timing AP_GPS::timing[GPS_MAX_RECEIVERS+1]
private

◆ var_info

const AP_Param::GroupInfo AP_GPS::var_info
static

Definition at line 404 of file AP_GPS.h.

Referenced by AP_GPS().


The documentation for this class was generated from the following files: