ardupilot icon indicating copy to clipboard operation
ardupilot copied to clipboard

critical | Set auto_armed bug

Open jason4short opened this issue 13 years ago • 3 comments

If the user is in RTL, pulls the throttle low, then enters any other AP mode (such as Land) the engines will stop and the copter will fall.

try it at http://jasonshort.com

fix: Add check for current state of auto_armed before disarming it.

move this check to the end of set_mode()

// used to stop fly_aways
// set to false if we have low throttle
if(ap.manual_throttle){
    motors.auto_arm(g.rc_3.control_in > 0 || ap.failsafe_radio);
        set_auto_armed(g.rc_3.control_in > 0 || ap.failsafe_radio);
}

or even better:

// used to stop fly_aways
// set to false if we have low throttle
if(ap.manual_throttle && g.rc_3.control_in == 0){
motors.auto_arm(false);
    set_auto_armed(false);
}

also, ap.auto_armed should be removed since it's redundant.

jason4short avatar Apr 16 '13 22:04 jason4short

I had the same problem once!

2013/4/17 jason4short [email protected]

If the user is in RTL, pulls the throttle low, then enters any other AP mode (such as Land) the engines will stop and the copter will fall.

try it at http://jasonshort.com

fix: Add check for current state of auto_armed before disarming it.

move this check to the end of set_mode()

// used to stop fly_aways // set to false if we have low throttle if(ap.manual_throttle){ motors.auto_arm(g.rc_3.control_in > 0 || ap.failsafe_radio); set_auto_armed(g.rc_3.control_in > 0 || ap.failsafe_radio); }

or even better:

// used to stop fly_aways // set to false if we have low throttle if(ap.manual_throttle && g.rc_3.control_in == 0){ motors.auto_arm(false); set_auto_armed(false); }

also, ap.auto_armed should be removed since it's redundant.

— Reply to this email directly or view it on GitHubhttps://github.com/diydrones/ardupilot/issues/205 .

cehberlin avatar Apr 17 '13 02:04 cehberlin

    Yes, if this is the same bug that I think it is, they dont actually stop but rather go to minimum until the throttle is raised.

it's highlighted in red at the top of the 2.9.1 thread. Loiter/AltHold/Auto/RTL bug: if you switch into these modes with throttle at zero motors will go to minimum until you raise the throttle.

     It's definitely a serious issue though, thanks for the fix!  I'll merge asap!

-Randy


From: Christopher-Eyk Hrabia [email protected] To: diydrones/ardupilot [email protected] Sent: Wednesday, April 17, 2013 11:01 AM Subject: Re: [ardupilot] critical | Set auto_armed bug (#205)

I had the same problem once!

2013/4/17 jason4short [email protected]

If the user is in RTL, pulls the throttle low, then enters any other AP mode (such as Land) the engines will stop and the copter will fall.

try it at http://jasonshort.com

fix: Add check for current state of auto_armed before disarming it.

move this check to the end of set_mode()

// used to stop fly_aways // set to false if we have low throttle if(ap.manual_throttle){ motors.auto_arm(g.rc_3.control_in > 0 || ap.failsafe_radio); set_auto_armed(g.rc_3.control_in > 0 || ap.failsafe_radio); }

or even better:

// used to stop fly_aways // set to false if we have low throttle if(ap.manual_throttle && g.rc_3.control_in == 0){ motors.auto_arm(false); set_auto_armed(false); }

also, ap.auto_armed should be removed since it's redundant.

— Reply to this email directly or view it on GitHubhttps://github.com/diydrones/ardupilot/issues/205 .

— Reply to this email directly or view it on GitHub.

rmackay9 avatar Apr 17 '13 02:04 rmackay9

I've pushed a fix for this. https://github.com/diydrones/ardupilot/commit/d2bd818b2dc3e39a8eef91ec67b8b0679ac87980

I took a slightly different approach. I don't think the auto_arm flag ever really belonged in the AP_Motors class. I actually moved it in there when I first wrote the class but I think that was a mistake. I've changed it so that we now rely on the ap.auto_armed flag instead.

Also I've consolidated the checks for whether ap.auto_armed should be true or false in a single function that is called at 50hz from the main loop. I think this is better in that it keeps all the logic for this flag in one place. It's slightly less efficient in that it does a couple more checks than the old way but those checks are extremely fast so it shouldn't contribute significantly to our existing performance issues.

rmackay9 avatar Apr 17 '13 12:04 rmackay9