New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Fix FMU MC failsafe on RC loss #5388
Conversation
Please rebase on master to fix CI. |
@julianoes Can you have a look? |
b4e574a
to
f7979c2
Compare
@@ -889,6 +891,12 @@ MulticopterAttitudeControl::task_main() | |||
vehicle_status_poll(); | |||
vehicle_motor_limits_poll(); | |||
|
|||
/* Simple handling of failsafe: kill motors if failsafe is on */ | |||
if (_termination_enabled && _v_control_mode.flag_control_termination_enabled) { | |||
_armed.lockdown = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't have any effect. The _armed
topic is subscribed here, not published.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I guess all we can do here is deploy a parachute, as in the FW case.
The remaining open question on this fix is how to repair the commander logic which sets flags.gps_failure. Since this is never set if there is no GPS module (one known problem case), there is currently no way to configure RC loss to cause motor shutdown (termination). My proposed fix works, but precludes a controlled descent on RC loss. Of course at this point (line 2703 of commander.cpp) we're already in termination state, not land or descend... Also, even if GPS were available, would it be wise to execute a powered descent, given that we have no idea what is below the vehicle? |
Even without GPS, the failsafe configuration should have an openloop descent as default. With GPS available, we can just close the altitude control loop. Even if we have no idea about what's below / exactly how high we are, it's safer than killing the motors. |
@mhkabir That's debatable. The FAI rules (http://www.fai.org/downloads/ciam/SC4_F3FPV_2016) for FPV racers state
and
|
I was talking about the general config (for most users). For racers, killing motors is obviously something we will have to support, as an extension of the flight termination state. |
Right now, all users will see a fly-away, and at least one user (besides me) would like to be able to prevent such out-of-control situations: |
I'll close this in another day or two unless there is further useful discussion |
@kd0aij, I will be joining this effort to fix failsafe handling. Just reviewing the state machine code now. |
Sorry @kd0aij for the lack of work and communication here. This is something that needs to be fixed for sure. I'll assign myself to keep it on the radar. |
@mhkabir @julianoes any progress on this? |
@kd0aij sorry I'm pretty busy. Will tackle it when I get a chance. |
@julianoes Any chance to get back to this? |
@kd0aij Ok I started debugging this with a Pixracer and a FrSky D4RII receiver and the first thing of master I tested was: |
I believe so. My PR addressed the case with GPS valid: On Mon, Oct 10, 2016 at 2:45 PM Julian Oes notifications@github.com wrote:
|
I'm sure I never (intentionally) flight tested RC loss under any On Mon, Oct 10, 2016 at 2:52 PM Mark Whitehorn kd0aij@gmail.com wrote:
|
Ok, I'll test with GPS next up. Unfortunately, I don't have the cable to wire the GPS up with the Pixracer. I'll have to do the test with a Pixhawk. |
Which behaviour did you want and test?? RTL or all props off? |
In non-assisted modes, this PR ensures that flight_termination state is entered, and that results in "lockdown", which is all motors stopped. No RTL. |
The remaining open question on this fix is how to repair the commander logic which sets flags.gps_failure. Since this is never set if there is no GPS module (one known problem case), there is currently no way to configure RC loss to cause motor shutdown (termination). My proposed fix works, but precludes a controlled descent on RC loss. Of course at this point (line 2703 of commander.cpp) we're already in termination state, not land or descend... Also, even if GPS were available, would it be wise to execute a powered descent, given that we have no idea what is below the vehicle? |
According to the commander state machine that's what we want to do. And I think it's what most other drones would do as well. If a drone comes down slowly it gives people the chance to step away. If it falls like a brick that's harder. I think I now understood that the RC loss issue you're addressing, is for the case where you want termination for racers. I think this is not properly implemented (and you're fixes might be the missing piece). I'll look closer at this case but I need to find the correct params first. As you said, documentation is hard to find about this 😢. |
Can one of the admins verify this patch? |
Jenkins add to whitelist. |
@kd0aij Can you rebase? |
31ab75d
to
8fdb5f9
Compare
The remaining open question on this fix is how to repair the commander logic which sets flags.gps_failure. Since this is never set if there is no GPS module (one known problem case), there is currently no way to configure RC loss to cause motor shutdown (termination). My proposed fix works, but precludes a controlled descent on RC loss. Of course at this point (line 2703 of commander.cpp) we're already in termination state, not land or descend... And for FPV racers, RC loss MUST result in motor shutdown, if I understand FAI rules correctly. |
I would also like to see motor shutdown option on RC loss +1 |
retesting: enters "LAND" mode on RC loss (Pixracer, no GPS, FrSky RX) Needs testing on fmu-v2/v3 |
Jenkins test this please |
@julianoes What do you think of this as an interim workaround for motor shutdown? If flight termination is disabled, the copter should just switch to LAND mode without shutting down the motors. |
superseded by #5863 ? |
This fixes some problems with RC loss failsafe when in manual modes on fmu-v4, but may break other things since it's not clear to me how it was intended to work.
It appears that failsafe would never be entered if in manual mode with a GPS connected.
Also, px4fmu quit running the output mixer when RC was lost.