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

MCLandDetector: fix low thrust detection in stabilized mode #14731

Merged
merged 1 commit into from Apr 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/modules/land_detector/MulticopterLandDetector.cpp
Expand Up @@ -118,8 +118,15 @@ void MulticopterLandDetector::_update_params()
param_get(_paramHandle.useHoverThrustEstimate, &use_hover_thrust_estimate);
_params.useHoverThrustEstimate = (use_hover_thrust_estimate == 1);

if (!_params.useHoverThrustEstimate) {
if (!_params.useHoverThrustEstimate || !_hover_thrust_initialized) {
param_get(_paramHandle.hoverThrottle, &_params.hoverThrottle);

// HTE runs based on the position controller so, even if we wish to use
// the estimate, it is only available in altitude and position modes.
// Therefore, we need to always initialize the hoverThrottle using the hover
// thrust parameter in case we fly in stabilized
// TODO: this can be removed once HTE runs in all modes
_hover_thrust_initialized = true;
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/modules/land_detector/MulticopterLandDetector.h
Expand Up @@ -129,6 +129,8 @@ class MulticopterLandDetector : public LandDetector
vehicle_control_mode_s _vehicle_control_mode {};
vehicle_local_position_setpoint_s _vehicle_local_position_setpoint {};

bool _hover_thrust_initialized{false};

hrt_abstime _min_trust_start{0}; ///< timestamp when minimum trust was applied first
hrt_abstime _landed_time{0};

Expand Down