Skip to content
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

FailureDetector (safe version) #10202

Merged
merged 14 commits into from
Aug 28, 2018
Merged

Conversation

bresch
Copy link
Member

@bresch bresch commented Aug 9, 2018

Save version of #10179

This PR has no "dangerous" changes as it only sets a flag bit in failure_detector_status in vehicle_status but doesn't activate a failsafe action.

This PR needs to go in master for testing and is completely invisible to the user.

The failsafe triggering part will come in a future PR.

FYI @LorenzMeier @dagar @JohannesBrand

* @unit degrees
* @group Commander
*/
PARAM_DEFINE_INT32(COM_FAIL_R, 60);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you foresee the list of FailureDetector parameters growing I'd break it off into a new group (and param file) now.

@@ -2385,6 +2386,32 @@ Commander::run()
}
}


/* Check for failure detector status */
if (armed.armed) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

&& vehicle_control_mode.flag_control_attitude_enabled?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to leave it like this as it is just an absolute attitude check and not an attitude error check (for now).

@dagar
Copy link
Member

dagar commented Aug 9, 2018

Shouldn't this be based on the error rather than absolute angle? This shouldn't be oblivious to the controller configuration.

@bresch
Copy link
Member Author

bresch commented Aug 9, 2018

Shouldn't this be based on the error rather than absolute angle?

Yes, but he problem is the setpoint jumps...

@dagar
Copy link
Member

dagar commented Aug 9, 2018

Shouldn't this be based on the error rather than absolute angle?

Yes, but he problem are the setpoint jumps...

I know, but I'm talking about more of a usability concern. The user shouldn't be able to configure this such that it triggers under normal operation. This is one of the reasons I had originally wondered about the controller being responsible for raising the error condition, and commander the actual triggering.

@bresch
Copy link
Member Author

bresch commented Aug 9, 2018

@dagar Absolutely, we might add a check to make sure the parameters are larger than the max roll/pitch values of the controller. Basically, with this PR, I just want to introduce the general skeleton of the failure detector. The logic inside is really simple and will be improved later.
It will also be a good reason to fix the setpoint jumps :)

@dagar
Copy link
Member

dagar commented Aug 9, 2018

Let me start by saying the PR in its current form looks good and I'm happy to merge it once we get it to fit.

we might add a check to make sure the parameters are larger than the max roll/pitch values of the controller. Basically, with this PR, I just want to introduce the general skeleton of the failure detector.

Yes exactly, but my (future) concern is that this piece within commander then becomes dependent on attitude controller internals (particular parameters for each vehicle and how they're used in different contexts). Which is one of the reasons I get hung up on the architecture now for something so simple.

@@ -67,7 +74,7 @@ bool high_latency_data_link_active # all low latency datalinks to GCS lost
uint8 data_link_lost_counter # counts unique data link lost events
bool engine_failure # Set to true if an engine failure is detected
bool mission_failure # Set to true if mission could not continue/finish
bool attitude_failure # Set to true if attitude failure has been detected
uint8 failure_detector_status # Bitmask containing FailureDetector status [0, 0, 0, 0, 0, FAILURE_ALT, FAILURE_PITCH, FAILURE_ROLL]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine, but you can feel free to use bools here if you want. The message is low rate so the space savings are negligible. For code though it requires more work to get or set a bit, and then for log analysis it ends up being a mess because the constants are lost.

For example estimator_status bitfields (https://github.com/PX4/Firmware/blob/master/msg/estimator_status.msg#L25) ended up being a poor choice. These constants have been manually duplicated across both ecl and Firmware, the ecl analysis python scripts under Tools, in Flight review, etc. They're also fairly inaccessible with flightplot.

tl;dr - booleans + publish on change is your friend

@LorenzMeier
Copy link
Member

Could you please rebase? Thanks!

@bresch bresch force-pushed the pr-failure-detector-safe branch from c03b6f9 to f01e816 Compare August 16, 2018 22:17
@bresch
Copy link
Member Author

bresch commented Aug 16, 2018

Rebased on master

@bresch
Copy link
Member Author

bresch commented Aug 20, 2018

@dagar Is it fine to merge now?

* @min 0
* @max 180
* @unit degrees
* @group FailureDetector
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the group shown in the QGC parameter tree and contain spaces.

eg @group FW L1 Control

dagar
dagar previously approved these changes Aug 28, 2018
@dagar
Copy link
Member

dagar commented Aug 28, 2018

That's odd, github won't let me "Rebase and merge", but I could still "Squash and merge".

If you're fine with this going into master as single merged commit we can merge now, otherwise please rebase on master and we'll try again.

bresch added 11 commits August 28, 2018 16:22
…puts PX4_ERR messages if roll or pitch is exceeded.
…nd io. A Null mixer can now be used to set a fixed value: "disarmed" if the system is operational or "failsafe" in failsafe mode
- use pragma once guard in FailureDetector.hpp
- send Commander parent to ModuleParams and remove update_params() method
- simplify attitude checks
- FailureDetector::get_status() (previously named "get") is now a constant method that returns a constant reference
…protection; remove PX4_WARN and send mavlink msg only once
@bresch
Copy link
Member Author

bresch commented Aug 28, 2018

@dagar Rebased on master! :) Hope it works now

@dagar
Copy link
Member

dagar commented Aug 28, 2018

Thanks, everything looks good now.

@dagar dagar merged commit 124a34e into PX4:master Aug 28, 2018
@bresch bresch deleted the pr-failure-detector-safe branch August 28, 2018 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants