26 #include "pprzlink/pprzlink_device.h"
36 #define GOT_CHECKSUM 7
39 #define SKYTRAQ_FIX_NONE 0x00
40 #define SKYTRAQ_FIX_2D 0x01
41 #define SKYTRAQ_FIX_3D 0x02
42 #define SKYTRAQ_FIX_3D_DGPS 0x03
45 #define SKYTRAQ_SYNC1 0xA0
46 #define SKYTRAQ_SYNC2 0xA1
48 #define SKYTRAQ_SYNC3 0x0D
49 #define SKYTRAQ_SYNC4 0x0A
59 return (a << 8) | (a >> 8);
62 #define SKYTRAQ_NAVIGATION_DATA_FixMode(_payload) (uint8_t) (*((uint8_t*)_payload+2-2))
63 #define SKYTRAQ_NAVIGATION_DATA_NumSV(_payload) (uint8_t) (*((uint8_t*)_payload+3-2))
65 #define SKYTRAQ_NAVIGATION_DATA_WEEK(_payload) bswap16(*(uint16_t*)&_payload[4-2])
66 #define SKYTRAQ_NAVIGATION_DATA_TOW(_payload) __builtin_bswap32(*(uint32_t*)&_payload[6-2])
68 #define SKYTRAQ_NAVIGATION_DATA_LAT(_payload) (int32_t)__builtin_bswap32(*( int32_t*)&_payload[10-2])
69 #define SKYTRAQ_NAVIGATION_DATA_LON(_payload) (int32_t)__builtin_bswap32(*( int32_t*)&_payload[14-2])
71 #define SKYTRAQ_NAVIGATION_DATA_AEL(_payload) __builtin_bswap32(*(uint32_t*)&_payload[18-2])
72 #define SKYTRAQ_NAVIGATION_DATA_ASL(_payload) __builtin_bswap32(*(uint32_t*)&_payload[22-2])
74 #define SKYTRAQ_NAVIGATION_DATA_GDOP(_payload) bswap16(*(uint16_t*)&_payload[26-2])
75 #define SKYTRAQ_NAVIGATION_DATA_PDOP(_payload) bswap16(*(uint16_t*)&_payload[28-2])
76 #define SKYTRAQ_NAVIGATION_DATA_HDOP(_payload) bswap16(*(uint16_t*)&_payload[30-2])
77 #define SKYTRAQ_NAVIGATION_DATA_VDOP(_payload) bswap16(*(uint16_t*)&_payload[32-2])
78 #define SKYTRAQ_NAVIGATION_DATA_TDOP(_payload) bswap16(*(uint16_t*)&_payload[34-2])
80 #define SKYTRAQ_NAVIGATION_DATA_ECEFX(_payload) (int32_t)__builtin_bswap32(*(uint32_t*)&_payload[36-2])
81 #define SKYTRAQ_NAVIGATION_DATA_ECEFY(_payload) (int32_t)__builtin_bswap32(*(uint32_t*)&_payload[40-2])
82 #define SKYTRAQ_NAVIGATION_DATA_ECEFZ(_payload) (int32_t)__builtin_bswap32(*(uint32_t*)&_payload[44-2])
83 #define SKYTRAQ_NAVIGATION_DATA_ECEFVX(_payload) (int32_t)__builtin_bswap32(*(uint32_t*)&_payload[48-2])
84 #define SKYTRAQ_NAVIGATION_DATA_ECEFVY(_payload) (int32_t)__builtin_bswap32(*(uint32_t*)&_payload[52-2])
85 #define SKYTRAQ_NAVIGATION_DATA_ECEFVZ(_payload) (int32_t)__builtin_bswap32(*(uint32_t*)&_payload[56-2])
89 #define MAX_DISTANCE 1000000
117 struct link_device *
dev = &((SKYTRAQ_GPS_LINK).device);
119 while (dev->char_available(dev->periph)) {
275 int32_t xdiff = abs(ecef_ref->
x - ecef_pos->
x);
279 int32_t ydiff = abs(ecef_ref->
y - ecef_pos->
y);
283 int32_t zdiff = abs(ecef_ref->
z - ecef_pos->
z);
#define SKYTRAQ_NAVIGATION_DATA_ASL(_payload)
enum GpsSkytraqError error_last
#define GPS_VALID_VEL_NED_BIT
vector in EarthCenteredEarthFixed coordinates
uint8_t valid_fields
bitfield indicating valid fields (GPS_VALID_x_BIT)
#define SKYTRAQ_NAVIGATION_DATA_ECEFVY(_payload)
uint8_t msg_buf[GPS_SKYTRAQ_MAX_PAYLOAD]
Main include for ABI (AirBorneInterface).
uint16_t speed_3d
norm of 3d speed in cm/s
#define GPS_FIX_3D
3D GPS fix
void gps_skytraq_event(void)
#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
void gps_skytraq_init(void)
int32_t alt
in millimeters above WGS84 reference ellipsoid
uint32_t last_msg_time
cpu time in sec at last received GPS message
#define GPS_VALID_COURSE_BIT
int32_t hmsl
height above mean sea level (MSL) 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
#define GPS_VALID_HMSL_BIT
int32_t lon
in degrees*1e7
volatile uint32_t nb_sec_rem
remainder of seconds since startup in CPU_TICKS
#define GPS_SKYTRAQ_MAX_PAYLOAD
static const struct usb_device_descriptor dev
#define SKYTRAQ_NAVIGATION_DATA_ECEFZ(_payload)
uint32_t last_3dfix_time
cpu time in sec at last valid 3D fix
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)
#define GPS_VALID_POS_ECEF_BIT
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
#define GPS_VALID_POS_LLA_BIT
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
#define GPS_VALID_VEL_ECEF_BIT
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)
uint32_t get_sys_time_usec(void)
Get the time in microseconds since startup.
int32_t lat
in degrees*1e7
void gps_skytraq_msg(void)
struct NedCoor_i ned_vel
speed NED in cm/s
void ltp_def_from_ecef_i(struct LtpDef_i *def, struct EcefCoor_i *ecef)
#define SKYTRAQ_NAVIGATION_DATA_TOW(_payload)