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);
Main include for ABI (AirBorneInterface).
uint32_t get_sys_time_usec(void)
Get the time in microseconds since startup.
Device independent GPS code (interface)
uint32_t tow
GPS time of week in ms.
int32_t hmsl
height above mean sea level (MSL) in mm
struct LlaCoor_i lla_pos
position in LLA (lat,lon: deg*1e7; alt: mm over ellipsoid)
int32_t course
GPS course over ground in rad*1e7, [0, 2*Pi]*1e7 (CW/north)
#define GPS_VALID_VEL_ECEF_BIT
#define GPS_VALID_VEL_NED_BIT
struct EcefCoor_i ecef_pos
position in ECEF in cm
#define GPS_VALID_POS_LLA_BIT
uint32_t last_3dfix_ticks
cpu time ticks at last valid 3D fix
struct EcefCoor_i ecef_vel
speed ECEF in cm/s
uint16_t pdop
position dilution of precision scaled by 100
#define GPS_FIX_NONE
No GPS fix.
#define GPS_VALID_POS_ECEF_BIT
#define GPS_VALID_HMSL_BIT
struct NedCoor_i ned_vel
speed NED in cm/s
uint32_t last_msg_time
cpu time in sec at last received GPS message
uint32_t last_3dfix_time
cpu time in sec at last valid 3D fix
uint16_t gspeed
norm of 2d ground speed in cm/s
uint8_t valid_fields
bitfield indicating valid fields (GPS_VALID_x_BIT)
#define GPS_FIX_2D
2D GPS fix
#define GPS_FIX_3D
3D GPS fix
uint16_t speed_3d
norm of 3d speed in cm/s
#define GPS_VALID_COURSE_BIT
uint32_t last_msg_ticks
cpu time ticks at last received GPS message
uint8_t num_sv
number of sat in fix
#define SKYTRAQ_NAVIGATION_DATA_ECEFX(_payload)
#define SKYTRAQ_NAVIGATION_DATA_TOW(_payload)
#define SKYTRAQ_NAVIGATION_DATA_ECEFVZ(_payload)
#define SKYTRAQ_FIX_3D_DGPS
#define SKYTRAQ_NAVIGATION_DATA_AEL(_payload)
static uint16_t bswap16(uint16_t a)
#define SKYTRAQ_NAVIGATION_DATA_ECEFY(_payload)
#define SKYTRAQ_NAVIGATION_DATA_ECEFVX(_payload)
#define SKYTRAQ_NAVIGATION_DATA_PDOP(_payload)
#define SKYTRAQ_NAVIGATION_DATA_LAT(_payload)
void gps_skytraq_init(void)
void gps_skytraq_event(void)
void gps_skytraq_read_message(void)
#define SKYTRAQ_NAVIGATION_DATA_NumSV(_payload)
#define SKYTRAQ_NAVIGATION_DATA_FixMode(_payload)
#define SKYTRAQ_NAVIGATION_DATA_ECEFZ(_payload)
void gps_skytraq_msg(void)
void gps_skytraq_parse(uint8_t c)
struct GpsSkytraq gps_skytraq
static int distance_too_great(struct EcefCoor_i *ecef_ref, struct EcefCoor_i *ecef_pos)
#define SKYTRAQ_NAVIGATION_DATA_ASL(_payload)
#define SKYTRAQ_NAVIGATION_DATA_LON(_payload)
#define SKYTRAQ_NAVIGATION_DATA_ECEFVY(_payload)
#define SKYTRAQ_ID_NAVIGATION_DATA
#define GPS_SKYTRAQ_MAX_PAYLOAD
enum GpsSkytraqError error_last
uint8_t msg_buf[GPS_SKYTRAQ_MAX_PAYLOAD]
@ GPS_SKYTRAQ_ERR_UNEXPECTED
@ GPS_SKYTRAQ_ERR_MSG_TOO_LONG
@ GPS_SKYTRAQ_ERR_CHECKSUM
@ GPS_SKYTRAQ_ERR_OUT_OF_SYNC
int32_t lat
in degrees*1e7
int32_t alt
in millimeters above WGS84 reference ellipsoid
struct EcefCoor_i ecef
Reference point in ecef.
int32_t lon
in degrees*1e7
void ltp_def_from_ecef_i(struct LtpDef_i *def, struct EcefCoor_i *ecef)
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.
vector in EarthCenteredEarthFixed coordinates
arch independent LED (Light Emitting Diodes) API
static const struct usb_device_descriptor dev
volatile uint32_t nb_sec
full seconds since startup
volatile uint32_t nb_sec_rem
remainder of seconds since startup in CPU_TICKS
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
int int32_t
Typedef defining 32 bit int type.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.