29 #include "generated/airframe.h"
30 #include "generated/flight_plan.h"
33 #include "pprzlink/dl_protocol.h"
34 #include "pprzlink/messages.h"
78 uint8_t sender_id = SenderIdOfPprzMsg(buf);
79 uint8_t msg_id = IdOfPprzMsg(buf);
82 #if PPRZLINK_DEFAULT_VER == 2
83 if (pprzlink_get_msg_class_id(buf) == DL_telemetry_CLASS_ID) {
89 uint32_t multiplex_speed = DL_GPS_SMALL_multiplex_speed(buf);
107 DL_GPS_SMALL_lat(buf),
108 DL_GPS_SMALL_lon(buf),
109 (
int32_t)DL_GPS_SMALL_alt(buf) * 10,
118 DL_GPS_utm_east(buf),
119 DL_GPS_utm_north(buf),
121 DL_GPS_utm_zone(buf),
133 DL_GPS_LLA_course(buf),
134 DL_GPS_LLA_speed(buf),
135 DL_GPS_LLA_climb(buf),
136 DL_GPS_LLA_itow(buf));
147 DL_ACINFO_utm_east(buf),
148 DL_ACINFO_utm_north(buf),
149 DL_ACINFO_alt(buf) * 10,
150 DL_ACINFO_utm_zone(buf),
151 DL_ACINFO_course(buf),
152 DL_ACINFO_speed(buf),
153 DL_ACINFO_climb(buf),
154 DL_ACINFO_itow(buf));
157 case DL_ACINFO_LLA: {
159 DL_ACINFO_LLA_lat(buf),
160 DL_ACINFO_LLA_lon(buf),
161 DL_ACINFO_LLA_alt(buf) * 10,
162 DL_ACINFO_LLA_course(buf),
163 DL_ACINFO_LLA_speed(buf),
164 DL_ACINFO_LLA_climb(buf),
165 DL_ACINFO_LLA_itow(buf));
188 if (utm_zone == my_zone) {
196 struct UtmCoor_i utm = {.
east = utm_east, .north = utm_north, .alt =
alt, .zone = utm_zone};
Handling of messages coming from ground and other A/Cs.
struct GpsState gps
global GPS state
uint32_t gps_tow_from_sys_ticks(uint32_t sys_ticks)
Convert time in sys_time ticks to GPS time of week.
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)
#define GPS_VALID_POS_LLA_BIT
#define GPS_VALID_HMSL_BIT
uint8_t valid_fields
bitfield indicating valid fields (GPS_VALID_x_BIT)
struct LlaCoor_f lla_pos_f
Position in Latitude, Longitude and Altitude.
struct EnuCoor_f enu_vel_f
speed in North East Down coordinates
struct LlaCoor_i lla_pos_i
Position in Latitude, Longitude and Altitude.
struct UtmCoor_i utm_pos_i
Position in UTM coordinates.
uint16_t status
Holds the status bits for all acinfo position and velocity representations.
struct UtmCoor_f utm_pos_f
Position in UTM coordinates.
struct EnuCoor_i enu_pos_i
Position in North East Down coordinates.
#define AC_INFO_VEL_ENU_I
bool parse_acinfo_dl(uint8_t *buf)
Parse all datalink or telemetry messages that contain global position of other acs Messages currently...
#define AC_INFO_POS_LLA_I
#define AC_INFO_VEL_ENU_F
void set_ac_info_utm(uint8_t id, uint32_t utm_east, uint32_t utm_north, uint32_t alt, uint8_t utm_zone, uint16_t course, uint16_t gspeed, uint16_t climb, uint32_t itow)
Set Aircraft info.
void acInfoCalcPositionUtm_f(uint8_t ac_id)
#define AC_INFO_POS_LLA_F
void acInfoCalcPositionEnu_f(uint8_t ac_id)
void acInfoCalcVelocityEnu_f(uint8_t ac_id)
void acInfoCalcPositionUtm_i(uint8_t ac_id)
void acInfoCalcPositionLla_i(uint8_t ac_id)
void acInfoCalcPositionLla_f(uint8_t ac_id)
void set_ac_info_lla(uint8_t id, int32_t lat, int32_t lon, int32_t alt, int16_t course, uint16_t gspeed, int16_t climb, uint32_t itow)
Set Aircraft info.
static struct UtmCoor_f * acInfoGetPositionUtm_f(uint8_t ac_id)
Get position from UTM coordinates (float).
#define AC_INFO_POS_ENU_F
static struct LlaCoor_f * acInfoGetPositionLla_f(uint8_t ac_id)
Get position from LLA coordinates (float).
#define AC_INFO_POS_UTM_F
#define AC_INFO_POS_UTM_I
#define AC_INFO_POS_ENU_I
void traffic_info_init(void)
#define AC_INFO_VEL_LOCAL_F
struct acInfo ti_acs[NB_ACS]
uint8_t ti_acs_id[NB_ACS_ID]
void acInfoCalcPositionEnu_i(uint8_t ac_id)
void acInfoCalcVelocityEnu_i(uint8_t ac_id)
static struct LlaCoor_i * acInfoGetPositionLla_i(uint8_t ac_id)
Get position from LLA coordinates (int).
#define SPEEDS_BFP_OF_REAL(_ef, _ei)
#define SPEEDS_FLOAT_OF_BFP(_ef, _ei)
#define POS_BFP_OF_REAL(_af)
#define LLA_COPY(_pos1, _pos2)
#define ENU_OF_UTM_DIFF(_pos, _utm1, _utm2)
#define UTM_COPY(_u1, _u2)
int32_t lat
in degrees*1e7
int32_t alt
in millimeters (above WGS84 reference ellipsoid or above MSL)
int32_t alt
in millimeters above WGS84 reference ellipsoid
uint8_t zone
UTM zone number.
int32_t east
in centimeters
int32_t lon
in degrees*1e7
int32_t north
in centimeters
#define ENU_FLOAT_OF_BFP(_o, _i)
void lla_of_utm_i(struct LlaCoor_i *lla, struct UtmCoor_i *utm)
Convert a UTM to LLA.
#define ENU_BFP_OF_REAL(_o, _i)
#define LLA_BFP_OF_REAL(_o, _i)
#define UTM_BFP_OF_REAL(_o, _i)
void enu_of_lla_point_i(struct EnuCoor_i *enu, struct LtpDef_i *def, struct LlaCoor_i *lla)
Convert a point from LLA to local ENU.
#define LLA_FLOAT_OF_BFP(_o, _i)
void utm_of_lla_i(struct UtmCoor_i *utm, struct LlaCoor_i *lla)
Convert a LLA to UTM.
#define UTM_FLOAT_OF_BFP(_o, _i)
vector in East North Up coordinates
vector in Latitude, Longitude and Altitude
position in UTM coordinates
static int32_t wgs84_ellipsoid_to_geoid_i(int32_t lat, int32_t lon)
Get WGS84 ellipsoid/geoid separation.
struct LtpDef_f ned_origin_f
Definition of the local (flat earth) coordinate system.
struct LtpDef_i ned_origin_i
Definition of the local (flat earth) coordinate system.
bool utm_initialized_f
True if utm origin (float) coordinate frame is initialsed.
bool ned_initialized_i
true if local int coordinate frame is initialsed
struct UtmCoor_f utm_origin_f
Definition of the origin of Utm coordinate system.
void lla_of_utm_f(struct LlaCoor_f *lla, struct UtmCoor_f *utm)
void enu_of_lla_point_f(struct EnuCoor_f *enu, struct LtpDef_f *def, struct LlaCoor_f *lla)
void utm_of_lla_f(struct UtmCoor_f *utm, struct LlaCoor_f *lla)
float alt
in meters (normally above WGS84 reference ellipsoid)
float alt
in meters (above WGS84 reference ellipsoid or above MSL)
uint8_t zone
UTM zone number.
Constants UTM (Mercator) projections.
API to get/set the generic vehicle states.
volatile uint32_t nb_tick
SYS_TIME_TICKS since startup.
static void update_geoid_height(void)
Update estimate of the geoid height Requires an available hsml and/or lla measurement,...
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.
short int16_t
Typedef defining 16 bit short type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.