-
-
Notifications
You must be signed in to change notification settings - Fork 512
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 component metadata protocol #2272
Conversation
e6061f7
to
f4800cf
Compare
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.
Amazing! Thanks so much for the split commits, makes the review much easier.
I left a bunch of comments. I might do a more in-depth review once I try out some of the pieces.
What's missing is the proto pull request. I want to make sure I understand the user interface.
.gitmodules
Outdated
[submodule "src/third_party/xz-embedded/submodule"] | ||
path = src/third_party/xz-embedded/submodule | ||
url = https://github.com/tukaani-project/xz-embedded.git |
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'd prefer to get the dependency in the same way like all others (except gtest):
https://github.com/mavlink/MAVSDK/blob/main/third_party/CMakeLists.txt
E.g. https://github.com/mavlink/MAVSDK/blob/main/third_party/jsoncpp/CMakeLists.txt
Which library is up to you.
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.
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.
Alright, I changed to the system lib liblzma in 5175884
src/mavsdk/plugins/component_metadata_server/component_metadata_server_impl.cpp
Show resolved
Hide resolved
} | ||
_tmp_path = *tmp_option; | ||
|
||
LogDebug() << "Storing metadata under " << _tmp_path; |
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.
By the way, I would probably add a _debugging
bool like other plugins have it which can be enabled using export MAVSDK_COMPONENT_METADATA_DEBUGGING=1
, and then you can make it quite verbose in that case.
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.
Done in a725299
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.
Very nice!
for (int i = 0; i < 100 && (!received_events || !received_parameters); ++i) { | ||
std::this_thread::sleep_for(std::chrono::milliseconds(100)); | ||
} |
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 didn't want to do this one with std::future
and std::promise
?
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 thought it's not worth the extra complexity given it's a test and we need to wait for multiple things.
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.
Right, I wonder what the canonical way is to wait for two futures.
start_timer(3.0); | ||
LogDebug() << "No session available, retrying..."; |
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.
That makes sense, nice.
{ | ||
_system_impl.unregister_timeout_handler(_timeout_cookie); | ||
_system_impl.register_timeout_handler( | ||
[this]() { timeout(); }, _system_impl.timeout_s(), &_timeout_cookie); | ||
[this]() { timeout(); }, duration_s.value_or(_system_impl.timeout_s()), &_timeout_cookie); |
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.
Oh, I didn't know value_or
, that's nice.
Thanks for the review @julianoes! Here's the proto changes: mavlink/MAVSDK-Proto#338 |
2116187
to
78400f5
Compare
8cd8a6e
to
c1883f4
Compare
CI is passing now, except for the proto submodule not being updated yet. |
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.
Fine to be merged once we have proto merged!
@@ -0,0 +1,20 @@ | |||
#pragma once |
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.
We should probably merge this file with https://github.com/mavlink/MAVSDK/blob/main/src/system_tests/fs_helpers.h but it can happen after this PR.
Otherwise there might still be data in the buffer. All other places already close the stream.
This version (5.4.5) is not affected by the recently discovered backdoor (https://tukaani.org/xz-backdoor/)
… an ongoing transfer
instead of calling the callback directly. Otherwise if the callback tries to trigger a new request, it would block indefinitely when trying to add a work item to _work_queue, which is already locked by this: LockedQueue<Work>::Guard work_queue_guard(_work_queue);
To include this commit: google/re2@9ebe4a2 Which should fix the CI error: CMake Error at /home/runner/work/MAVSDK/MAVSDK/build/release/third_party/install/lib/cmake/re2/re2Config.cmake:15 (message): File or directory /include referenced by variable re2_INCLUDE_DIR does not exist !
Brings component metadata plugins. Signed-off-by: Julian Oes <[email protected]>
075cb7d
to
a13aa62
Compare
Quality Gate failedFailed conditions See analysis details on SonarCloud Catch issues before they fail your Quality Gate with our IDE extension SonarLint |
Thanks a lot @bkueng! |
This implements the MAVLink component metadata protocol.
Details:
Client example usage:
TODO:
liblzma
could be used instead.PluginImplBase::disable
is called?Requires PX4/PX4-Autopilot#22980
Tested with PX4 (SITL + Pixhawk, mftp + https links)