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

land_detector: quick workaround for MC NAN setpoints #15426

Closed
wants to merge 1 commit into from

Conversation

dagar
Copy link
Member

@dagar dagar commented Jul 27, 2020

This is a quick fix for one of the issues found in the process of fixing other MC land detector issues.

When the multicopter position controller sees ground_contact the setpoint reset (NANs) is briefly published on vehicle_local_position_setpoint. This can force the multicopter land detector _in_descend state immediately back to false which interrupts ground_contact if not currently in low thrust.

https://github.com/PX4/Firmware/blob/7354e3989335dfb38cc41216182f48fe84d165c7/src/modules/mc_pos_control/mc_pos_control_main.cpp#L644-L654

@dagar dagar force-pushed the pr-land_detector_finite_quickfix branch from 8395e3d to 2895168 Compare July 27, 2020 14:00
Copy link
Member

@MaEtUgR MaEtUgR left a comment

Choose a reason for hiding this comment

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

Just an idea, we can take your workaround first to not spent too long. It should work with the current setpoint generation implementation.


if (_vehicle_control_mode.flag_control_climb_rate_enabled && vz_valid) {
// setpoints can briefly be NAN to signal resets, TODO: fix in multicopter position controller
if (PX4_ISFINITE(_vehicle_local_position_setpoint.vz)) {
Copy link
Member

Choose a reason for hiding this comment

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

This means in every case where there's no vertical velocity setpoint the _in_descend state just stays how it was. The only cases that come to my mind where no vertical velocity setpoint is set (intentionally) are: the thrust cut when ground is detected (that's the constelation that leads to the bug you found) and the in failsafe descend when there's no RC and the vehicle looses the vertical velocity estimate.

What about we capture the case where there's no vertical velocity setpoint and in that case compare vertical acceleration. E.g. the thrust cut is a huge downwards acceleration to enable the land detector to detect maybe landed and landed. And with that huge downwards acceleration you expect no freefall.

Copy link
Member Author

Choose a reason for hiding this comment

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

The acceleration condition sounds good, I'm not sure what that wasn't already a factor. My only immediate concern is the current time scale of the ground contact and its hysteresis.

Copy link
Member Author

Choose a reason for hiding this comment

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

In flag_control_climb_rate_enabled (and vz_valid) if the vz setpoint is NAN we could just set _in_descend to true.

Copy link
Member Author

Choose a reason for hiding this comment

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

in failsafe descend when there's no RC and the vehicle looses the vertical velocity estimate.

Actually, this one isn't going to matter because ground_contact is only used by maybe_landed if vz and z estimates are valid.

@dagar
Copy link
Member Author

dagar commented Jul 28, 2020

Going back to the larger PR. #15083

@dagar dagar closed this Jul 28, 2020
@dagar dagar deleted the pr-land_detector_finite_quickfix branch July 28, 2020 17:59
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.

2 participants