Paparazzi UAS  v4.0.4_stable-3-gf39211a
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ap_downlink.h File Reference

Set of macros defining the periodic telemetry messages of AP process. More...

#include <inttypes.h>
#include "generated/airframe.h"
#include "subsystems/datalink/downlink.h"
#include "messages.h"
#include "generated/periodic_telemetry.h"
#include "firmwares/fixedwing/stabilization/stabilization_adaptive.h"
+ Include dependency graph for ap_downlink.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define DOWNLINK_DEVICE   DOWNLINK_AP_DEVICE
 
#define Downlink(x)   {}
 
#define PERIODIC_SEND_ALIVE(_trans, _dev)   DOWNLINK_SEND_ALIVE(_trans, _dev, 16, MD5SUM);
 
#define PERIODIC_SEND_BAT(_trans, _dev)
 
#define PERIODIC_SEND_DEBUG_MCU_LINK(_trans, _dev)   {}
 
#define PERIODIC_SEND_DOWNLINK(_trans, _dev)
 
#define PERIODIC_SEND_ATTITUDE(_trans, _dev)
 
#define PERIODIC_SEND_DESIRED(_trans, _dev)   DOWNLINK_SEND_DESIRED(_trans, _dev, &h_ctl_roll_setpoint, &h_ctl_pitch_loop_setpoint, &h_ctl_course_setpoint, &desired_x, &desired_y, &v_ctl_altitude_setpoint, &v_ctl_climb_setpoint);
 
#define PERIODIC_SEND_STATE_FILTER_STATUS(_trans, _dev)   {}
 
#define PERIODIC_SEND_NAVIGATION_REF(_trans, _dev)   DOWNLINK_SEND_NAVIGATION_REF(_trans, _dev, &nav_utm_east0, &nav_utm_north0, &nav_utm_zone0);
 
#define DownlinkSendWp(_trans, _dev, i)
 
#define PERIODIC_SEND_WP_MOVED(_trans, _dev)
 
#define PERIODIC_SEND_PPRZ_MODE(_trans, _dev)
 
#define PERIODIC_SEND_SETTINGS(_trans, _dev)   {}
 
#define PERIODIC_SEND_IR_SENSORS(_trans, _dev)   ;
 
#define PERIODIC_SEND_ADC(_trans, _dev)   {}
 
#define PERIODIC_SEND_CALIBRATION(_trans, _dev)   DOWNLINK_SEND_CALIBRATION(_trans, _dev, &v_ctl_auto_throttle_sum_err, &v_ctl_auto_throttle_submode)
 
#define PERIODIC_SEND_CIRCLE(_trans, _dev)   if (nav_in_circle) { DOWNLINK_SEND_CIRCLE(_trans, _dev, &nav_circle_x, &nav_circle_y, &nav_circle_radius); }
 
#define PERIODIC_SEND_SEGMENT(_trans, _dev)   if (nav_in_segment) { DOWNLINK_SEND_SEGMENT(_trans, _dev, &nav_segment_x_1, &nav_segment_y_1, &nav_segment_x_2, &nav_segment_y_2); }
 
#define PERIODIC_SEND_IMU_ACCEL_RAW(_trans, _dev)   {}
 
#define PERIODIC_SEND_IMU_GYRO_RAW(_trans, _dev)   {}
 
#define PERIODIC_SEND_IMU_MAG_RAW(_trans, _dev)   {}
 
#define PERIODIC_SEND_IMU_ACCEL(_trans, _dev)   {}
 
#define PERIODIC_SEND_IMU_GYRO(_trans, _dev)   {}
 
#define PERIODIC_SEND_IMU_MAG(_trans, _dev)   {}
 
#define PERIODIC_SEND_IMU(_trans, _dev)   {}
 
#define PERIODIC_SEND_ESTIMATOR(_trans, _dev)   DOWNLINK_SEND_ESTIMATOR(_trans, _dev, &estimator_z, &estimator_z_dot)
 
#define SEND_NAVIGATION(_trans, _dev)   Downlink({ uint8_t _circle_count = NavCircleCount(); DOWNLINK_SEND_NAVIGATION(_trans, _dev, &nav_block, &nav_stage, &estimator_x, &estimator_y, &dist2_to_wp, &dist2_to_home, &_circle_count, &nav_oval_count);})
 
#define PERIODIC_SEND_NAVIGATION(_trans, _dev)   SEND_NAVIGATION(_trans, _dev)
 
#define SEND_CAM(_trans, _dev)   {}
 
#define PERIODIC_SEND_CAM_POINT(_trans, _dev)   {}
 
#define PERIODIC_SEND_DL_VALUE(_trans, _dev)   PeriodicSendDlValue(_trans, _dev) /** generated from the xml settings config in conf/settings */
 
#define PERIODIC_SEND_SURVEY(_trans, _dev)
 
#define PERIODIC_SEND_RANGEFINDER(_trans, _dev)   DOWNLINK_SEND_RANGEFINDER(_trans, _dev, &rangemeter, &ctl_grz_z_dot, &ctl_grz_z_dot_sum_err, &ctl_grz_z_dot_setpoint, &ctl_grz_z_sum_err, &ctl_grz_z_setpoint, &flying)
 
#define PERIODIC_SEND_TUNE_ROLL(_trans, _dev)   DOWNLINK_SEND_TUNE_ROLL(_trans, _dev, &estimator_p,&estimator_phi, &h_ctl_roll_setpoint);
 
#define PERIODIC_SEND_GPS(_trans, _dev)
 
#define PERIODIC_SEND_BARO_MS5534A(_trans, _dev)   {}
 
#define PERIODIC_SEND_SCP_STATUS(_trans, _dev)   {}
 
#define PERIODIC_SEND_BARO_RAW(_trans, _dev)   {}
 
#define PERIODIC_SEND_AIRSPEED(_trans, _dev)   {}
 
#define PERIODIC_SEND_ENERGY(_trans, _dev)   Downlink({ const int16_t e = energy; const float vsup = ((float)vsupply) / 10.0f; const float curs = ((float) current)/1000.0f; const float power = vsup * curs; DOWNLINK_SEND_ENERGY(_trans, _dev, &vsup, &curs, &e, &power); })
 
#define PERIODIC_SEND_H_CTL_A(_trans, _dev)   DOWNLINK_SEND_H_CTL_A(_trans, _dev, &h_ctl_roll_sum_err, &h_ctl_ref_roll_angle, &h_ctl_pitch_sum_err, &h_ctl_ref_pitch_angle)
 

Detailed Description

Set of macros defining the periodic telemetry messages of AP process.

The PeriodicSendAp() macro is generated from the telemetry description (named in conf.xml, usually in conf/telemetry directory). This macro is a sequence of calls to PERIODIC_SEND_message() which have to be defined in the present file.

Definition in file ap_downlink.h.

Macro Definition Documentation

#define Downlink (   x)    {}

Definition at line 53 of file ap_downlink.h.

#define DOWNLINK_DEVICE   DOWNLINK_AP_DEVICE

Definition at line 43 of file ap_downlink.h.

#define DownlinkSendWp (   _trans,
  _dev,
 
)
Value:
{ \
float x = nav_utm_east0 + waypoints[i].x; \
float y = nav_utm_north0 + waypoints[i].y; \
DOWNLINK_SEND_WP_MOVED(_trans, _dev, &i, &x, &y, &(waypoints[i].a),&nav_utm_zone0); \
}
uint8_t nav_utm_zone0
Definition: common_nav.c:43
int32_t nav_utm_north0
Definition: common_nav.c:42
int32_t nav_utm_east0
Definition: common_nav.c:41

Definition at line 106 of file ap_downlink.h.

Referenced by nav_catapult().

#define PERIODIC_SEND_ADC (   _trans,
  _dev 
)    {}

Definition at line 138 of file ap_downlink.h.

#define PERIODIC_SEND_AIRSPEED (   _trans,
  _dev 
)    {}

Definition at line 297 of file ap_downlink.h.

#define PERIODIC_SEND_ALIVE (   _trans,
  _dev 
)    DOWNLINK_SEND_ALIVE(_trans, _dev, 16, MD5SUM);

Definition at line 56 of file ap_downlink.h.

#define PERIODIC_SEND_ATTITUDE (   _trans,
  _dev 
)
Value:
DOWNLINK_SEND_ATTITUDE(_trans, _dev, &estimator_phi, &estimator_psi, &estimator_theta); \
})
float estimator_theta
pitch angle in rad, + = up
Definition: estimator.c:51
float estimator_phi
roll angle in rad, + = right
Definition: estimator.c:49
float estimator_psi
heading in rad, CW, 0 = N
Definition: estimator.c:50

Definition at line 88 of file ap_downlink.h.

#define PERIODIC_SEND_BARO_MS5534A (   _trans,
  _dev 
)    {}

Definition at line 270 of file ap_downlink.h.

#define PERIODIC_SEND_BARO_RAW (   _trans,
  _dev 
)    {}

Definition at line 289 of file ap_downlink.h.

#define PERIODIC_SEND_BAT (   _trans,
  _dev 
)
Value:
{ \
int16_t amps = (int16_t) (current/10); \
DOWNLINK_SEND_BAT(_trans, _dev, \
&vsupply, \
&amps, \
&e); \
}); \
}
uint16_t block_time
static int32_t current
Supply current in milliAmpere.
Definition: main_ap.c:133
uint16_t estimator_flight_time
flight time in seconds.
Definition: estimator.c:59
pprz_t v_ctl_throttle_slewed
Definition: guidance_v.c:89
bool_t kill_throttle
Definition: main_ap.c:120
signed short int16_t
Definition: types.h:17
uint16_t stage_time
In s.
float energy
Fuel consumption (mAh) TODO: move to electrical subsystem.
Definition: main_ap.c:138
uint8_t vsupply
Supply voltage in deciVolt.
Definition: main_ap.c:128

Definition at line 58 of file ap_downlink.h.

#define PERIODIC_SEND_CALIBRATION (   _trans,
  _dev 
)    DOWNLINK_SEND_CALIBRATION(_trans, _dev, &v_ctl_auto_throttle_sum_err, &v_ctl_auto_throttle_submode)

Definition at line 141 of file ap_downlink.h.

#define PERIODIC_SEND_CAM_POINT (   _trans,
  _dev 
)    {}

Definition at line 196 of file ap_downlink.h.

#define PERIODIC_SEND_CIRCLE (   _trans,
  _dev 
)    if (nav_in_circle) { DOWNLINK_SEND_CIRCLE(_trans, _dev, &nav_circle_x, &nav_circle_y, &nav_circle_radius); }

Definition at line 143 of file ap_downlink.h.

#define PERIODIC_SEND_DEBUG_MCU_LINK (   _trans,
  _dev 
)    {}

Definition at line 76 of file ap_downlink.h.

#define PERIODIC_SEND_DESIRED (   _trans,
  _dev 
)    DOWNLINK_SEND_DESIRED(_trans, _dev, &h_ctl_roll_setpoint, &h_ctl_pitch_loop_setpoint, &h_ctl_course_setpoint, &desired_x, &desired_y, &v_ctl_altitude_setpoint, &v_ctl_climb_setpoint);

Definition at line 93 of file ap_downlink.h.

#define PERIODIC_SEND_DL_VALUE (   _trans,
  _dev 
)    PeriodicSendDlValue(_trans, _dev) /** generated from the xml settings config in conf/settings */

Definition at line 199 of file ap_downlink.h.

#define PERIODIC_SEND_DOWNLINK (   _trans,
  _dev 
)
Value:
{ \
static uint16_t last; \
uint16_t rate = (downlink_nb_bytes - last) / PERIOD_DOWNLINK_Ap_0; \
DOWNLINK_SEND_DOWNLINK(_trans, _dev, &downlink_nb_ovrn, &rate, &downlink_nb_msgs); \
}
unsigned short uint16_t
Definition: types.h:16

Definition at line 80 of file ap_downlink.h.

#define PERIODIC_SEND_ENERGY (   _trans,
  _dev 
)    Downlink({ const int16_t e = energy; const float vsup = ((float)vsupply) / 10.0f; const float curs = ((float) current)/1000.0f; const float power = vsup * curs; DOWNLINK_SEND_ENERGY(_trans, _dev, &vsup, &curs, &e, &power); })

Definition at line 300 of file ap_downlink.h.

#define PERIODIC_SEND_ESTIMATOR (   _trans,
  _dev 
)    DOWNLINK_SEND_ESTIMATOR(_trans, _dev, &estimator_z, &estimator_z_dot)

Definition at line 184 of file ap_downlink.h.

#define PERIODIC_SEND_GPS (   _trans,
  _dev 
)
Value:
{ \
static uint8_t i; \
int16_t climb = -gps.ned_vel.z; \
int16_t course = (DegOfRad(gps.course)/((int32_t)1e6)); \
DOWNLINK_SEND_GPS(_trans, _dev, &gps.fix, &gps.utm_pos.east, &gps.utm_pos.north, &course, &gps.hmsl, &gps.gspeed, &climb, &gps.week, &gps.tow, &gps.utm_pos.zone, &i); \
if ((gps.fix != GPS_FIX_3D) && (i >= gps.nb_channels)) i = 0; \
if (i >= gps.nb_channels * 2) i = 0; \
if (i < gps.nb_channels && gps.svinfos[i].cno > 0) { \
DOWNLINK_SEND_SVINFO(_trans, _dev, &i, &gps.svinfos[i].svid, &gps.svinfos[i].flags, &gps.svinfos[i].qi, &gps.svinfos[i].cno, &gps.svinfos[i].elev, &gps.svinfos[i].azim); \
} \
i++; \
}
struct NedCoor_i ned_vel
speed NED in cm/s
Definition: gps.h:68
int32_t course
GPS heading in rad*1e7 (CW/north)
Definition: gps.h:71
uint8_t zone
UTM zone number.
int32_t hmsl
height above mean sea level in mm
Definition: gps.h:66
uint8_t fix
status of fix
Definition: gps.h:77
#define GPS_FIX_3D
Definition: gps.h:42
int16_t week
GPS week.
Definition: gps.h:78
uint8_t qi
quality bitfield (GPS receiver specific)
Definition: gps.h:55
uint32_t tow
GPS time of week in ms.
Definition: gps.h:79
int16_t azim
azimuth in deg
Definition: gps.h:58
int16_t gspeed
norm of 2d ground speed in cm/s
Definition: gps.h:69
signed short int16_t
Definition: types.h:17
int32_t north
in centimeters
struct SVinfo svinfos[GPS_NB_CHANNELS]
holds information from the Space Vehicles (Satellites)
Definition: gps.h:82
signed long int32_t
Definition: types.h:19
int32_t east
in centimeters
uint8_t flags
bitfield with GPS receiver specific flags
Definition: gps.h:54
unsigned char uint8_t
Definition: types.h:14
int8_t elev
elevation in deg
Definition: gps.h:57
uint8_t svid
Satellite ID.
Definition: gps.h:53
struct UtmCoor_i utm_pos
position in UTM (north,east: cm; alt: mm over ellipsoid)
Definition: gps.h:65
struct GpsState gps
global GPS state
Definition: gps.c:31
uint8_t cno
Carrier to Noise Ratio (Signal Strength) in dbHz.
Definition: gps.h:56
uint8_t nb_channels
Number of scanned satellites.
Definition: gps.h:81

Definition at line 214 of file ap_downlink.h.

#define PERIODIC_SEND_H_CTL_A (   _trans,
  _dev 
)    DOWNLINK_SEND_H_CTL_A(_trans, _dev, &h_ctl_roll_sum_err, &h_ctl_ref_roll_angle, &h_ctl_pitch_sum_err, &h_ctl_ref_pitch_angle)

Definition at line 304 of file ap_downlink.h.

#define PERIODIC_SEND_IMU (   _trans,
  _dev 
)    {}

Definition at line 181 of file ap_downlink.h.

#define PERIODIC_SEND_IMU_ACCEL (   _trans,
  _dev 
)    {}

Definition at line 173 of file ap_downlink.h.

#define PERIODIC_SEND_IMU_ACCEL_RAW (   _trans,
  _dev 
)    {}

Definition at line 170 of file ap_downlink.h.

#define PERIODIC_SEND_IMU_GYRO (   _trans,
  _dev 
)    {}

Definition at line 174 of file ap_downlink.h.

#define PERIODIC_SEND_IMU_GYRO_RAW (   _trans,
  _dev 
)    {}

Definition at line 171 of file ap_downlink.h.

#define PERIODIC_SEND_IMU_MAG (   _trans,
  _dev 
)    {}

Definition at line 175 of file ap_downlink.h.

#define PERIODIC_SEND_IMU_MAG_RAW (   _trans,
  _dev 
)    {}

Definition at line 172 of file ap_downlink.h.

#define PERIODIC_SEND_IR_SENSORS (   _trans,
  _dev 
)    ;

Definition at line 135 of file ap_downlink.h.

#define PERIODIC_SEND_NAVIGATION (   _trans,
  _dev 
)    SEND_NAVIGATION(_trans, _dev)

Definition at line 188 of file ap_downlink.h.

#define PERIODIC_SEND_NAVIGATION_REF (   _trans,
  _dev 
)    DOWNLINK_SEND_NAVIGATION_REF(_trans, _dev, &nav_utm_east0, &nav_utm_north0, &nav_utm_zone0);

Definition at line 103 of file ap_downlink.h.

#define PERIODIC_SEND_PPRZ_MODE (   _trans,
  _dev 
)
Value:
{ \
uint8_t rc_settings_mode_none = 0; \
DOWNLINK_SEND_PPRZ_MODE(_trans, _dev, &pprz_mode, &v_ctl_mode, &lateral_mode, &horizontal_mode, &rc_settings_mode_none, &mcu1_status); \
}
uint8_t pprz_mode
Definition: main_ap.c:111
uint8_t lateral_mode
Definition: main_ap.c:112
unsigned char uint8_t
Definition: types.h:14
uint8_t v_ctl_mode
Definition: guidance_v.c:35
static uint8_t mcu1_status
Definition: main_ap.c:114

Definition at line 124 of file ap_downlink.h.

Referenced by navigation_task(), and telecommand_task().

#define PERIODIC_SEND_RANGEFINDER (   _trans,
  _dev 
)    DOWNLINK_SEND_RANGEFINDER(_trans, _dev, &rangemeter, &ctl_grz_z_dot, &ctl_grz_z_dot_sum_err, &ctl_grz_z_dot_setpoint, &ctl_grz_z_sum_err, &ctl_grz_z_setpoint, &flying)

Definition at line 206 of file ap_downlink.h.

#define PERIODIC_SEND_SCP_STATUS (   _trans,
  _dev 
)    {}

Definition at line 277 of file ap_downlink.h.

#define PERIODIC_SEND_SEGMENT (   _trans,
  _dev 
)    if (nav_in_segment) { DOWNLINK_SEND_SEGMENT(_trans, _dev, &nav_segment_x_1, &nav_segment_y_1, &nav_segment_x_2, &nav_segment_y_2); }

Definition at line 145 of file ap_downlink.h.

#define PERIODIC_SEND_SETTINGS (   _trans,
  _dev 
)    {}

Definition at line 128 of file ap_downlink.h.

#define PERIODIC_SEND_STATE_FILTER_STATUS (   _trans,
  _dev 
)    {}

Definition at line 100 of file ap_downlink.h.

#define PERIODIC_SEND_SURVEY (   _trans,
  _dev 
)
Value:
{ \
DOWNLINK_SEND_SURVEY(_trans, _dev, &nav_survey_east, &nav_survey_north, &nav_survey_west, &nav_survey_south); \
}

Definition at line 201 of file ap_downlink.h.

#define PERIODIC_SEND_TUNE_ROLL (   _trans,
  _dev 
)    DOWNLINK_SEND_TUNE_ROLL(_trans, _dev, &estimator_p,&estimator_phi, &h_ctl_roll_setpoint);

Definition at line 208 of file ap_downlink.h.

#define PERIODIC_SEND_WP_MOVED (   _trans,
  _dev 
)
Value:
{ \
static uint8_t i; \
i++; if (i >= nb_waypoint) i = 0; \
DownlinkSendWp(_trans, _dev, i); \
}
unsigned char uint8_t
Definition: types.h:14

Definition at line 113 of file ap_downlink.h.

#define SEND_CAM (   _trans,
  _dev 
)    {}

Definition at line 195 of file ap_downlink.h.

Referenced by navigation_task().

#define SEND_NAVIGATION (   _trans,
  _dev 
)    Downlink({ uint8_t _circle_count = NavCircleCount(); DOWNLINK_SEND_NAVIGATION(_trans, _dev, &nav_block, &nav_stage, &estimator_x, &estimator_y, &dist2_to_wp, &dist2_to_home, &_circle_count, &nav_oval_count);})

Definition at line 186 of file ap_downlink.h.

Referenced by dl_parse_msg(), and navigation_task().