Copter: ignore yaw input during radio failsafe
This commit is contained in:
parent
4b3aff3f91
commit
f8165c2864
@ -1410,6 +1410,13 @@ bool set_yaw_mode(uint8_t new_yaw_mode)
|
||||
// 100hz update rate
|
||||
void update_yaw_mode(void)
|
||||
{
|
||||
int16_t pilot_yaw = g.rc_4.control_in;
|
||||
|
||||
// do not process pilot's yaw input during radio failsafe
|
||||
if (failsafe.radio) {
|
||||
pilot_yaw = 0;
|
||||
}
|
||||
|
||||
switch(yaw_mode) {
|
||||
|
||||
case YAW_HOLD:
|
||||
@ -1418,12 +1425,12 @@ void update_yaw_mode(void)
|
||||
control_yaw = ahrs.yaw_sensor;
|
||||
}
|
||||
// heading hold at heading held in control_yaw but allow input from pilot
|
||||
get_yaw_rate_stabilized_ef(g.rc_4.control_in);
|
||||
get_yaw_rate_stabilized_ef(pilot_yaw);
|
||||
break;
|
||||
|
||||
case YAW_ACRO:
|
||||
// pilot controlled yaw using rate controller
|
||||
get_yaw_rate_stabilized_bf(g.rc_4.control_in);
|
||||
get_yaw_rate_stabilized_bf(pilot_yaw);
|
||||
break;
|
||||
|
||||
case YAW_LOOK_AT_NEXT_WP:
|
||||
@ -1438,7 +1445,7 @@ void update_yaw_mode(void)
|
||||
get_stabilize_yaw(control_yaw);
|
||||
|
||||
// if there is any pilot input, switch to YAW_HOLD mode for the next iteration
|
||||
if( g.rc_4.control_in != 0 ) {
|
||||
if (pilot_yaw != 0) {
|
||||
set_yaw_mode(YAW_HOLD);
|
||||
}
|
||||
break;
|
||||
@ -1452,7 +1459,7 @@ void update_yaw_mode(void)
|
||||
get_look_at_yaw();
|
||||
|
||||
// if there is any pilot input, switch to YAW_HOLD mode for the next iteration
|
||||
if( g.rc_4.control_in != 0 ) {
|
||||
if (pilot_yaw != 0) {
|
||||
set_yaw_mode(YAW_HOLD);
|
||||
}
|
||||
break;
|
||||
@ -1466,7 +1473,7 @@ void update_yaw_mode(void)
|
||||
get_circle_yaw();
|
||||
|
||||
// if there is any pilot input, switch to YAW_HOLD mode for the next iteration
|
||||
if( g.rc_4.control_in != 0 ) {
|
||||
if (pilot_yaw != 0) {
|
||||
set_yaw_mode(YAW_HOLD);
|
||||
}
|
||||
break;
|
||||
@ -1482,7 +1489,7 @@ void update_yaw_mode(void)
|
||||
get_stabilize_yaw(control_yaw);
|
||||
|
||||
// if there is any pilot input, switch to YAW_HOLD mode for the next iteration
|
||||
if( g.rc_4.control_in != 0 ) {
|
||||
if (pilot_yaw != 0) {
|
||||
set_yaw_mode(YAW_HOLD);
|
||||
}
|
||||
break;
|
||||
@ -1504,7 +1511,7 @@ void update_yaw_mode(void)
|
||||
control_yaw = ahrs.yaw_sensor;
|
||||
}
|
||||
// Commanded Yaw to automatically look ahead.
|
||||
get_look_ahead_yaw(g.rc_4.control_in);
|
||||
get_look_ahead_yaw(pilot_yaw);
|
||||
break;
|
||||
|
||||
case YAW_DRIFT:
|
||||
@ -1526,7 +1533,7 @@ void update_yaw_mode(void)
|
||||
get_stabilize_yaw(control_yaw);
|
||||
|
||||
// if there is any pilot input, switch to YAW_HOLD mode for the next iteration
|
||||
if( g.rc_4.control_in != 0 ) {
|
||||
if (pilot_yaw != 0) {
|
||||
set_yaw_mode(YAW_HOLD);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user