Paparazzi UAS  v5.15_devel-112-g521f3cf
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
gps_piksi.c File Reference

Driver for Piksi modules from Swift-Nav. More...

#include "subsystems/gps/gps_piksi.h"
#include "subsystems/gps.h"
#include "subsystems/abi.h"
#include "mcu_periph/uart.h"
#include "math/pprz_geodetic_double.h"
#include "generated/flight_plan.h"
#include <libsbp/sbp.h>
#include <libsbp/navigation.h>
#include <libsbp/observation.h>
#include <libsbp/tracking.h>
#include <libsbp/system.h>
#include <libsbp/settings.h>
#include <libsbp/piksi.h>
#include "subsystems/datalink/telemetry.h"
+ Include dependency graph for gps_piksi.c:

Go to the source code of this file.

Macros

#define SBP_FIX_MODE_SPP   0X00
 
#define SBP_FIX_MODE_FLOAT   0X02
 
#define SPB_FIX_MODE_FIXED   0X01
 
#define POS_ECEF_TIMEOUT   1000
 

Functions

static void send_piksi_heartbeat (struct transport_tx *trans, struct link_device *dev)
 
static void gps_piksi_publish (void)
 
static uint8_t get_fix_mode (uint8_t flags)
 
uint32_t gps_piksi_read (uint8_t *buff, uint32_t n, void *context)
 
uint32_t gps_piksi_write (uint8_t *buff, uint32_t n, void *context)
 
static void sbp_pos_ecef_callback (uint16_t sender_id, uint8_t len, uint8_t msg[], void *context)
 
static void sbp_vel_ecef_callback (uint16_t sender_id, uint8_t len, uint8_t msg[], void *context)
 
static void sbp_pos_llh_callback (uint16_t sender_id, uint8_t len, uint8_t msg[], void *context)
 
static void sbp_vel_ned_callback (uint16_t sender_id, uint8_t len, uint8_t msg[], void *context)
 
static void sbp_dops_callback (uint16_t sender_id, uint8_t len, uint8_t msg[], void *context)
 
static void sbp_gps_time_callback (uint16_t sender_id, uint8_t len, uint8_t msg[], void *context)
 
static void sbp_tracking_state_callback (uint16_t sender_id, uint8_t len, uint8_t msg[], void *context)
 
static void sbp_tracking_state_dep_a_callback (uint16_t sender_id, uint8_t len, uint8_t msg[], void *context)
 
static void spb_heartbeat_callback (uint16_t sender_id, uint8_t len, uint8_t msg[], void *context)
 
void gps_piksi_init (void)
 
void gps_piksi_event (void)
 
void gps_inject_data (uint8_t packet_id, uint8_t length, uint8_t *data)
 Override the default GPS packet injector to inject the data trough UART. More...
 

Variables

struct GpsState gps_piksi
 
struct GpsTimeSync gps_piksi_time_sync
 
static uint32_t time_since_last_heartbeat
 
static const char SBP_ANT_SET [] = "frontend""\x00""antenna_selection""\x00""Patch"
 
static const char SBP_UART_SET1 [] = "uart_uartb""\x00""mode""\x00""SBP"
 
static const char SBP_UART_SET2 [] = "uart_uartb""\x00""sbp_message_mask""\x00""784"
 
static const char SBP_UART_SET3 [] = "uart_uartb""\x00""configure_telemetry_radio_on_boot""\x00""False"
 
sbp_state_t sbp_state
 
sbp_msg_callbacks_node_t pos_ecef_node
 
sbp_msg_callbacks_node_t vel_ecef_node
 
sbp_msg_callbacks_node_t pos_llh_node
 
sbp_msg_callbacks_node_t vel_ned_node
 
sbp_msg_callbacks_node_t dops_node
 
sbp_msg_callbacks_node_t gps_time_node
 
sbp_msg_callbacks_node_t tracking_state_node
 
sbp_msg_callbacks_node_t tracking_state_dep_a_node
 
sbp_msg_callbacks_node_t heartbeat_node
 
static uint32_t time_since_last_pos_update
 

Detailed Description

Macro Definition Documentation

#define POS_ECEF_TIMEOUT   1000

Definition at line 54 of file gps_piksi.c.

Referenced by gps_piksi_event().

#define SBP_FIX_MODE_FLOAT   0X02

Definition at line 51 of file gps_piksi.c.

Referenced by get_fix_mode().

#define SBP_FIX_MODE_SPP   0X00

Definition at line 50 of file gps_piksi.c.

Referenced by get_fix_mode(), and sbp_pos_ecef_callback().

#define SPB_FIX_MODE_FIXED   0X01

Definition at line 52 of file gps_piksi.c.

Referenced by get_fix_mode().

Function Documentation

static uint8_t get_fix_mode ( uint8_t  flags)
static

Definition at line 283 of file gps_piksi.c.

References GpsState::fix, gps, GPS_FIX_3D, GPS_FIX_DGPS, GPS_FIX_NONE, GPS_FIX_RTK, SBP_FIX_MODE_FLOAT, SBP_FIX_MODE_SPP, and SPB_FIX_MODE_FIXED.

Referenced by sbp_pos_ecef_callback().

+ Here is the caller graph for this function:

void gps_inject_data ( uint8_t  packet_id,
uint8_t  length,
uint8_t data 
)

Override the default GPS packet injector to inject the data trough UART.

GPS packet injection (default empty)

Definition at line 408 of file gps_piksi.c.

Referenced by dl_parse_msg().

+ Here is the caller graph for this function:

void gps_piksi_event ( void  )

Definition at line 349 of file gps_piksi.c.

References GpsState::fix, get_sys_time_msec(), GPS_FIX_NONE, gps_piksi, gps_piksi_read(), POS_ECEF_TIMEOUT, sbp_state, and uart_char_available().

+ Here is the call graph for this function:

static void gps_piksi_publish ( void  )
static

Definition at line 362 of file gps_piksi.c.

References GpsState::fix, get_sys_time_usec(), GPS_FIX_3D, gps_piksi, GPS_PIKSI_ID, GpsState::last_3dfix_ticks, GpsState::last_3dfix_time, GpsState::last_msg_ticks, GpsState::last_msg_time, sys_time::nb_sec, and sys_time::nb_sec_rem.

Referenced by sbp_pos_ecef_callback(), and sbp_vel_ecef_callback().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32_t gps_piksi_read ( uint8_t buff,
uint32_t  n,
void *  context 
)

Definition at line 380 of file gps_piksi.c.

References uart_char_available(), and uart_getch().

Referenced by gps_piksi_event().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32_t gps_piksi_write ( uint8_t buff,
uint32_t  n,
void *  context 
)

Definition at line 396 of file gps_piksi.c.

References uart_put_byte().

Referenced by gps_inject_data(), and gps_piksi_init().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void sbp_dops_callback ( uint16_t  sender_id,
uint8_t  len,
uint8_t  msg[],
void *  context 
)
static

Definition at line 221 of file gps_piksi.c.

References gps_piksi, and GpsState::pdop.

Referenced by gps_piksi_init().

+ Here is the caller graph for this function:

static void sbp_gps_time_callback ( uint16_t  sender_id,
uint8_t  len,
uint8_t  msg[],
void *  context 
)
static

Definition at line 230 of file gps_piksi.c.

References gps_piksi, GpsState::tow, and GpsState::week.

Referenced by gps_piksi_init().

+ Here is the caller graph for this function:

static void sbp_pos_ecef_callback ( uint16_t  sender_id,
uint8_t  len,
uint8_t  msg[],
void *  context 
)
static
static void sbp_pos_llh_callback ( uint16_t  sender_id,
uint8_t  len,
uint8_t  msg[],
void *  context 
)
static

Definition at line 173 of file gps_piksi.c.

References LlaCoor_i::alt, gps_piksi, GPS_VALID_HMSL_BIT, GPS_VALID_POS_LLA_BIT, GpsState::hmsl, LlaCoor_i::lat, GpsState::lla_pos, LlaCoor_i::lon, and GpsState::valid_fields.

Referenced by gps_piksi_init().

+ Here is the caller graph for this function:

static void sbp_tracking_state_callback ( uint16_t  sender_id,
uint8_t  len,
uint8_t  msg[],
void *  context 
)
static

Definition at line 240 of file gps_piksi.c.

References SVinfo::cno, gps_piksi, SVinfo::svid, and GpsState::svinfos.

Referenced by gps_piksi_init().

+ Here is the caller graph for this function:

static void sbp_tracking_state_dep_a_callback ( uint16_t  sender_id,
uint8_t  len,
uint8_t  msg[],
void *  context 
)
static

Definition at line 256 of file gps_piksi.c.

References SVinfo::cno, gps_piksi, SVinfo::svid, and GpsState::svinfos.

Referenced by gps_piksi_init().

+ Here is the caller graph for this function:

static void sbp_vel_ecef_callback ( uint16_t  sender_id,
uint8_t  len,
uint8_t  msg[],
void *  context 
)
static

Definition at line 157 of file gps_piksi.c.

References GpsState::ecef_vel, gps_piksi, gps_piksi_publish(), GPS_VALID_VEL_ECEF_BIT, GpsState::sacc, GpsState::valid_fields, EcefCoor_i::x, EcefCoor_i::y, and EcefCoor_i::z.

Referenced by gps_piksi_init().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void sbp_vel_ned_callback ( uint16_t  sender_id,
uint8_t  len,
uint8_t  msg[],
void *  context 
)
static

Definition at line 205 of file gps_piksi.c.

References GpsState::course, gps_piksi, GPS_VALID_COURSE_BIT, GPS_VALID_VEL_NED_BIT, GpsState::gspeed, int32_sqrt(), GpsState::ned_vel, GpsState::valid_fields, NedCoor_i::x, NedCoor_i::y, and NedCoor_i::z.

Referenced by gps_piksi_init().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void send_piksi_heartbeat ( struct transport_tx *  trans,
struct link_device *  dev 
)
static

Definition at line 67 of file gps_piksi.c.

References time_since_last_heartbeat.

Referenced by gps_piksi_init().

+ Here is the caller graph for this function:

static void spb_heartbeat_callback ( uint16_t  sender_id,
uint8_t  len,
uint8_t  msg[],
void *  context 
)
static

Definition at line 272 of file gps_piksi.c.

References get_sys_time_msec(), and time_since_last_heartbeat.

Referenced by gps_piksi_init().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

sbp_msg_callbacks_node_t dops_node

Definition at line 113 of file gps_piksi.c.

Referenced by gps_piksi_init().

struct GpsTimeSync gps_piksi_time_sync

Definition at line 60 of file gps_piksi.c.

sbp_msg_callbacks_node_t gps_time_node

Definition at line 114 of file gps_piksi.c.

Referenced by gps_piksi_init().

sbp_msg_callbacks_node_t heartbeat_node

Definition at line 117 of file gps_piksi.c.

Referenced by gps_piksi_init().

sbp_msg_callbacks_node_t pos_ecef_node

Definition at line 109 of file gps_piksi.c.

Referenced by gps_piksi_init().

sbp_msg_callbacks_node_t pos_llh_node

Definition at line 111 of file gps_piksi.c.

Referenced by gps_piksi_init().

const char SBP_ANT_SET[] = "frontend""\x00""antenna_selection""\x00""Patch"
static

Definition at line 83 of file gps_piksi.c.

Referenced by gps_piksi_init().

sbp_state_t sbp_state

Definition at line 103 of file gps_piksi.c.

Referenced by gps_inject_data(), gps_piksi_event(), and gps_piksi_init().

const char SBP_UART_SET1[] = "uart_uartb""\x00""mode""\x00""SBP"
static

Definition at line 94 of file gps_piksi.c.

Referenced by gps_piksi_init().

const char SBP_UART_SET2[] = "uart_uartb""\x00""sbp_message_mask""\x00""784"
static

Definition at line 95 of file gps_piksi.c.

Referenced by gps_piksi_init().

const char SBP_UART_SET3[] = "uart_uartb""\x00""configure_telemetry_radio_on_boot""\x00""False"
static

Definition at line 96 of file gps_piksi.c.

Referenced by gps_piksi_init().

uint32_t time_since_last_heartbeat
static

Definition at line 62 of file gps_piksi.c.

Referenced by send_piksi_heartbeat(), and spb_heartbeat_callback().

uint32_t time_since_last_pos_update
static

Definition at line 124 of file gps_piksi.c.

sbp_msg_callbacks_node_t tracking_state_dep_a_node

Definition at line 116 of file gps_piksi.c.

Referenced by gps_piksi_init().

sbp_msg_callbacks_node_t tracking_state_node

Definition at line 115 of file gps_piksi.c.

Referenced by gps_piksi_init().

sbp_msg_callbacks_node_t vel_ecef_node

Definition at line 110 of file gps_piksi.c.

Referenced by gps_piksi_init().

sbp_msg_callbacks_node_t vel_ned_node

Definition at line 112 of file gps_piksi.c.

Referenced by gps_piksi_init().