Paparazzi UAS
v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
#include "modules/gps/gps.h"
#include "modules/gps/gps_skytraq.h"
#include "modules/core/abi.h"
#include "led.h"
#include "pprzlink/pprzlink_device.h"
Go to the source code of this file.
Macros | |
#define | UNINIT 0 |
#define | GOT_SYNC1 1 |
#define | GOT_SYNC2 2 |
#define | GOT_LEN1 3 |
#define | GOT_LEN2 4 |
#define | GOT_ID 5 |
#define | GOT_PAYLOAD 6 |
#define | GOT_CHECKSUM 7 |
#define | GOT_SYNC3 8 |
#define | SKYTRAQ_FIX_NONE 0x00 |
#define | SKYTRAQ_FIX_2D 0x01 |
#define | SKYTRAQ_FIX_3D 0x02 |
#define | SKYTRAQ_FIX_3D_DGPS 0x03 |
#define | SKYTRAQ_SYNC1 0xA0 |
#define | SKYTRAQ_SYNC2 0xA1 |
#define | SKYTRAQ_SYNC3 0x0D |
#define | SKYTRAQ_SYNC4 0x0A |
#define | SKYTRAQ_NAVIGATION_DATA_FixMode(_payload) (uint8_t) (*((uint8_t*)_payload+2-2)) |
#define | SKYTRAQ_NAVIGATION_DATA_NumSV(_payload) (uint8_t) (*((uint8_t*)_payload+3-2)) |
#define | SKYTRAQ_NAVIGATION_DATA_WEEK(_payload) bswap16(*(uint16_t*)&_payload[4-2]) |
#define | SKYTRAQ_NAVIGATION_DATA_TOW(_payload) __builtin_bswap32(*(uint32_t*)&_payload[6-2]) |
#define | SKYTRAQ_NAVIGATION_DATA_LAT(_payload) (int32_t)__builtin_bswap32(*( int32_t*)&_payload[10-2]) |
#define | SKYTRAQ_NAVIGATION_DATA_LON(_payload) (int32_t)__builtin_bswap32(*( int32_t*)&_payload[14-2]) |
#define | SKYTRAQ_NAVIGATION_DATA_AEL(_payload) __builtin_bswap32(*(uint32_t*)&_payload[18-2]) |
#define | SKYTRAQ_NAVIGATION_DATA_ASL(_payload) __builtin_bswap32(*(uint32_t*)&_payload[22-2]) |
#define | SKYTRAQ_NAVIGATION_DATA_GDOP(_payload) bswap16(*(uint16_t*)&_payload[26-2]) |
#define | SKYTRAQ_NAVIGATION_DATA_PDOP(_payload) bswap16(*(uint16_t*)&_payload[28-2]) |
#define | SKYTRAQ_NAVIGATION_DATA_HDOP(_payload) bswap16(*(uint16_t*)&_payload[30-2]) |
#define | SKYTRAQ_NAVIGATION_DATA_VDOP(_payload) bswap16(*(uint16_t*)&_payload[32-2]) |
#define | SKYTRAQ_NAVIGATION_DATA_TDOP(_payload) bswap16(*(uint16_t*)&_payload[34-2]) |
#define | SKYTRAQ_NAVIGATION_DATA_ECEFX(_payload) (int32_t)__builtin_bswap32(*(uint32_t*)&_payload[36-2]) |
#define | SKYTRAQ_NAVIGATION_DATA_ECEFY(_payload) (int32_t)__builtin_bswap32(*(uint32_t*)&_payload[40-2]) |
#define | SKYTRAQ_NAVIGATION_DATA_ECEFZ(_payload) (int32_t)__builtin_bswap32(*(uint32_t*)&_payload[44-2]) |
#define | SKYTRAQ_NAVIGATION_DATA_ECEFVX(_payload) (int32_t)__builtin_bswap32(*(uint32_t*)&_payload[48-2]) |
#define | SKYTRAQ_NAVIGATION_DATA_ECEFVY(_payload) (int32_t)__builtin_bswap32(*(uint32_t*)&_payload[52-2]) |
#define | SKYTRAQ_NAVIGATION_DATA_ECEFVZ(_payload) (int32_t)__builtin_bswap32(*(uint32_t*)&_payload[56-2]) |
#define | MAX_DISTANCE 1000000 |
Functions | |
void | gps_skytraq_read_message (void) |
void | gps_skytraq_parse (uint8_t c) |
void | gps_skytraq_msg (void) |
static uint16_t | bswap16 (uint16_t a) |
static int | distance_too_great (struct EcefCoor_i *ecef_ref, struct EcefCoor_i *ecef_pos) |
void | gps_skytraq_init (void) |
void | gps_skytraq_event (void) |
Variables | |
struct GpsSkytraq | gps_skytraq |
#define GOT_CHECKSUM 7 |
Definition at line 36 of file gps_skytraq.c.
#define GOT_ID 5 |
Definition at line 34 of file gps_skytraq.c.
#define GOT_LEN1 3 |
Definition at line 32 of file gps_skytraq.c.
#define GOT_LEN2 4 |
Definition at line 33 of file gps_skytraq.c.
#define GOT_PAYLOAD 6 |
Definition at line 35 of file gps_skytraq.c.
#define GOT_SYNC1 1 |
Definition at line 30 of file gps_skytraq.c.
#define GOT_SYNC2 2 |
Definition at line 31 of file gps_skytraq.c.
#define GOT_SYNC3 8 |
Definition at line 37 of file gps_skytraq.c.
#define MAX_DISTANCE 1000000 |
Definition at line 89 of file gps_skytraq.c.
#define SKYTRAQ_FIX_2D 0x01 |
Definition at line 40 of file gps_skytraq.c.
#define SKYTRAQ_FIX_3D 0x02 |
Definition at line 41 of file gps_skytraq.c.
#define SKYTRAQ_FIX_3D_DGPS 0x03 |
Definition at line 42 of file gps_skytraq.c.
#define SKYTRAQ_FIX_NONE 0x00 |
Definition at line 39 of file gps_skytraq.c.
#define SKYTRAQ_NAVIGATION_DATA_AEL | ( | _payload | ) | __builtin_bswap32(*(uint32_t*)&_payload[18-2]) |
Definition at line 71 of file gps_skytraq.c.
#define SKYTRAQ_NAVIGATION_DATA_ASL | ( | _payload | ) | __builtin_bswap32(*(uint32_t*)&_payload[22-2]) |
Definition at line 72 of file gps_skytraq.c.
#define SKYTRAQ_NAVIGATION_DATA_ECEFVX | ( | _payload | ) | (int32_t)__builtin_bswap32(*(uint32_t*)&_payload[48-2]) |
Definition at line 83 of file gps_skytraq.c.
#define SKYTRAQ_NAVIGATION_DATA_ECEFVY | ( | _payload | ) | (int32_t)__builtin_bswap32(*(uint32_t*)&_payload[52-2]) |
Definition at line 84 of file gps_skytraq.c.
#define SKYTRAQ_NAVIGATION_DATA_ECEFVZ | ( | _payload | ) | (int32_t)__builtin_bswap32(*(uint32_t*)&_payload[56-2]) |
Definition at line 85 of file gps_skytraq.c.
#define SKYTRAQ_NAVIGATION_DATA_ECEFX | ( | _payload | ) | (int32_t)__builtin_bswap32(*(uint32_t*)&_payload[36-2]) |
Definition at line 80 of file gps_skytraq.c.
#define SKYTRAQ_NAVIGATION_DATA_ECEFY | ( | _payload | ) | (int32_t)__builtin_bswap32(*(uint32_t*)&_payload[40-2]) |
Definition at line 81 of file gps_skytraq.c.
#define SKYTRAQ_NAVIGATION_DATA_ECEFZ | ( | _payload | ) | (int32_t)__builtin_bswap32(*(uint32_t*)&_payload[44-2]) |
Definition at line 82 of file gps_skytraq.c.
Definition at line 62 of file gps_skytraq.c.
Definition at line 74 of file gps_skytraq.c.
Definition at line 76 of file gps_skytraq.c.
#define SKYTRAQ_NAVIGATION_DATA_LAT | ( | _payload | ) | (int32_t)__builtin_bswap32(*( int32_t*)&_payload[10-2]) |
Definition at line 68 of file gps_skytraq.c.
#define SKYTRAQ_NAVIGATION_DATA_LON | ( | _payload | ) | (int32_t)__builtin_bswap32(*( int32_t*)&_payload[14-2]) |
Definition at line 69 of file gps_skytraq.c.
Definition at line 63 of file gps_skytraq.c.
Definition at line 75 of file gps_skytraq.c.
Definition at line 78 of file gps_skytraq.c.
#define SKYTRAQ_NAVIGATION_DATA_TOW | ( | _payload | ) | __builtin_bswap32(*(uint32_t*)&_payload[6-2]) |
Definition at line 66 of file gps_skytraq.c.
Definition at line 77 of file gps_skytraq.c.
Definition at line 65 of file gps_skytraq.c.
#define SKYTRAQ_SYNC1 0xA0 |
Definition at line 45 of file gps_skytraq.c.
#define SKYTRAQ_SYNC2 0xA1 |
Definition at line 46 of file gps_skytraq.c.
#define SKYTRAQ_SYNC3 0x0D |
Definition at line 48 of file gps_skytraq.c.
#define SKYTRAQ_SYNC4 0x0A |
Definition at line 49 of file gps_skytraq.c.
#define UNINIT 0 |
Definition at line 29 of file gps_skytraq.c.
Definition at line 57 of file gps_skytraq.c.
|
static |
Definition at line 273 of file gps_skytraq.c.
References MAX_DISTANCE, EcefCoor_i::x, EcefCoor_i::y, and EcefCoor_i::z.
Referenced by gps_skytraq_read_message().
void gps_skytraq_event | ( | void | ) |
Definition at line 115 of file gps_skytraq.c.
References dev, gps_skytraq, gps_skytraq_msg(), gps_skytraq_parse(), and GpsSkytraq::msg_available.
void gps_skytraq_init | ( | void | ) |
Definition at line 93 of file gps_skytraq.c.
References gps_skytraq, GpsSkytraq::status, and UNINIT.
void gps_skytraq_msg | ( | void | ) |
Definition at line 98 of file gps_skytraq.c.
References GpsState::fix, get_sys_time_usec(), GPS_FIX_3D, gps_skytraq, GPS_SKYTRAQ_ID, gps_skytraq_read_message(), GpsState::last_3dfix_ticks, GpsState::last_3dfix_time, GpsState::last_msg_ticks, GpsState::last_msg_time, GpsSkytraq::msg_available, GpsSkytraq::msg_id, sys_time::nb_sec, sys_time::nb_sec_rem, SKYTRAQ_ID_NAVIGATION_DATA, and GpsSkytraq::state.
Referenced by gps_skytraq_event().
void gps_skytraq_parse | ( | uint8_t | c | ) |
Definition at line 201 of file gps_skytraq.c.
References GpsSkytraq::checksum, GpsSkytraq::error_cnt, GpsSkytraq::error_last, GOT_CHECKSUM, GOT_ID, GOT_LEN1, GOT_LEN2, GOT_PAYLOAD, GOT_SYNC1, GOT_SYNC2, GOT_SYNC3, gps_skytraq, GPS_SKYTRAQ_ERR_CHECKSUM, GPS_SKYTRAQ_ERR_MSG_TOO_LONG, GPS_SKYTRAQ_ERR_OUT_OF_SYNC, GPS_SKYTRAQ_ERR_UNEXPECTED, GPS_SKYTRAQ_MAX_PAYLOAD, GpsSkytraq::len, GpsSkytraq::msg_available, GpsSkytraq::msg_buf, GpsSkytraq::msg_id, GpsSkytraq::msg_idx, SKYTRAQ_SYNC1, SKYTRAQ_SYNC2, SKYTRAQ_SYNC3, GpsSkytraq::status, and UNINIT.
Referenced by gps_skytraq_event().
void gps_skytraq_read_message | ( | void | ) |
Definition at line 127 of file gps_skytraq.c.
References LlaCoor_i::alt, GpsState::course, distance_too_great(), LtpDef_i::ecef, GpsState::ecef_pos, GpsState::ecef_vel, GpsState::fix, GPS_FIX_2D, GPS_FIX_3D, GPS_FIX_NONE, gps_skytraq, GPS_VALID_COURSE_BIT, GPS_VALID_HMSL_BIT, GPS_VALID_POS_ECEF_BIT, GPS_VALID_POS_LLA_BIT, GPS_VALID_VEL_ECEF_BIT, GPS_VALID_VEL_NED_BIT, GpsState::gspeed, GpsState::hmsl, LlaCoor_i::lat, LED_ON, LED_TOGGLE, GpsState::lla_pos, LlaCoor_i::lon, ltp_def_from_ecef_i(), GpsSkytraq::msg_buf, GpsSkytraq::msg_id, ned_of_ecef_vect_i(), GpsState::ned_vel, GpsState::num_sv, GpsState::pdop, GpsSkytraq::ref_ltp, SKYTRAQ_FIX_2D, SKYTRAQ_FIX_3D, SKYTRAQ_FIX_3D_DGPS, SKYTRAQ_ID_NAVIGATION_DATA, SKYTRAQ_NAVIGATION_DATA_AEL, SKYTRAQ_NAVIGATION_DATA_ASL, SKYTRAQ_NAVIGATION_DATA_ECEFVX, SKYTRAQ_NAVIGATION_DATA_ECEFVY, SKYTRAQ_NAVIGATION_DATA_ECEFVZ, SKYTRAQ_NAVIGATION_DATA_ECEFX, SKYTRAQ_NAVIGATION_DATA_ECEFY, SKYTRAQ_NAVIGATION_DATA_ECEFZ, SKYTRAQ_NAVIGATION_DATA_FixMode, SKYTRAQ_NAVIGATION_DATA_LAT, SKYTRAQ_NAVIGATION_DATA_LON, SKYTRAQ_NAVIGATION_DATA_NumSV, SKYTRAQ_NAVIGATION_DATA_PDOP, SKYTRAQ_NAVIGATION_DATA_TOW, GpsState::speed_3d, GpsSkytraq::state, GpsState::tow, GpsState::valid_fields, EcefCoor_i::x, NedCoor_i::x, EcefCoor_i::y, NedCoor_i::y, EcefCoor_i::z, and NedCoor_i::z.
Referenced by gps_skytraq_msg().
struct GpsSkytraq gps_skytraq |
Definition at line 1 of file gps_skytraq.c.
Referenced by gps_skytraq_event(), gps_skytraq_init(), gps_skytraq_msg(), gps_skytraq_parse(), and gps_skytraq_read_message().