31 #include "pprzlink/messages.h"
32 #include "pprzlink/dl_protocol.h"
34 #if defined NAV || defined WIND_INFO
48 #define MOfMM(_x) (((float)(_x))/1000.)
54 #define JoystickHandeDatalink(_roll_int8, _pitch_int8, _throttle_int8) { \
55 if (autopilot_get_mode() == AP_MODE_AUTO2 && nav_block == joystick_block) { \
56 h_ctl_roll_setpoint = _roll_int8 * (AUTO1_MAX_ROLL / 0x7f); \
57 h_ctl_pitch_setpoint = _pitch_int8 * (AUTO1_MAX_PITCH / 0x7f); \
58 v_ctl_throttle_setpoint = (MAX_PPRZ/0x7f) * _throttle_int8; \
65 uint8_t msg_id = IdOfPprzMsg(buf);
72 if (DL_BLOCK_ac_id(buf) != AC_ID) {
break; }
79 if (DL_MOVE_WP_ac_id(buf) != AC_ID) {
break; }
80 uint8_t wp_id = DL_MOVE_WP_wp_id(buf);
84 lla.
lat = RadOfDeg((
float)(DL_MOVE_WP_lat(buf) / 1e7));
85 lla.
lon = RadOfDeg((
float)(DL_MOVE_WP_lon(buf) / 1e7));
86 lla.
alt =
MOfMM(DL_MOVE_WP_alt(buf));
103 if (DL_WIND_INFO_ac_id(buf) != AC_ID) {
break; }
104 uint8_t flags = DL_WIND_INFO_flags(buf);
107 if (bit_is_set(flags, 0)) {
108 wind.
x = DL_WIND_INFO_north(buf);
109 wind.
y = DL_WIND_INFO_east(buf);
112 if (bit_is_set(flags, 1)) {
113 upwind = DL_WIND_INFO_up(buf);
117 if (bit_is_set(flags, 2)) {
123 pprz_msg_send_WIND_INFO_RET(trans,
dev, AC_ID, &flags, &wind.
y, &wind.
x, &upwind, &airspeed);
131 case DL_HITL_INFRARED: {
141 if (gps_msg_received) {
144 ubx_class = DL_HITL_UBX_class(buf);
145 ubx_id = DL_HITL_UBX_id(buf);
146 uint8_t l = DL_HITL_UBX_ubx_payload_length(buf);
147 uint8_t *ubx_payload = DL_HITL_UBX_ubx_payload(buf);
148 memcpy(ubx_msg_buf, ubx_payload, l);
149 gps_msg_received =
true;
156 case DL_JOYSTICK_RAW: {
157 if (DL_JOYSTICK_RAW_ac_id(buf) == AC_ID) {
158 JoystickHandeDatalink(DL_JOYSTICK_RAW_roll(buf),
159 DL_JOYSTICK_RAW_pitch(buf),
160 DL_JOYSTICK_RAW_throttle(buf));
164 #endif // USE_JOYSTICK
float alt
in meters (above WGS84 reference ellipsoid or above MSL)
Handling of messages coming from ground and other A/Cs.
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
void firmware_parse_msg(struct link_device *dev, struct transport_tx *trans, uint8_t *buf)
Firmware specfic msg handler.
Fixed wing horizontal control.
Paparazzi floating point math for geodetic calculations.
vector in Latitude, Longitude and Altitude
Device independent GPS code (interface)
uint8_t zone
UTM zone number.
static const struct usb_device_descriptor dev
float alt
in meters (normally above WGS84 reference ellipsoid)
Core autopilot interface common to all firmwares.
static void stateSetVerticalWindspeed_f(float v_windspeed)
Set vertical windspeed (float).
#define SEND_NAVIGATION(_trans, _dev)
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).
Common code for AP and FBW telemetry.
Fixedwing Navigation library.
void nav_goto_block(uint8_t b)
void utm_of_lla_f(struct UtmCoor_f *utm, struct LlaCoor_f *lla)
static void stateSetHorizontalWindspeed_f(struct FloatVect2 *h_windspeed)
Set horizontal windspeed (float).