ArduPilot / ardupilot

ArduPlane, ArduCopter, ArduRover, ArduSub source
http://ardupilot.org/
GNU General Public License v3.0
10.96k stars 17.48k forks source link

Land craft when overcurrent flag detected #26668

Open HoverflyHampton opened 7 months ago

HoverflyHampton commented 7 months ago

Feature request

Is your feature request related to a problem? Please describe. We recently had an issue where a loose connector caused an overcurrent in the peripheral GPS on our system. This was detected by the software, and was logged with the power status flags. The overcurrent was momentary, so the GPS did not stay down but rebooted. Unfortunately, since our GPS needs some startup settings on boot, and didn't receive them after the unexpected reboot, it began providing valid but inaccurate data to the craft which caused a flyaway of the craft.

Describe the solution you'd like Since Ardupilot is already monitoring the power status flags (in order to send them to the ground station and to log them) it would be useful if the craft was able to act based on the flags. Specifically, in our use case it would be nice to land the craft if VDD_5V_HIPOWER_OC and VDD_5V_PERIPH_OC are detected in the power status flags or the accumulated power status flags. Perhaps there could be a parameter that defines craft behavior in the event of an overcurrent?

Describe alternatives you've considered As an alternate solution, we could cut power to the peripherals if the overcurrent is detected. This would prevent the GPS from rebooting and with no GPS the craft would go into land mode automatically. Right now there is a method for peripheral_power_enable at startup - adding a peripheral_power_disable equivalent that could be called when the overcurrent is detected would allow us to shutdown a bad GPS

Platform [ ] All [ ] AntennaTracker [X] Copter [ ] Plane [ ] Rover [ ] Submarine

IamPete1 commented 7 months ago

We could add bindings to scripting so you could write your own fail safe behavior. I think its a bit too unusual to add a fail safe for this to the main code.