30 #define MODULES_DATALINK_C
36 #include "generated/modules.h"
40 #endif // TRAFFIC_INFO
42 #if defined NAV || defined WIND_INFO
53 #include "generated/settings.h"
62 #include "autopilot.h"
64 #define JoystickHandeDatalink(_roll_int8, _pitch_int8, _throttle_int8) { \
65 if (pprz_mode == PPRZ_MODE_AUTO2 && nav_block == joystick_block) { \
66 h_ctl_roll_setpoint = _roll_int8 * (AUTO1_MAX_ROLL / 0x7f); \
67 h_ctl_pitch_setpoint = _pitch_int8 * (AUTO1_MAX_PITCH / 0x7f); \
68 v_ctl_throttle_setpoint = (MAX_PPRZ/0x7f) * _throttle_int8; \
73 #if defined RADIO_CONTROL && defined RADIO_CONTROL_TYPE_DATALINK
77 #define MOfCm(_x) (((float)(_x))/100.)
78 #define MOfMM(_x) (((float)(_x))/1000.)
80 #define SenderIdOfMsg(x) (x[0])
81 #define IdOfMsg(x) (x[1])
84 bool_t datalink_enabled =
TRUE;
92 #if 0 // not ready yet
120 if (DL_ACINFO_ac_id(
dl_buffer) == AC_ID) {
break; }
125 float c = RadOfDeg(((
float)DL_ACINFO_course(
dl_buffer)) / 10.);
136 if (DL_MOVE_WP_ac_id(
dl_buffer) != AC_ID) {
break; }
142 lla.
lat = RadOfDeg((
float)(DL_MOVE_WP_lat(
dl_buffer) / 1e7));
143 lla.
lon = RadOfDeg((
float)(DL_MOVE_WP_lon(
dl_buffer) / 1e7));
158 if (DL_BLOCK_ac_id(
dl_buffer) != AC_ID) {
break; }
168 if (DL_WIND_INFO_ac_id(
dl_buffer) != AC_ID) {
break; }
186 case DL_HITL_INFRARED: {
196 if (gps_msg_received) {
199 ubx_class = DL_HITL_UBX_class(
dl_buffer);
203 memcpy(ubx_msg_buf, ubx_payload, l);
204 gps_msg_received =
TRUE;
212 if (DL_SETTING_ac_id(
dl_buffer) != AC_ID) {
break; }
220 case DL_GET_SETTING: {
221 if (DL_GET_SETTING_ac_id(
dl_buffer) != AC_ID) {
break; }
223 float val = settings_get_value(i);
230 case DL_JOYSTICK_RAW: {
231 if (DL_JOYSTICK_RAW_ac_id(
dl_buffer) == AC_ID) {
232 JoystickHandeDatalink(DL_JOYSTICK_RAW_roll(
dl_buffer),
238 #endif // USE_JOYSTICK
240 #if defined RADIO_CONTROL && defined RADIO_CONTROL_TYPE_DATALINK
243 #ifdef RADIO_CONTROL_DATALINK_LED
253 if (DL_RC_4CH_ac_id(
dl_buffer) == AC_ID) {
254 #ifdef RADIO_CONTROL_DATALINK_LED
265 #endif // RC_DATALINK
272 modules_parse_datalink(msg_id);
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
void dl_parse_msg(void)
Should be called when chars are available in dl_buffer.
enum tcas_resolve resolve
uint8_t the_acs_id[NB_ACS_ID]
Periodic telemetry system header (includes downlink utility and generated code).
Handling of messages coming from ground and other A/Cs.
void parse_rc_3ch_datalink(uint8_t throttle_mode, int8_t roll, int8_t pitch)
Decode datalink message to get rc values with RC_3CH message Mode and throttle are merge in the same ...
static float stateGetAirspeed_f(void)
Get airspeed (float).
void nav_move_waypoint(uint8_t wp_id, float ux, float uy, float alt)
Move a waypoint to given UTM coordinates.
position in UTM coordinates Units: meters
Fixed wing horizontal control.
struct tcas_ac_status tcas_acs_status[NB_ACS]
Paparazzi floating point math for geodetic calculations.
vector in Latitude, Longitude and Altitude
Device independent GPS code (interface)
Radio control input via datalink.
uint8_t zone
UTM zone number.
#define SetAcInfo(_id, _utm_x, _utm_y, _course, _alt, _gspeed, _climb, _itow)
#define DefaultChannel
SITL.
API to get/set the generic vehicle states.
struct point waypoints[NB_WAYPOINT]
size == nb_waypoint, waypoint 0 is a dummy waypoint
static void stateSetAirspeed_f(float airspeed)
Set airspeed (float).
uint8_t dl_buffer[MSG_SIZE]
void parse_rc_4ch_datalink(uint8_t mode, uint8_t throttle, int8_t roll, int8_t pitch, int8_t yaw)
Decode datalink message to get rc values with RC_4CH message.
Fixedwing Navigation library.
void nav_goto_block(uint8_t b)
void utm_of_lla_f(struct UtmCoor_f *utm, struct LlaCoor_f *lla)
Information relative to the other aircrafts.
static void stateSetHorizontalWindspeed_f(struct FloatVect2 *h_windspeed)
Set horizontal windspeed (float).