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

UAVCAN ESCs pre-arm checks #12153

Closed
wants to merge 20 commits into from
Closed

UAVCAN ESCs pre-arm checks #12153

wants to merge 20 commits into from

Conversation

cmic0
Copy link
Contributor

@cmic0 cmic0 commented Jun 3, 2019

This PR introduces a new pre-arm check aimed for vehicles running UAVCAN ESCs.
Each actuator is monitored through a status flag introduced in the esc_status message:
If an ESC does not provide any data within a timeout threshold then is considered offline.
During pre-arm checks, if one or more motors are offline a warning message is published and arming is denied.
The feature is enabled by setting the COM_ACT_COUNTto the number of UAVCAN actuators.

Test data / coverage
Tested on a vehicle running Zubax Myxa ESCs. Reporting below the warning message that is triggered. In this case ESC3 and ESC2 were disconnected.
Screenshot from 2019-06-03 15-32-17

Describe possible alternatives
Actually the solution could be improved by taking the number of motors information from the mixer and use a circuit breaker for enabling/disabling the pre-arm check. Adding the parameter was the MVP solution for getting the pre-arm check to work.

Update 07/26:
Did some logic refactoring and got rid of COM_ACT_COUNT parameter.
Now the number of rotors is obtained through the mixer at boot.

Screenshot of bench testing:
condition_esc_valid
messages

Logs:
https://logs.px4.io/plot_app?log=6bfacd4a-9b37-413c-a333-8618dff6f3fc

The PR is now in a good shape. Only thing I am thinking that maybe is worth to add is a circuit breaker for disabling the feature?
@dagar @MaEtUgR FYI

@cmic0 cmic0 changed the title [WIP]: UAVCAN ESCs pre-arm checks UAVCAN ESCs pre-arm checks Jul 26, 2019
@cmic0
Copy link
Contributor Author

cmic0 commented Jul 26, 2019

Uh apparently the CI is not happy 🤕

@@ -1010,6 +1010,13 @@ bool prearm_check(orb_advert_t *mavlink_log_pub, const vehicle_status_flags_s &s

}

if (!status_flags.condition_escs_valid) {
Copy link
Contributor

Choose a reason for hiding this comment

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

@cmic0 This will fail for any vehicle which does not support the esc_status message.
Also check CI, SITL is actually complaining about ESC not being online :-D

// Check if ALL the ESCs are online
if (online_bitmask == esc_status.esc_online_flags) {
if (_last_esc_online_flags != esc_status.esc_online_flags) {
mavlink_log_info(&mavlink_log_pub, "All ESCs are ready");
Copy link
Contributor

Choose a reason for hiding this comment

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

@cmic0 I think we can get rid of this message. No need to tell the user what he does not need to know.

rotor_count = mixer->get_multirotor_count();

if (rotor_count > 0) {
mixer = nullptr;
Copy link
Contributor

Choose a reason for hiding this comment

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

@cmic0 I think you can use "break"

@cmic0
Copy link
Contributor Author

cmic0 commented Aug 6, 2019

Closing this one in favor as the cleaned-up PR #12641.

@cmic0 cmic0 closed this Aug 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants