diff --git a/src/modules/mavlink/mavlink_receiver.cpp b/src/modules/mavlink/mavlink_receiver.cpp index 2c79c775cd..511b011d2e 100644 --- a/src/modules/mavlink/mavlink_receiver.cpp +++ b/src/modules/mavlink/mavlink_receiver.cpp @@ -85,6 +85,20 @@ MavlinkReceiver::MavlinkReceiver(Mavlink *parent) : _parameters_manager(parent), _mavlink_timesync(parent) { + unsigned int system_type = _mavlink->get_system_type(); + + if (system_type == MAV_TYPE_VTOL_DUOROTOR || + system_type == MAV_TYPE_VTOL_QUADROTOR || + system_type == MAV_TYPE_VTOL_TILTROTOR || + system_type == MAV_TYPE_VTOL_RESERVED2 || + system_type == MAV_TYPE_VTOL_RESERVED3 || + system_type == MAV_TYPE_VTOL_RESERVED4 || + system_type == MAV_TYPE_VTOL_RESERVED5) { + _is_vtol = true; + + } else { + _is_vtol = false; + } } void @@ -1411,7 +1425,12 @@ MavlinkReceiver::handle_message_set_attitude_target(mavlink_message_t *msg) } } - _att_sp_pub.publish(att_sp); + if (!_is_vtol) { + _att_sp_pub.publish(att_sp); + + } else { + _mc_virtual_att_sp_pub.publish(att_sp); + } } /* Publish attitude rate setpoint if bodyrate and thrust ignore bits are not set */ diff --git a/src/modules/mavlink/mavlink_receiver.h b/src/modules/mavlink/mavlink_receiver.h index 1b9051724a..14cfde2055 100644 --- a/src/modules/mavlink/mavlink_receiver.h +++ b/src/modules/mavlink/mavlink_receiver.h @@ -229,6 +229,7 @@ private: uORB::Publication _pos_sp_triplet_pub{ORB_ID(position_setpoint_triplet)}; uORB::Publication _attitude_pub{ORB_ID(vehicle_attitude)}; uORB::Publication _att_sp_pub{ORB_ID(vehicle_attitude_setpoint)}; + uORB::Publication _mc_virtual_att_sp_pub{ORB_ID(mc_virtual_attitude_setpoint)}; uORB::Publication _global_pos_pub{ORB_ID(vehicle_global_position)}; uORB::Publication _gps_pub{ORB_ID(vehicle_gps_position)}; uORB::Publication _land_detector_pub{ORB_ID(vehicle_land_detected)}; @@ -275,6 +276,8 @@ private: hrt_abstime _last_utm_global_pos_com{0}; + bool _is_vtol{false}; + DEFINE_PARAMETERS( (ParamFloat) _param_bat_crit_thr, (ParamFloat) _param_bat_emergen_thr,