|
|
@ -7,9 +7,7 @@ class ParametersG2; |
|
|
|
class GCS_Copter; |
|
|
|
class GCS_Copter; |
|
|
|
|
|
|
|
|
|
|
|
class Mode { |
|
|
|
class Mode { |
|
|
|
|
|
|
|
|
|
|
|
public: |
|
|
|
public: |
|
|
|
|
|
|
|
|
|
|
|
// Auto Pilot Modes enumeration
|
|
|
|
// Auto Pilot Modes enumeration
|
|
|
|
enum class Number : uint8_t { |
|
|
|
enum class Number : uint8_t { |
|
|
|
STABILIZE = 0, // manual airframe angle with manual throttle
|
|
|
|
STABILIZE = 0, // manual airframe angle with manual throttle
|
|
|
@ -37,7 +35,6 @@ public: |
|
|
|
SYSTEMID = 25, // System ID mode produces automated system identification signals in the controllers
|
|
|
|
SYSTEMID = 25, // System ID mode produces automated system identification signals in the controllers
|
|
|
|
AUTOROTATE = 26, // Autonomous autorotation
|
|
|
|
AUTOROTATE = 26, // Autonomous autorotation
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// constructor
|
|
|
|
// constructor
|
|
|
|
Mode(void); |
|
|
|
Mode(void); |
|
|
|
|
|
|
|
|
|
|
@ -134,7 +131,10 @@ protected: |
|
|
|
RC_Channel *&channel_throttle; |
|
|
|
RC_Channel *&channel_throttle; |
|
|
|
RC_Channel *&channel_yaw; |
|
|
|
RC_Channel *&channel_yaw; |
|
|
|
float &G_Dt; |
|
|
|
float &G_Dt; |
|
|
|
|
|
|
|
int16_t countdown ; |
|
|
|
|
|
|
|
uint32_t last_takeoff_request_time; |
|
|
|
|
|
|
|
bool is_takeoff_delay_enable = true; |
|
|
|
|
|
|
|
bool is_rtl_delay_enable = true; |
|
|
|
// note that we support two entirely different automatic takeoffs:
|
|
|
|
// note that we support two entirely different automatic takeoffs:
|
|
|
|
|
|
|
|
|
|
|
|
// "user-takeoff", which is available in modes such as ALT_HOLD
|
|
|
|
// "user-takeoff", which is available in modes such as ALT_HOLD
|
|
|
@ -331,7 +331,6 @@ public: |
|
|
|
|
|
|
|
|
|
|
|
bool init(bool ignore_checks) override; |
|
|
|
bool init(bool ignore_checks) override; |
|
|
|
void run() override; |
|
|
|
void run() override; |
|
|
|
|
|
|
|
|
|
|
|
bool requires_GPS() const override { return true; } |
|
|
|
bool requires_GPS() const override { return true; } |
|
|
|
bool has_manual_throttle() const override { return false; } |
|
|
|
bool has_manual_throttle() const override { return false; } |
|
|
|
bool allows_arming(bool from_gcs) const override { return false; }; |
|
|
|
bool allows_arming(bool from_gcs) const override { return false; }; |
|
|
@ -480,6 +479,7 @@ private: |
|
|
|
int32_t condition_value; // used in condition commands (eg delay, change alt, etc.)
|
|
|
|
int32_t condition_value; // used in condition commands (eg delay, change alt, etc.)
|
|
|
|
uint32_t condition_start; |
|
|
|
uint32_t condition_start; |
|
|
|
uint32_t last_time_send_updownload; |
|
|
|
uint32_t last_time_send_updownload; |
|
|
|
|
|
|
|
|
|
|
|
LandStateType land_state = LandStateType_FlyToLocation; // records state of land (flying to location, descending)
|
|
|
|
LandStateType land_state = LandStateType_FlyToLocation; // records state of land (flying to location, descending)
|
|
|
|
|
|
|
|
|
|
|
|
struct { |
|
|
|
struct { |
|
|
@ -1038,7 +1038,7 @@ protected: |
|
|
|
void land_run(bool disarm_on_land); |
|
|
|
void land_run(bool disarm_on_land); |
|
|
|
|
|
|
|
|
|
|
|
void set_descent_target_alt(uint32_t alt) { rtl_path.descent_target.alt = alt; } |
|
|
|
void set_descent_target_alt(uint32_t alt) { rtl_path.descent_target.alt = alt; } |
|
|
|
|
|
|
|
|
|
|
|
private: |
|
|
|
private: |
|
|
|
|
|
|
|
|
|
|
|
void climb_start(); |
|
|
|
void climb_start(); |
|
|
@ -1048,10 +1048,11 @@ private: |
|
|
|
void loiterathome_run(); |
|
|
|
void loiterathome_run(); |
|
|
|
void build_path(); |
|
|
|
void build_path(); |
|
|
|
void compute_return_target(); |
|
|
|
void compute_return_target(); |
|
|
|
|
|
|
|
|
|
|
|
RTLState _state = RTL_InitialClimb; // records state of rtl (initial climb, returning home, etc)
|
|
|
|
RTLState _state = RTL_InitialClimb; // records state of rtl (initial climb, returning home, etc)
|
|
|
|
bool _state_complete = false; // set to true if the current state is completed
|
|
|
|
bool _state_complete = false; // set to true if the current state is completed
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t last_decent_time =0; |
|
|
|
struct { |
|
|
|
struct { |
|
|
|
// NEU w/ Z element alt-above-ekf-origin unless use_terrain is true in which case Z element is alt-above-terrain
|
|
|
|
// NEU w/ Z element alt-above-ekf-origin unless use_terrain is true in which case Z element is alt-above-terrain
|
|
|
|
Location origin_point; |
|
|
|
Location origin_point; |
|
|
|