CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
Ardupilot

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

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