-
Notifications
You must be signed in to change notification settings - Fork 13.6k
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
Cherry pick the src/modules/land_detector/
directory work from PR #9756
#11874
Merged
MaEtUgR
merged 1 commit into
PX4:master
from
mcsauder:vehicle_imu_PR_land_detector_cherry_pick
Oct 14, 2019
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,8 +39,6 @@ | |
* @author Julian Oes <[email protected]> | ||
*/ | ||
|
||
#include <matrix/math.hpp> | ||
|
||
#include "FixedwingLandDetector.h" | ||
|
||
namespace land_detector | ||
|
@@ -55,35 +53,20 @@ FixedwingLandDetector::FixedwingLandDetector() | |
|
||
void FixedwingLandDetector::_update_topics() | ||
{ | ||
LandDetector::_update_topics(); | ||
_airspeed_sub.update(&_airspeed); | ||
_vehicle_acceleration_sub.update(&_vehicle_acceleration); | ||
_vehicle_local_position_sub.update(&_vehicle_local_position); | ||
} | ||
|
||
void FixedwingLandDetector::_update_params() | ||
{ | ||
// check for parameter updates | ||
if (_parameter_update_sub.updated()) { | ||
// clear update | ||
parameter_update_s pupdate; | ||
_parameter_update_sub.copy(&pupdate); | ||
|
||
// update parameters from storage | ||
_update_params(); | ||
} | ||
} | ||
|
||
float FixedwingLandDetector::_get_max_altitude() | ||
{ | ||
// TODO | ||
// This means no altitude limit as the limit | ||
// is always current position plus 10000 meters | ||
// TODO: This means no altitude limit as the limit | ||
// is always current position plus 10000 meters. | ||
return roundf(-_vehicle_local_position.z + 10000); | ||
} | ||
|
||
bool FixedwingLandDetector::_get_landed_state() | ||
{ | ||
// only trigger flight conditions if we are armed | ||
// Only trigger flight conditions if we are armed. | ||
if (!_actuator_armed.armed) { | ||
return true; | ||
} | ||
|
@@ -116,11 +99,11 @@ bool FixedwingLandDetector::_get_landed_state() | |
|
||
_xy_accel_filtered = _xy_accel_filtered * 0.8f + acc_hor * 0.18f; | ||
|
||
// crude land detector for fixedwing | ||
landDetected = _xy_accel_filtered < _param_lndfw_xyaccel_max.get() | ||
&& _airspeed_filtered < _param_lndfw_airspd.get() | ||
// Crude land detector for fixedwing. | ||
landDetected = _airspeed_filtered < _param_lndfw_airspd.get() | ||
&& _velocity_xy_filtered < _param_lndfw_vel_xy_max.get() | ||
&& _velocity_z_filtered < _param_lndfw_vel_z_max.get(); | ||
&& _velocity_z_filtered < _param_lndfw_vel_z_max.get() | ||
&& _xy_accel_filtered < _param_lndfw_xyaccel_max.get(); | ||
|
||
} else { | ||
// Control state topic has timed out and we need to assume we're landed. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@mcsauder this is not correct, it re-loads the params every cycle now, as there is no check for
_parameter_update_sub
here. You can move the_parameter_update_sub.updated()
check out ofLandDetector::_update_params
around the_update_params();
inLandDetector::Run()
(and get rid of theforce
argument).(Alternatively you can rename this method here to
void updateParams() override;
, and then makeLandDetector::_update_params
non-virtual)There also needs to be a call to
updateParams()
inLandDetector::_update_params
.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.
Hi @bkueng , I might be mistaken, but with the default argument
force = false
, I don't think that passing theforce
argument fromMulticopterLandDetector::_update_param(const bool force = false)
will result in re-loading the params every cycle. It would only result in forcing a reload if somewhere else this method is being called with a true argument, which doesn't happen anywhere I am able to find. Let me know if I'm not seeing things correctly.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.
Ah, I think I see that your concern is with the additional 4 param_get() calls. I'll work on getting a PR opened to address that.