Allow navigation modes to override MOTOR_STOP
If manual RTH is enabled with throttle stick at zero and MOTOR_STOP enabled - quad will fall out of the sky. For plane it's also a certain crash if pilot won't open throttle.
For safety reasons we should allow at least RTH and WP to override MOTOR_STOP
Motor_stop and Althold also needs to be discussed.
My the problem I think is:
For airplanes it's natural to use motor_stop and is really the recommended way to have it.
For Multirotor motor_stop is just a stupid idea. Only reason for having it is if you lack and arm switch, but still then you have stick disarm. Example DJI drones propellers always spin when arm, and they only have stick disarm combo.
Now if I enable RTL on plane with MOTOR_STOP and throttle=min plane goes crazy, don't turn correctly etc. If this is possible will be really useful make navigation works but if user keep throttle below min_check just turn off ALT hold but try to fly to next WP. It will be a great feature to gliders.
From my reading of the code, it looks like this could affect failsafe when it's set to RTH, so this should be fixed (or mitigated) ASAP.
A plane with MOTOR_STOP gliding with THROTTLE <= min which goes out or the RC receiver range will crash, since failsafeProcedureLogic_t for FAILSAFE_PROCEDURE_RTH sets the THROTTLE channel to FAILSAFE_CHANNEL_HOLD. See https://github.com/iNavFlight/inav/blob/master/src/main/flight/failsafe.c#L117
For airplanes it's natural to use motor_stop and is really the recommended way to have it.
I agree but why do we have to additionally set a parameter like motor_stop to have natural behavior of throttle control on fixed wings? I know, iNav was intended for multirotors first, but... The way I see it, spinning motors on zero throttle is a feature for multirotors and motor_stop is a parameter to override this preset feature. It would make more sense if stopped motors on zero throttle were default behavior and instead of having motor_stop parameter we would then have e.g. "idle throttle" parameter to set for multirotors. This way there would be nothing to override throttle values in nav modes by moving sticks (other than disarming).
EDIT: long story short: overriding motor_stop would be like overriding an override
For Multirotor motor_stop is just a stupid idea.
I can not agree with you @oleost . It is a very impressive maneuver to stop the motors during the flight and let the multicopter fall for few seconds. But it have to work reliable.
I have a crazy idea: let's get rid of MOTOR_STOP feature and assume it is always disable for MR and enabled for FW? Less is better and will solve a problem of users enabling it when they should not. Not only in NAV modes, but as a general rule
@DzikuVx I'd totally support the idea of getting rid of the setting on FW and assuming it's always on.
However, there are use cases for enabling MOTOR_STOP on MC. For example, in small models for indoor use. Not that I think we shouldn't remove it on MC (you're probably better off with ßF than INAV on an small indoor model), it's just that I'm not as sure as in the FW case.
I also wrote this in the PR, but it seems the bulk of the discussion is going on on this issue, so I'll replicate it here.
Mostly agree with ignoring MOTOR_STOP in RTH and WP modes. I know that it complicates the documentation a bit more, but I think we should always respect MOTOR_STOP when using stick arming or auto arming. Otherwise there's no fast way to turn off the motor[s] when shit hits the fan (no pun intended).
Automatic modes (RTH, WP) do not accept user input. Why should throttle stick being at zero matter more than it being at 50% or 100%?
When user is controlling the machine (all non-auto modes) - I agree, MOTOR_STOP must be respected.
@digitalentity It's not about user input, it is about having a fast "oh shit" mechanism when something goes wrong. Without an arm switch nor kill switch, there's no way to quickly stop an aircraft flying itself which is headed for some trees or a building other than enabling MOTOR_STOP and lowering THR. I think we should keep that functionality.
We could just add a function bool hasQuickStopSwitch() in rc_modes.h which would return true when using switch arming or having a kill switch mode configured. Then just change the PR:
bool userMotorStop = !navigationIsFlyingAutonomousMode() && ...
To
bool userMotorStop = (!navigationIsFlyingAutonomousMode() || !hasQuickStopSwitch()) &&
Just for completeness, if it was up to me I'd remove stick arming and auto arming completely. They feel very unsafe to me. However, if we're keeping them we need to keep at least some safety measures for those use cases too.
Please do not even consider removing stick arm / disarm; my muscle memory will never forgive you.
And I have this recurring nightmare about accidentally knocking the arm switch.
All this is making configuring very tricky and somewhat inconsistent. Personally, I'm ok with how it works now - motor stop always respects user input (given there is valid user input = ! failsafe). However people are reporting issues with RTH falling out of the sky if throttle stick position is at zero (which by the way is a valid behavior IMO).
Let's discuss futher if we want nav modes to be able to override motor stop at all.
Let's discuss futher if we want nav modes to be able to override motor stop at all.
How about working with existing parameters, one of which is min_throttle.
Please correct me if I'm wrong but if we set min_throttle to 1000 motor(s) will stop when throttle stick = min in all modes where throttle is actively controlled by the pilot even without MOTOR_STOP enabled. However, nav_modes would still rely on nav_fw_min_thr.
So with min_throttle = 1000 and MOTOR_STOP = OFF it should still be possible to stop the motors (for safety or for gliding) in non-nav_modes but it would prevent you from stopping the motor in nav_modes unless aircraft is disarmed.
I'm still against including an additional override for MOTOR_STOP since MOTOR_STOP already acts as an override (see my first post).
So with min_throttle = 1000 and MOTOR_STOP = OFF it should still be possible to stop the motors (for safety or for gliding) in non-nav_modes but it would prevent you from stopping the motor in nav_modes unless aircraft is disarmed.
Works perfectly on the bench (with min_throttle = 1005, however). Motor stops at zero throttle in ACRO, ANGLE, PASSTHROUGH. Motor keeps running at zero throttle in ALTHOLD. I'm going to test this with RTH etc. in the air today.
EDIT: works perfectly in the air as well. Stopping motor at zero throttle is prevented in all nav-modes including RTH but possible in ACRO, ANGLE, PASSTHROUGH.
Another option is to remove MOTOR_STOP as a feature and make it a BOX mode assignable to a switch. This way user will be able to chose his own flexible behavior.
Similar to AIRMODE. We have a feature to enable it permanently + we have a mode that allows user to chose when it should be enabled.
Great idea, not necessarily new user friendly but gives a lot of flexibility.
It won't change current behavor if you use it as a feature, but using it as a mode will allow user to disable it for althold/RTH. I agree it's not 100% user friendly, but it will give users an option to configure it to their liking.
Ok, I've moved https://github.com/iNavFlight/inav/pull/2259 to 1.9, we'll have a MOTOR_STOP mode in 1.8
It won't change current behavor if you use it as a feature, but using it as a mode will allow user to disable it for althold/RTH.
Sounds good and most flexible.
Do you think I'm running into any issues with my approach above? If not, I'll just stick with it because it seems to do exactly what I need.