-
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
Implement ModuleParams inheritance in the MultiCopterLandDetector class. #12356
Implement ModuleParams inheritance in the MultiCopterLandDetector class. #12356
Conversation
@bkueng or @dagar, would you be willing to advise me on this UPDATED: I cannot compile fmu-v2_fixedwing or fmu-v2_rover on my local machine either. I am investigating. Thank you for your advice. NOTE: This issue is occurring because the fixedwing build is not including the This is an issue now because the usage of How can this be addressed? |
This is because Short term the easy workaround is to keep using the old API for that particular param. One idea longer term would be to restructure this so that each vehicle type has a land detector with all the common code moving to a library. |
88fee3f
to
416da5b
Compare
@dagar, I've implemented your suggestion, squashed commits, rebased against current upstream, and re-flight tested:
EDIT: All flight tests perform as expected, identical to the current master branch. |
if (_param_update_sub.update(¶m_update)) { | ||
_update_params(); | ||
_freefall_hysteresis.set_hysteresis_time_from(false, (hrt_abstime)(1e6f * _param_lndmc_ffall_ttri.get())); | ||
_param_lndmc_rot_max.set(math::radians(_param_lndmc_rot_max.get())); |
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.
I suppose you can get away with this, but it seems kind of shady (remote possibility of accidentally committing the value). I would do the math::radians call at runtime to keep it simple.
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.
You're right, that was wrong. Fixed, rebased against current master and squashed into one commit.
cd634c1
to
d5d13e7
Compare
cdfa90f
to
b10f096
Compare
@@ -213,11 +204,11 @@ bool MulticopterLandDetector::_get_maybe_landed_state() | |||
} | |||
|
|||
// Next look if all rotation angles are not moving. | |||
float maxRotationScaled = _params.maxRotation_rad_s * landThresholdFactor; | |||
float maxRotationScaled = math::radians(_param_lndmc_rot_max.get()) * landThresholdFactor; |
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.
@dagar, the issue you highlighted is addressed here.
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.
Flight test land detection works properly and the value checks out when queried: https://review.px4.io/plot_app?log=9c628e6e-b90e-4d1b-9308-e6b5a8cc15b5
b10f096
to
e3d18aa
Compare
90784f9
to
31817d8
Compare
31817d8
to
4b44ee6
Compare
4b44ee6
to
ba3dc67
Compare
f997b83
to
df644a3
Compare
Rebased on today's master and flight tested again, detection works as it should and the same as current master: |
} _params{}; | ||
|
||
uORB::Subscription _actuator_controls_sub{ORB_ID(actuator_controls_0)}; | ||
uORB::Subscription _battery_sub{ORB_ID(battery_status)}; | ||
uORB::Subscription _param_update_sub{ORB_ID(parameter_update)}; |
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.
Why do you need this? It is handled in the base class already.
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.
Thanks @bkueng! Removed with upstream merge while resolving conflicts.
Re-flight tested after latest commit: https://review.px4.io/plot_app?log=487a2f0c-d3c1-4c86-8fd4-8d23361b5811 |
_params.maxRotation_rad_s = math::radians(_params.maxRotation_rad_s); | ||
parameter_update_s param_update; | ||
|
||
if (_param_update_sub.update(¶m_update)) { |
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.
You don't need to check for this, or call _update_params()
. It is handled and called from the base class.
You can also keep _param_update_sub
private.
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.
Great, thanks! That simplifies things. I pushed up that fix.
…ss for land_detector_params only.
…tiCopterLandDetector can use it, add #include that appears to have been stripped by latest upstream merge.
… the base class implementation.
7551aab
to
33efd99
Compare
Flight tested with latest commit and rebase against master: https://review.px4.io/plot_app?log=3b8762bc-156a-48a5-a5da-69c0425af7a4 |
Thank you @bkueng for your review and time spent! I appreciate it! |
Describe problem solved by the proposed pull request
This PR implements
ModuleParams
inheritance in theMultiCopterLandDetector
class in following #12209.Test data / coverage
This PR was test flown on a 250 size quad with pixhawk 4 mini, all tests performed identical to current PX4:master branch land detect behaviors:
Additional context
This PR follows work in #12209 and streamlines remaining work for #9756.
@bkueng , @dagar . Please let me know if you have any questions on this PR. Thank you!
-Mark