PX4 / PX4-Autopilot

PX4 Autopilot Software
https://px4.io
BSD 3-Clause "New" or "Revised" License
8.5k stars 13.51k forks source link

Manual Overwrite not allowed in Stabilized Flight Mode #7860

Closed acfloria closed 6 years ago

acfloria commented 7 years ago

While testing the v1.6.5 of the PX4 Firmware I discovered that in the stabilized mode the manual overwrite is not allowed: https://github.com/PX4/Firmware/blob/master/src/modules/commander/commander.cpp#L3895-L3896

The result is that if the FMU crashes the mixer enters the MIX_FAILSAFE mode and sets zero commands for all outputs. Therefore the plane will crash. By allowing the OVERRIDE flag to be set the pilot could at least try to land the plane in the manual mode.

dagar commented 7 years ago

(Duplicated on discuss: http://discuss.px4.io/t/failsafe-in-case-of-an-fmu-crash-for-an-airplane/4209/7) It seems like you'd want the servos to go to the failsafe values unless you were already in manual (then continue in manual mode). You should also be able to switch into manual mode in that state. Is the px4io capable of interpreting mode switches? I need to review the code.

TSC21 commented 7 years ago

May this become handy @dagar? https://github.com/PX4/Firmware/pull/4177

dagar commented 7 years ago

Looks like the px4io is only aware of the "old" style mode switch configuration. https://github.com/PX4/Firmware/blob/master/src/drivers/px4io/px4io.cpp#L1615

We should really kill that off and have only one configuration.

@TSC21 no I don't believe so, but it's interesting.

TSC21 commented 7 years ago

We should really kill that off and have only one configuration.

Yeah checking the same also. We should level the RC channel config for all drivers/modules.

acfloria commented 7 years ago

During testing I checked that the value of RC_MAP_MODE_SW is set correctly. When simulating a crash of the FMU by stopping the attitude controller this enabled me to switch to the manual mode and still control the plane. However, in a total crash of the FMU (either by coding an error or holding the restart button) I was not able anymore to change to the manual mode.

acfloria commented 7 years ago

I looked a bit into the code and I wasn't able to find the functionality for mode switching in the px4io firmware. So I have two questions:

  1. Is there a functionality implemented to switch the modes in the px4io based on the switch RC_MAP_MODE_SW

  2. Why is the manual override not ok in the stabilized mode? https://github.com/PX4/Firmware/blob/master/src/modules/commander/commander.cpp#L3909

dagar commented 7 years ago

It's handled on the px4io driver side that runs on the fmu. https://github.com/PX4/Firmware/blob/master/src/drivers/px4io/px4io.cpp#L1615

Manual override is not okay for multicopters in stabilized mode. I agree it's better than nothing for planes.

acfloria commented 7 years ago

The manual override is by default disabled for vtol and rotary wings, so setting it explicitly to false should only affect fixed wing planes: https://github.com/PX4/Firmware/blob/master/src/modules/commander/commander.cpp#L3877

proficnc commented 7 years ago

Even on a quadplane, a manual override attempt is better than a crash.... more complex... but better...

acfloria commented 6 years ago

@dagar couldn't we allow the manual override in the stabilized mode until we have proper solution for the mode switch in the px4io firmware?

acfloria commented 6 years ago

Fixed by #8062