mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-11 02:13:57 -04:00
Copter: support inverted flight CH7 option
This commit is contained in:
parent
f07aac396c
commit
951ed95eb9
@ -631,6 +631,7 @@ private:
|
|||||||
struct {
|
struct {
|
||||||
uint8_t dynamic_flight : 1; // 0 // true if we are moving at a significant speed (used to turn on/off leaky I terms)
|
uint8_t dynamic_flight : 1; // 0 // true if we are moving at a significant speed (used to turn on/off leaky I terms)
|
||||||
uint8_t init_targets_on_arming : 1; // 1 // true if we have been disarmed, and need to reset rate controller targets when we arm
|
uint8_t init_targets_on_arming : 1; // 1 // true if we have been disarmed, and need to reset rate controller targets when we arm
|
||||||
|
uint8_t inverted_flight : 1; // 2 // true for inverted flight mode
|
||||||
} heli_flags;
|
} heli_flags;
|
||||||
|
|
||||||
int16_t hover_roll_trim_scalar_slew;
|
int16_t hover_roll_trim_scalar_slew;
|
||||||
|
@ -71,6 +71,7 @@ enum aux_sw_func {
|
|||||||
AUXSW_AVOID_PROXIMITY = 40, // enable object avoidance using proximity sensors (ie. horizontal lidar)
|
AUXSW_AVOID_PROXIMITY = 40, // enable object avoidance using proximity sensors (ie. horizontal lidar)
|
||||||
AUXSW_ARMDISARM = 41, // arm or disarm vehicle
|
AUXSW_ARMDISARM = 41, // arm or disarm vehicle
|
||||||
AUXSW_SMART_RTL = 42, // change to SmartRTL flight mode
|
AUXSW_SMART_RTL = 42, // change to SmartRTL flight mode
|
||||||
|
AUXSW_INVERTED = 43, // enable inverted flight
|
||||||
AUXSW_SWITCH_MAX,
|
AUXSW_SWITCH_MAX,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -196,6 +196,7 @@ void Copter::init_aux_switch_function(int8_t ch_option, uint8_t ch_flag)
|
|||||||
case AUXSW_AVOID_ADSB:
|
case AUXSW_AVOID_ADSB:
|
||||||
case AUXSW_PRECISION_LOITER:
|
case AUXSW_PRECISION_LOITER:
|
||||||
case AUXSW_AVOID_PROXIMITY:
|
case AUXSW_AVOID_PROXIMITY:
|
||||||
|
case AUXSW_INVERTED:
|
||||||
do_aux_switch_function(ch_option, ch_flag);
|
do_aux_switch_function(ch_option, ch_flag);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -606,6 +607,23 @@ void Copter::do_aux_switch_function(int8_t ch_function, uint8_t ch_flag)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case AUXSW_INVERTED:
|
||||||
|
#if FRAME_CONFIG == HELI_FRAME
|
||||||
|
switch (ch_flag) {
|
||||||
|
case AUX_SWITCH_HIGH:
|
||||||
|
motors->set_inverted_flight(true);
|
||||||
|
attitude_control->set_inverted_flight(true);
|
||||||
|
heli_flags.inverted_flight = true;
|
||||||
|
break;
|
||||||
|
case AUX_SWITCH_LOW:
|
||||||
|
motors->set_inverted_flight(false);
|
||||||
|
attitude_control->set_inverted_flight(false);
|
||||||
|
heli_flags.inverted_flight = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user