42 #define GOT_CHECKSUM 7
45 #define SKYTRAQ_FIX_NONE 0x00
46 #define SKYTRAQ_FIX_2D 0x01
47 #define SKYTRAQ_FIX_3D 0x02
48 #define SKYTRAQ_FIX_3D_DGPS 0x03
51 #define SKYTRAQ_SYNC1 0xA0
52 #define SKYTRAQ_SYNC2 0xA1
54 #define SKYTRAQ_SYNC3 0x0D
55 #define SKYTRAQ_SYNC4 0x0A
60 return (a << 8) | (a >> 8);
63 #define SKYTRAQ_NAVIGATION_DATA_FixMode(_payload) (uint8_t) (*((uint8_t*)_payload+2-2))
64 #define SKYTRAQ_NAVIGATION_DATA_NumSV(_payload) (uint8_t) (*((uint8_t*)_payload+3-2))
66 #define SKYTRAQ_NAVIGATION_DATA_WEEK(_payload) bswap16(*(uint16_t*)&_payload[4-2])
67 #define SKYTRAQ_NAVIGATION_DATA_TOW(_payload) __builtin_bswap32(*(uint32_t*)&_payload[6-2])
69 #define SKYTRAQ_NAVIGATION_DATA_LAT(_payload) (int32_t)__builtin_bswap32(*( int32_t*)&_payload[10-2])
70 #define SKYTRAQ_NAVIGATION_DATA_LON(_payload) (int32_t)__builtin_bswap32(*( int32_t*)&_payload[14-2])
72 #define SKYTRAQ_NAVIGATION_DATA_AEL(_payload) __builtin_bswap32(*(uint32_t*)&_payload[18-2])
73 #define SKYTRAQ_NAVIGATION_DATA_ASL(_payload) __builtin_bswap32(*(uint32_t*)&_payload[22-2])
75 #define SKYTRAQ_NAVIGATION_DATA_GDOP(_payload) bswap16(*(uint16_t*)&_payload[26-2])
76 #define SKYTRAQ_NAVIGATION_DATA_PDOP(_payload) bswap16(*(uint16_t*)&_payload[28-2])
77 #define SKYTRAQ_NAVIGATION_DATA_HDOP(_payload) bswap16(*(uint16_t*)&_payload[30-2])
78 #define SKYTRAQ_NAVIGATION_DATA_VDOP(_payload) bswap16(*(uint16_t*)&_payload[32-2])
79 #define SKYTRAQ_NAVIGATION_DATA_TDOP(_payload) bswap16(*(uint16_t*)&_payload[34-2])
81 #define SKYTRAQ_NAVIGATION_DATA_ECEFX(_payload) (int32_t)__builtin_bswap32(*(uint32_t*)&_payload[36-2])
82 #define SKYTRAQ_NAVIGATION_DATA_ECEFY(_payload) (int32_t)__builtin_bswap32(*(uint32_t*)&_payload[40-2])
83 #define SKYTRAQ_NAVIGATION_DATA_ECEFZ(_payload) (int32_t)__builtin_bswap32(*(uint32_t*)&_payload[44-2])
84 #define SKYTRAQ_NAVIGATION_DATA_ECEFVX(_payload) (int32_t)__builtin_bswap32(*(uint32_t*)&_payload[48-2])
85 #define SKYTRAQ_NAVIGATION_DATA_ECEFVY(_payload) (int32_t)__builtin_bswap32(*(uint32_t*)&_payload[52-2])
86 #define SKYTRAQ_NAVIGATION_DATA_ECEFVZ(_payload) (int32_t)__builtin_bswap32(*(uint32_t*)&_payload[56-2])
90 #define MAX_DISTANCE 1000000
272 int32_t xdiff = abs(ecef_ref->
x - ecef_pos->
x);
276 int32_t ydiff = abs(ecef_ref->
y - ecef_pos->
y);
280 int32_t zdiff = abs(ecef_ref->
z - ecef_pos->
z);
int32_t north
in centimeters
#define SKYTRAQ_NAVIGATION_DATA_ASL(_payload)
void gps_impl_init(void)
GPS initialization.
enum GpsSkytraqError error_last
vector in EarthCenteredEarthFixed coordinates
#define SKYTRAQ_NAVIGATION_DATA_ECEFVY(_payload)
uint8_t msg_buf[GPS_SKYTRAQ_MAX_PAYLOAD]
Main include for ABI (AirBorneInterface).
position in UTM coordinates Units: meters
int32_t east
in centimeters
uint16_t speed_3d
norm of 3d speed in cm/s
#define GPS_FIX_3D
3D GPS fix
struct UtmCoor_i utm_pos
position in UTM (north,east: cm; alt: mm over ellipsoid)
#define SKYTRAQ_NAVIGATION_DATA_LON(_payload)
void ned_of_ecef_vect_i(struct NedCoor_i *ned, struct LtpDef_i *def, struct EcefCoor_i *ecef)
Rotate a vector from ECEF to NED.
#define SKYTRAQ_NAVIGATION_DATA_AEL(_payload)
#define SKYTRAQ_NAVIGATION_DATA_ECEFY(_payload)
struct EcefCoor_i ecef
Reference point in ecef.
uint32_t last_3dfix_ticks
cpu time ticks at last valid 3D fix
int32_t alt
in millimeters above WGS84 reference ellipsoid
static uint32_t get_sys_time_usec(void)
Get the time in microseconds since startup.
uint32_t last_msg_time
cpu time in sec at last received GPS message
uint8_t zone
UTM zone number.
Paparazzi floating point math for geodetic calculations.
vector in Latitude, Longitude and Altitude
int32_t hmsl
height above mean sea level in mm
uint32_t tow
GPS time of week in ms.
#define GPS_FIX_NONE
No GPS fix.
#define GPS_FIX_2D
2D GPS fix
#define SKYTRAQ_ID_NAVIGATION_DATA
Device independent GPS code (interface)
uint16_t pdop
position dilution of precision scaled by 100
#define SKYTRAQ_NAVIGATION_DATA_ECEFX(_payload)
void gps_skytraq_read_message(void)
#define SKYTRAQ_NAVIGATION_DATA_ECEFVZ(_payload)
#define SKYTRAQ_FIX_3D_DGPS
struct EcefCoor_i ecef_pos
position in ECEF in cm
int32_t lon
in degrees*1e7
uint8_t zone
UTM zone number.
volatile uint32_t nb_sec_rem
remainder of seconds since startup in CPU_TICKS
#define GPS_SKYTRAQ_MAX_PAYLOAD
#define SKYTRAQ_NAVIGATION_DATA_ECEFZ(_payload)
uint32_t last_3dfix_time
cpu time in sec at last valid 3D fix
int32_t alt
in millimeters above WGS84 reference ellipsoid
static int distance_too_great(struct EcefCoor_i *ecef_ref, struct EcefCoor_i *ecef_pos)
int32_t course
GPS course over ground in rad*1e7, [0, 2*Pi]*1e7 (CW/north)
volatile uint32_t nb_sec
full seconds since startup
#define SKYTRAQ_NAVIGATION_DATA_ECEFVX(_payload)
#define SKYTRAQ_NAVIGATION_DATA_PDOP(_payload)
void gps_skytraq_parse(uint8_t c)
#define SKYTRAQ_NAVIGATION_DATA_LAT(_payload)
#define SKYTRAQ_NAVIGATION_DATA_NumSV(_payload)
uint32_t last_msg_ticks
cpu time ticks at last received GPS message
uint8_t num_sv
number of sat in fix
arch independent LED (Light Emitting Diodes) API
uint16_t gspeed
norm of 2d ground speed in cm/s
struct EcefCoor_i ecef_vel
speed ECEF in cm/s
struct GpsSkytraq gps_skytraq
struct LlaCoor_i lla_pos
position in LLA (lat,lon: deg*1e7; alt: mm over ellipsoid)
static uint16_t bswap16(uint16_t a)
#define SKYTRAQ_NAVIGATION_DATA_FixMode(_payload)
int32_t lat
in degrees*1e7
void gps_skytraq_msg(void)
struct NedCoor_i ned_vel
speed NED in cm/s
struct GpsState gps
global GPS state
#define LLA_FLOAT_OF_BFP(_o, _i)
void ltp_def_from_ecef_i(struct LtpDef_i *def, struct EcefCoor_i *ecef)
void utm_of_lla_f(struct UtmCoor_f *utm, struct LlaCoor_f *lla)
#define SKYTRAQ_NAVIGATION_DATA_TOW(_payload)