Line data Source code
1 : #pragma once 2 : 3 : #include <GCS_MAVLink/GCS.h> 4 : #include <AP_Logger/AP_Logger.h> 5 : #include <AP_Airspeed/AP_Airspeed_config.h> 6 : #include "quadplane.h" 7 : #include "defines.h" 8 : 9 : class GCS_MAVLINK_Plane : public GCS_MAVLINK 10 : { 11 : 12 : public: 13 : 14 : using GCS_MAVLINK::GCS_MAVLINK; 15 : 16 : protected: 17 : 18 : #if HAL_LOGGING_ENABLED 19 0 : uint32_t log_radio_bit() const override { return MASK_LOG_PM; } 20 : #endif 21 : 22 : #if AP_MAVLINK_MISSION_SET_CURRENT_ENABLED 23 : void handle_mission_set_current(AP_Mission &mission, const mavlink_message_t &msg) override; 24 : #endif 25 : 26 : MAV_RESULT handle_command_preflight_calibration(const mavlink_command_int_t &packet, const mavlink_message_t &msg) override; 27 : MAV_RESULT handle_command_int_packet(const mavlink_command_int_t &packet, const mavlink_message_t &msg) override; 28 : MAV_RESULT handle_command_do_set_mission_current(const mavlink_command_int_t &packet) override; 29 : 30 : bool get_target_location(Location &loc) const override; 31 : 32 : void send_aoa_ssa(); 33 : void send_attitude() const override; 34 : void send_attitude_target() override; 35 : void send_wind() const; 36 : 37 6354 : bool persist_streamrates() const override { return true; } 38 : 39 : uint64_t capabilities() const override; 40 : 41 : void send_nav_controller_output() const override; 42 : void send_pid_tuning() override; 43 : 44 : void handle_manual_control_axes(const mavlink_manual_control_t &packet, const uint32_t tnow) override; 45 : void handle_landing_target(const mavlink_landing_target_t &packet, uint32_t timestamp_ms) override; 46 : 47 : // Send the mode with the given index (not mode number!) return the total number of modes 48 : // Index starts at 1 49 : uint8_t send_available_mode(uint8_t index) const override; 50 : 51 : private: 52 : 53 : void send_pid_info(const struct AP_PIDInfo *pid_info, const uint8_t axis, const float achieved); 54 : 55 : void handle_message(const mavlink_message_t &msg) override; 56 : bool handle_guided_request(AP_Mission::Mission_Command &cmd) override; 57 : void handle_change_alt_request(Location &location) override; 58 : MAV_RESULT handle_command_int_do_reposition(const mavlink_command_int_t &packet); 59 : MAV_RESULT handle_command_int_DO_CHANGE_ALTITUDE(const mavlink_command_int_t &packet); 60 : MAV_RESULT handle_command_int_guided_slew_commands(const mavlink_command_int_t &packet); 61 : MAV_RESULT handle_MAV_CMD_DO_AUTOTUNE_ENABLE(const mavlink_command_int_t &packet); 62 : MAV_RESULT handle_command_DO_CHANGE_SPEED(const mavlink_command_int_t &packet); 63 : MAV_RESULT handle_MAV_CMD_DO_MOTOR_TEST(const mavlink_command_int_t &packet); 64 : MAV_RESULT handle_MAV_CMD_DO_PARACHUTE(const mavlink_command_int_t &packet); 65 : MAV_RESULT handle_command_DO_VTOL_TRANSITION(const mavlink_command_int_t &packet); 66 : 67 : void handle_set_position_target_global_int(const mavlink_message_t &msg); 68 : void handle_set_position_target_local_ned(const mavlink_message_t &msg); 69 : void handle_set_attitude_target(const mavlink_message_t &msg); 70 : 71 : #if HAL_QUADPLANE_ENABLED 72 : #if AP_MAVLINK_COMMAND_LONG_ENABLED 73 : void convert_MAV_CMD_NAV_TAKEOFF_to_COMMAND_INT(const mavlink_command_long_t &in, mavlink_command_int_t &out); 74 : void convert_COMMAND_LONG_to_COMMAND_INT(const mavlink_command_long_t &in, mavlink_command_int_t &out, MAV_FRAME frame = MAV_FRAME_GLOBAL_RELATIVE_ALT) override; 75 : #endif 76 : MAV_RESULT handle_command_MAV_CMD_NAV_TAKEOFF(const mavlink_command_int_t &packet); 77 : #endif 78 : 79 : bool try_send_message(enum ap_message id) override; 80 : void packetReceived(const mavlink_status_t &status, const mavlink_message_t &msg) override; 81 : 82 : uint8_t base_mode() const override; 83 : MAV_STATE vehicle_system_status() const override; 84 : 85 : float vfr_hud_airspeed() const override; 86 : int16_t vfr_hud_throttle() const override; 87 : float vfr_hud_climbrate() const override; 88 : 89 : #if HAL_HIGH_LATENCY2_ENABLED 90 : int16_t high_latency_target_altitude() const override; 91 : uint8_t high_latency_tgt_heading() const override; 92 : uint16_t high_latency_tgt_dist_dam() const override; 93 : uint8_t high_latency_tgt_airspeed() const override; 94 : uint8_t high_latency_wind_speed() const override; 95 : uint8_t high_latency_wind_direction() const override; 96 : #endif // HAL_HIGH_LATENCY2_ENABLED 97 : 98 : #if AP_AIRSPEED_HYGROMETER_ENABLE 99 : void send_hygrometer(); 100 : uint8_t last_hygrometer_send_idx; 101 : #endif 102 : 103 : MAV_VTOL_STATE vtol_state() const override; 104 : MAV_LANDED_STATE landed_state() const override; 105 : 106 : };