Line data Source code
1 : #pragma once 2 : 3 : #include <GCS_MAVLink/GCS.h> 4 : #include <AP_Winch/AP_Winch_config.h> 5 : #include "defines.h" 6 : #include "config.h" 7 : 8 : #ifndef AC_MAVLINK_SOLO_BUTTON_COMMAND_HANDLING_ENABLED 9 : #define AC_MAVLINK_SOLO_BUTTON_COMMAND_HANDLING_ENABLED 1 10 : #endif 11 : 12 : class GCS_MAVLINK_Copter : public GCS_MAVLINK 13 : { 14 : 15 : public: 16 : 17 : using GCS_MAVLINK::GCS_MAVLINK; 18 : 19 : protected: 20 : 21 : MAV_RESULT handle_flight_termination(const mavlink_command_int_t &packet) override; 22 : 23 : bool params_ready() const override; 24 : void send_banner() override; 25 : 26 : MAV_RESULT _handle_command_preflight_calibration(const mavlink_command_int_t &packet, const mavlink_message_t &msg) override; 27 : 28 : void send_attitude_target() override; 29 : bool get_target_location(Location &loc) const override; 30 : void send_position_target_local_ned() override; 31 : 32 : MAV_RESULT handle_command_do_set_roi(const Location &roi_loc) override; 33 : MAV_RESULT handle_preflight_reboot(const mavlink_command_int_t &packet, const mavlink_message_t &msg) override; 34 : #if HAL_MOUNT_ENABLED 35 : MAV_RESULT handle_command_mount(const mavlink_command_int_t &packet, const mavlink_message_t &msg) override; 36 : #endif 37 : MAV_RESULT handle_command_int_packet(const mavlink_command_int_t &packet, const mavlink_message_t &msg) override; 38 : MAV_RESULT handle_command_int_do_reposition(const mavlink_command_int_t &packet); 39 : MAV_RESULT handle_command_pause_continue(const mavlink_command_int_t &packet); 40 : 41 : void handle_message_set_attitude_target(const mavlink_message_t &msg); 42 : void handle_message_set_position_target_global_int(const mavlink_message_t &msg); 43 : void handle_message_set_position_target_local_ned(const mavlink_message_t &msg); 44 : 45 : void handle_landing_target(const mavlink_landing_target_t &packet, uint32_t timestamp_ms) override; 46 : 47 : void send_nav_controller_output() const override; 48 : uint64_t capabilities() const override; 49 : 50 288 : virtual MAV_VTOL_STATE vtol_state() const override { return MAV_VTOL_STATE_MC; }; 51 : virtual MAV_LANDED_STATE landed_state() const override; 52 : 53 : void handle_manual_control_axes(const mavlink_manual_control_t &packet, const uint32_t tnow) override; 54 : 55 : #if HAL_LOGGING_ENABLED 56 0 : uint32_t log_radio_bit() const override { return MASK_LOG_PM; } 57 : #endif 58 : 59 : // Send the mode with the given index (not mode number!) return the total number of modes 60 : // Index starts at 1 61 : uint8_t send_available_mode(uint8_t index) const override; 62 : 63 : private: 64 : 65 : // sanity check velocity or acceleration vector components are numbers 66 : // (e.g. not NaN) and below 1000. vec argument units are in meters/second or 67 : // metres/second/second 68 : bool sane_vel_or_acc_vector(const Vector3f &vec) const; 69 : 70 : #if MODE_AUTO_ENABLED 71 : MISSION_STATE mission_state(const class AP_Mission &mission) const override; 72 : #endif // MODE_AUTO_ENABLED 73 : 74 : void handle_message(const mavlink_message_t &msg) override; 75 : void handle_command_ack(const mavlink_message_t &msg) override; 76 : bool handle_guided_request(AP_Mission::Mission_Command &cmd) override; 77 : bool try_send_message(enum ap_message id) override; 78 : 79 : void packetReceived(const mavlink_status_t &status, 80 : 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_alt() const override; 88 : 89 : void send_pid_tuning() override; 90 : 91 : #if AP_WINCH_ENABLED 92 : void send_winch_status() const override; 93 : #endif 94 : 95 : void send_wind() const; 96 : 97 : #if HAL_HIGH_LATENCY2_ENABLED 98 : int16_t high_latency_target_altitude() const override; 99 : uint8_t high_latency_tgt_heading() const override; 100 : uint16_t high_latency_tgt_dist_dam() const override; 101 : uint8_t high_latency_tgt_airspeed() const override; 102 : uint8_t high_latency_wind_speed() const override; 103 : uint8_t high_latency_wind_direction() const override; 104 : #endif // HAL_HIGH_LATENCY2_ENABLED 105 : 106 : 107 : MAV_RESULT handle_MAV_CMD_CONDITION_YAW(const mavlink_command_int_t &packet); 108 : MAV_RESULT handle_MAV_CMD_DO_CHANGE_SPEED(const mavlink_command_int_t &packet); 109 : MAV_RESULT handle_MAV_CMD_DO_MOTOR_TEST(const mavlink_command_int_t &packet); 110 : MAV_RESULT handle_MAV_CMD_DO_PARACHUTE(const mavlink_command_int_t &packet); 111 : 112 : #if AC_MAVLINK_SOLO_BUTTON_COMMAND_HANDLING_ENABLED 113 : MAV_RESULT handle_MAV_CMD_SOLO_BTN_FLY_CLICK(const mavlink_command_int_t &packet); 114 : MAV_RESULT handle_MAV_CMD_SOLO_BTN_FLY_HOLD(const mavlink_command_int_t &packet); 115 : MAV_RESULT handle_MAV_CMD_SOLO_BTN_PAUSE_CLICK(const mavlink_command_int_t &packet); 116 : #endif 117 : 118 : #if AP_MAVLINK_COMMAND_LONG_ENABLED 119 : bool mav_frame_for_command_long(MAV_FRAME &frame, MAV_CMD packet_command) const override; 120 : #endif 121 : 122 : MAV_RESULT handle_MAV_CMD_MISSION_START(const mavlink_command_int_t &packet); 123 : MAV_RESULT handle_MAV_CMD_NAV_TAKEOFF(const mavlink_command_int_t &packet); 124 : 125 : #if AP_WINCH_ENABLED 126 : MAV_RESULT handle_MAV_CMD_DO_WINCH(const mavlink_command_int_t &packet); 127 : #endif 128 : 129 : };