 |
Paparazzi UAS
v6.1.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
Go to the documentation of this file.
31 #include "generated/flight_plan.h"
40 #ifndef GPS_DATALINK_USE_MAG
41 #define GPS_DATALINK_USE_MAG 1
61 llh_nav0.
lat = NAV_LAT0;
62 llh_nav0.
lon = NAV_LON0;
64 llh_nav0.
alt = NAV_ALT0 + NAV_MSL0;
95 enu_pos.
x = (
int32_t)((pos_xyz >> 21) & 0x7FF);
96 if (enu_pos.
x & 0x400) {
97 enu_pos.
x |= 0xFFFFF800;
99 enu_pos.
y = (
int32_t)((pos_xyz >> 10) & 0x7FF);
100 if (enu_pos.
y & 0x400) {
101 enu_pos.
y |= 0xFFFFF800;
103 enu_pos.
z = (
int32_t)(pos_xyz & 0x3FF);
112 enu_speed.
x = (
int32_t)((speed_xyz >> 21) & 0x7FF);
113 if (enu_speed.
x & 0x400) {
114 enu_speed.
x |= 0xFFFFF800;
116 enu_speed.
y = (
int32_t)((speed_xyz >> 10) & 0x7FF);
117 if (enu_speed.
y & 0x400) {
118 enu_speed.
y |= 0xFFFFF800;
120 enu_speed.
z = (
int32_t)((speed_xyz) & 0x3FF);
121 if (enu_speed.
z & 0x200) {
122 enu_speed.
z |= 0xFFFFFC00;
203 #if GPS_DATALINK_USE_MAG
213 float enu_xd,
float enu_yd,
float enu_zd,
264 #if GPS_DATALINK_USE_MAG
274 if (DL_REMOTE_GPS_ac_id(buf) != AC_ID) {
return; }
277 DL_REMOTE_GPS_ecef_x(buf),
278 DL_REMOTE_GPS_ecef_y(buf),
279 DL_REMOTE_GPS_ecef_z(buf),
280 DL_REMOTE_GPS_lat(buf),
281 DL_REMOTE_GPS_lon(buf),
282 DL_REMOTE_GPS_alt(buf),
283 DL_REMOTE_GPS_hmsl(buf),
284 DL_REMOTE_GPS_ecef_xd(buf),
285 DL_REMOTE_GPS_ecef_yd(buf),
286 DL_REMOTE_GPS_ecef_zd(buf),
287 DL_REMOTE_GPS_tow(buf),
288 DL_REMOTE_GPS_course(buf));
293 if (DL_REMOTE_GPS_SMALL_ac_id(buf) != AC_ID) {
return; }
296 DL_REMOTE_GPS_SMALL_pos_xyz(buf),
297 DL_REMOTE_GPS_SMALL_speed_xyz(buf),
298 DL_REMOTE_GPS_SMALL_tow(buf));
303 if (DL_REMOTE_GPS_LOCAL_ac_id(buf) != AC_ID) {
return; }
306 DL_REMOTE_GPS_LOCAL_enu_y(buf),
307 DL_REMOTE_GPS_LOCAL_enu_z(buf),
308 DL_REMOTE_GPS_LOCAL_enu_xd(buf),
309 DL_REMOTE_GPS_LOCAL_enu_yd(buf),
310 DL_REMOTE_GPS_LOCAL_enu_zd(buf),
311 DL_REMOTE_GPS_LOCAL_tow(buf),
312 DL_REMOTE_GPS_LOCAL_course(buf));
int32_t lon
in degrees*1e7
uint8_t valid_fields
bitfield indicating valid fields (GPS_VALID_x_BIT)
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
#define VECT3_NED_OF_ENU(_o, _i)
int32_t alt
in millimeters above WGS84 reference ellipsoid
#define GPS_VALID_COURSE_BIT
#define MAG_DATALINK_SENDER_ID
void lla_of_ecef_i(struct LlaCoor_i *out, struct EcefCoor_i *in)
Convert a ECEF to LLA.
uint32_t tow
GPS time of week in ms.
definition of the local (flat earth) coordinate system
static void send_magnetometer(int32_t course, uint32_t now_ts)
data structure for GPS information
uint32_t pacc
position accuracy in cm
uint32_t sacc
speed accuracy in cm/s
void ecef_of_enu_vect_i(struct EcefCoor_i *ecef, struct LtpDef_i *def, struct EnuCoor_i *enu)
Rotate a vector from ENU to ECEF.
#define FLOAT_VECT3_NORM(_v)
void gps_datalink_parse_REMOTE_GPS_SMALL(uint8_t *buf)
struct NedCoor_i ned_vel
speed NED in cm/s
#define GPS_VALID_POS_LLA_BIT
uint32_t get_sys_time_usec(void)
Get the time in microseconds since startup.
int32_t lat
in degrees*1e7
short int16_t
Typedef defining 16 bit short type.
uint32_t last_msg_ticks
cpu time ticks at last received GPS message
Device independent GPS code (interface)
uint16_t speed_3d
norm of 3d speed in cm/s
#define FLOAT_VECT2_NORM(_v)
void gps_datalink_parse_REMOTE_GPS_LOCAL(uint8_t *buf)
uint16_t gspeed
norm of 2d ground speed in cm/s
void gps_datalink_parse_REMOTE_GPS(uint8_t *buf)
static void parse_gps_datalink_small(int16_t heading, uint32_t pos_xyz, uint32_t speed_xyz, uint32_t tow)
uint32_t last_3dfix_time
cpu time in sec at last valid 3D fix
uint32_t last_3dfix_ticks
cpu time ticks at last valid 3D fix
static void parse_gps_datalink(uint8_t numsv, int32_t ecef_x, int32_t ecef_y, int32_t ecef_z, int32_t lat, int32_t lon, int32_t alt, int32_t hmsl, int32_t ecef_xd, int32_t ecef_yd, int32_t ecef_zd, uint32_t tow, int32_t course)
Parse the REMOTE_GPS datalink packet.
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.
uint8_t comp_id
id of current gps
void ltp_def_from_lla_i(struct LtpDef_i *def, struct LlaCoor_i *lla)
struct Imu imu
global IMU state
Common code for AP and FBW telemetry.
int32_t course
GPS course over ground in rad*1e7, [0, 2*Pi]*1e7 (CW/north)
uint32_t last_msg_time
cpu time in sec at last received GPS message
struct EcefCoor_i ecef_pos
position in ECEF in cm
int int32_t
Typedef defining 32 bit int type.
#define GPS_VALID_VEL_NED_BIT
vector in Latitude, Longitude and Altitude
void gps_datalink_init(void)
GPS initialization.
struct LlaCoor_i lla_pos
position in LLA (lat,lon: deg*1e7; alt: mm over ellipsoid)
int32_t hmsl
Height above mean sea level in mm.
#define GPS_VALID_VEL_ECEF_BIT
void imu_scale_mag(struct Imu *_imu)
uint8_t num_sv
number of sat in fix
volatile uint32_t nb_sec_rem
remainder of seconds since startup in CPU_TICKS
static void parse_gps_datalink_local(float enu_x, float enu_y, float enu_z, float enu_xd, float enu_yd, float enu_zd, uint32_t tow, float course)
Parse the REMOTE_GPS_LOCAL datalink packet.
int32_t hmsl
height above mean sea level (MSL) in mm
struct GpsState gps_datalink
#define GPS_DATALINK_USE_MAG
Set to 1 to receive also magnetometer ABI messages.
uint16_t pdop
position dilution of precision scaled by 100
void ecef_of_enu_point_i(struct EcefCoor_i *ecef, struct LtpDef_i *def, struct EnuCoor_i *enu)
Convert a point in local ENU to ECEF.
struct Int32Vect3 mag_unscaled
unscaled magnetometer measurements
Handling of messages coming from ground and other A/Cs.
#define GPS_VALID_POS_ECEF_BIT
uint32_t cacc
course accuracy in rad*1e7
volatile uint32_t nb_sec
full seconds since startup
struct EcefCoor_i ecef_vel
speed ECEF in cm/s
#define GPS_FIX_NONE
No GPS fix.
#define GPS_FIX_3D
3D GPS fix
vector in East North Up coordinates
#define GPS_VALID_HMSL_BIT
#define VECT3_COPY(_a, _b)
#define MAGS_BFP_OF_REAL(_ef, _ei)