Paparazzi UAS  v5.8.2_stable-0-g6260b7c
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 <libsbp/sbp.h>
#include <libsbp/navigation.h>
#include <libsbp/observation.h>
#include <libsbp/tracking.h>
#include <libsbp/settings.h>
#include <libsbp/piksi.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 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)
 
void gps_impl_init (void)
 GPS initialization. More...
 
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

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
 
static uint32_t time_since_last_pos_update
 

Detailed Description

Macro Definition Documentation

#define POS_ECEF_TIMEOUT   1000

Definition at line 55 of file gps_piksi.c.

Referenced by gps_piksi_event().

#define SBP_FIX_MODE_FLOAT   0X02

Definition at line 52 of file gps_piksi.c.

Referenced by get_fix_mode().

#define SBP_FIX_MODE_SPP   0X00

Definition at line 51 of file gps_piksi.c.

Referenced by get_fix_mode(), and sbp_pos_ecef_callback().

#define SPB_FIX_MODE_FIXED   0X01

Definition at line 53 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 267 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 384 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 325 of file gps_piksi.c.

References GpsState::fix, get_sys_time_msec(), gps, GPS_FIX_NONE, 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 338 of file gps_piksi.c.

References GpsState::fix, get_sys_time_usec(), gps, GPS_FIX_3D, 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 356 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 372 of file gps_piksi.c.

References uart_put_byte().

Referenced by gps_impl_init(), and gps_inject_data().

+ 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 213 of file gps_piksi.c.

References gps, and GpsState::pdop.

Referenced by gps_impl_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 222 of file gps_piksi.c.

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

Referenced by gps_impl_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

Definition at line 112 of file gps_piksi.c.

References GpsState::ecef_pos, GpsState::fix, get_fix_mode(), get_sys_time_msec(), gps, GPS_FIX_3D, gps_piksi_publish(), GpsState::num_sv, GpsState::pacc, SBP_FIX_MODE_SPP, GpsState::tow, EcefCoor_i::x, EcefCoor_i::y, and EcefCoor_i::z.

Referenced by gps_impl_init().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 232 of file gps_piksi.c.

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

Referenced by gps_impl_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 248 of file gps_piksi.c.

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

Referenced by gps_impl_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 137 of file gps_piksi.c.

References GpsState::ecef_vel, gps, gps_piksi_publish(), GpsState::sacc, EcefCoor_i::x, EcefCoor_i::y, and EcefCoor_i::z.

Referenced by gps_impl_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 198 of file gps_piksi.c.

References GpsState::course, gps, GpsState::gspeed, int32_sqrt(), GpsState::ned_vel, NedCoor_i::x, NedCoor_i::y, and NedCoor_i::z.

Referenced by gps_impl_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 95 of file gps_piksi.c.

Referenced by gps_impl_init().

sbp_msg_callbacks_node_t gps_time_node

Definition at line 96 of file gps_piksi.c.

Referenced by gps_impl_init().

sbp_msg_callbacks_node_t pos_ecef_node

Definition at line 91 of file gps_piksi.c.

Referenced by gps_impl_init().

sbp_msg_callbacks_node_t pos_llh_node

Definition at line 93 of file gps_piksi.c.

Referenced by gps_impl_init().

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

Definition at line 65 of file gps_piksi.c.

Referenced by gps_impl_init().

sbp_state_t sbp_state

Definition at line 85 of file gps_piksi.c.

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

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

Definition at line 76 of file gps_piksi.c.

Referenced by gps_impl_init().

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

Definition at line 77 of file gps_piksi.c.

Referenced by gps_impl_init().

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

Definition at line 78 of file gps_piksi.c.

Referenced by gps_impl_init().

uint32_t time_since_last_pos_update
static

Definition at line 105 of file gps_piksi.c.

sbp_msg_callbacks_node_t tracking_state_dep_a_node

Definition at line 98 of file gps_piksi.c.

Referenced by gps_impl_init().

sbp_msg_callbacks_node_t tracking_state_node

Definition at line 97 of file gps_piksi.c.

Referenced by gps_impl_init().

sbp_msg_callbacks_node_t vel_ecef_node

Definition at line 92 of file gps_piksi.c.

Referenced by gps_impl_init().

sbp_msg_callbacks_node_t vel_ned_node

Definition at line 94 of file gps_piksi.c.

Referenced by gps_impl_init().