Browse Source

Copter: log event if pilot cancels land

Also add definition for throttle value that cancels land
master
Randy Mackay 9 years ago
parent
commit
2c5f9422d4
  1. 1
      ArduCopter/Copter.h
  2. 3
      ArduCopter/config.h
  3. 3
      ArduCopter/control_auto.cpp
  4. 6
      ArduCopter/control_land.cpp
  5. 6
      ArduCopter/control_rtl.cpp
  6. 1
      ArduCopter/defines.h

1
ArduCopter/Copter.h

@ -395,6 +395,7 @@ private: @@ -395,6 +395,7 @@ private:
float baro_climbrate; // barometer climbrate in cm/s
LowPassFilterVector3f land_accel_ef_filter; // accelerations for land and crash detector tests
// filtered pilot's throttle input used to cancel landing if throttle held high
LowPassFilterFloat rc_throttle_control_in_filter;
// 3D Location vectors

3
ArduCopter/config.h

@ -401,6 +401,9 @@ @@ -401,6 +401,9 @@
#ifndef LAND_WITH_DELAY_MS
# define LAND_WITH_DELAY_MS 4000 // default delay (in milliseconds) when a land-with-delay is triggered during a failsafe event
#endif
#ifndef LAND_CANCEL_TRIGGER_THR
# define LAND_CANCEL_TRIGGER_THR 700 // land is cancelled by input throttle above 700
#endif
//////////////////////////////////////////////////////////////////////////////
// Landing Detector

3
ArduCopter/control_auto.cpp

@ -324,7 +324,8 @@ void Copter::auto_land_run() @@ -324,7 +324,8 @@ void Copter::auto_land_run()
// process pilot's input
if (!failsafe.radio) {
if((g.throttle_behavior & THR_BEHAVE_HIGH_THROTTLE_CANCELS_LAND) != 0 && rc_throttle_control_in_filter.get() > 0.7f*THR_MAX){
if ((g.throttle_behavior & THR_BEHAVE_HIGH_THROTTLE_CANCELS_LAND) != 0 && rc_throttle_control_in_filter.get() > LAND_CANCEL_TRIGGER_THR){
Log_Write_Event(DATA_LAND_CANCELLED_BY_PILOT);
// exit land if throttle is high
if (!set_mode(LOITER)) {
set_mode(ALT_HOLD);

6
ArduCopter/control_land.cpp

@ -87,7 +87,8 @@ void Copter::land_gps_run() @@ -87,7 +87,8 @@ void Copter::land_gps_run()
// process pilot inputs
if (!failsafe.radio) {
if((g.throttle_behavior & THR_BEHAVE_HIGH_THROTTLE_CANCELS_LAND) != 0 && rc_throttle_control_in_filter.get() > 0.7f*THR_MAX){
if ((g.throttle_behavior & THR_BEHAVE_HIGH_THROTTLE_CANCELS_LAND) != 0 && rc_throttle_control_in_filter.get() > LAND_CANCEL_TRIGGER_THR){
Log_Write_Event(DATA_LAND_CANCELLED_BY_PILOT);
// exit land if throttle is high
if (!set_mode(LOITER)) {
set_mode(ALT_HOLD);
@ -155,7 +156,8 @@ void Copter::land_nogps_run() @@ -155,7 +156,8 @@ void Copter::land_nogps_run()
// process pilot inputs
if (!failsafe.radio) {
if((g.throttle_behavior & THR_BEHAVE_HIGH_THROTTLE_CANCELS_LAND) != 0 && rc_throttle_control_in_filter.get() > 0.7f*THR_MAX){
if ((g.throttle_behavior & THR_BEHAVE_HIGH_THROTTLE_CANCELS_LAND) != 0 && rc_throttle_control_in_filter.get() > LAND_CANCEL_TRIGGER_THR){
Log_Write_Event(DATA_LAND_CANCELLED_BY_PILOT);
// exit land if throttle is high
if (!set_mode(LOITER)) {
set_mode(ALT_HOLD);

6
ArduCopter/control_rtl.cpp

@ -267,7 +267,8 @@ void Copter::rtl_descent_run() @@ -267,7 +267,8 @@ void Copter::rtl_descent_run()
// process pilot's input
if (!failsafe.radio) {
if((g.throttle_behavior & THR_BEHAVE_HIGH_THROTTLE_CANCELS_LAND) != 0 && rc_throttle_control_in_filter.get() > 0.7f*THR_MAX){
if ((g.throttle_behavior & THR_BEHAVE_HIGH_THROTTLE_CANCELS_LAND) != 0 && rc_throttle_control_in_filter.get() > LAND_CANCEL_TRIGGER_THR){
Log_Write_Event(DATA_LAND_CANCELLED_BY_PILOT);
// exit land if throttle is high
if (!set_mode(LOITER)) {
set_mode(ALT_HOLD);
@ -362,7 +363,8 @@ void Copter::rtl_land_run() @@ -362,7 +363,8 @@ void Copter::rtl_land_run()
// process pilot's input
if (!failsafe.radio) {
if((g.throttle_behavior & THR_BEHAVE_HIGH_THROTTLE_CANCELS_LAND) != 0 && rc_throttle_control_in_filter.get() > 0.7f*THR_MAX){
if ((g.throttle_behavior & THR_BEHAVE_HIGH_THROTTLE_CANCELS_LAND) != 0 && rc_throttle_control_in_filter.get() > LAND_CANCEL_TRIGGER_THR){
Log_Write_Event(DATA_LAND_CANCELLED_BY_PILOT);
// exit land if throttle is high
if (!set_mode(LOITER)) {
set_mode(ALT_HOLD);

1
ArduCopter/defines.h

@ -333,6 +333,7 @@ enum FlipState { @@ -333,6 +333,7 @@ enum FlipState {
#define DATA_ROTOR_RUNUP_COMPLETE 58 // Heli only
#define DATA_ROTOR_SPEED_BELOW_CRITICAL 59 // Heli only
#define DATA_EKF_ALT_RESET 60
#define DATA_LAND_CANCELLED_BY_PILOT 61
// Centi-degrees to radians
#define DEGX100 5729.57795f

Loading…
Cancel
Save