How to modify firmware for motors power loss (in Copter 4.0)

Hello everyone!

I should implement a motor failure of a drone throught the modification of the firmware and I have already seen the discussion at the following link:


However, it is not possible to build the code already implemented in the link below:
https://github.com/AzurDrones/ardupilot/tree/motor_failure_switch. I tried to implement the changes inside the ArduPilot master, however in “libraries / AP_Motors / AP_MotorsMatrix.cpp” at the moment there is no longer the “motor_out” variable that was modified in the fault case, instead in its place there is the “_actuator” variable which does not indicate the pwm to be sent to the motors (as you can see in the picture). How can I change the implementation of the fault indicated in the first link? @rmackay9 @khancyr

Thank you!

1 Like

Try this PR: https://github.com/ArduPilot/ardupilot/pull/15965
And post your results here.

1 Like

Hi Lucas @amilcarlucas ,

I don’t want to completely shut down the motors and sensors but introduce a percentage power loss on the motors and a noise on the sensors. Do you have any idea?

Thanks in advance for the reply!

Use that PR as a starting point, and post your changes as a PR, then we can take a look at it.

I have implemented the GPS kill but once the remote control lever is set, the GPS loses the signal but immediately afterwards it regains it by itself without operating the lever again. How can I make sure that when the KILL_GPS is activated, it remains active?

Can you share your code changes?