-
Notifications
You must be signed in to change notification settings - Fork 430
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
[Iron] Add new node interface TypeDescriptionsInterface to provide GetTypeDescription service (backport #2224) #2236
[Iron] Add new node interface TypeDescriptionsInterface to provide GetTypeDescription service (backport #2224) #2236
Conversation
…scription service (ros2#2224) * TypeDescriptions interface with readonly param configuration * Add parameter descriptor, to make read only * example of spinning in thread for get_type_description service * Add a basic test for the new interface * Fix tests with new parameter * Add comments about builtin parameters Signed-off-by: Emerson Knapp <emerson.b.knapp@gmail.com> Signed-off-by: William Woodall <william@osrfoundation.org>
Using https://github.com/ros2/rclcpp/pull/2183/files as a reference for ABI-stable backport |
Signed-off-by: Emerson Knapp <emerson.b.knapp@gmail.com>
d7c8669
to
75e180c
Compare
rclcpp/include/rclcpp/node.hpp
Outdated
@@ -1591,6 +1597,9 @@ class Node : public std::enable_shared_from_this<Node> | |||
const rclcpp::NodeOptions node_options_; | |||
const std::string sub_namespace_; | |||
const std::string effective_namespace_; | |||
|
|||
class BackportMemberMaps; |
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.
Note to reviewer: went with a generic name to leave it open for possible other members usage
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.
At the risk of bikeshedding, I think the name is a little too generic. That is, the class embeds a
std::unordered_map<
const Node *, rclcpp::node_interfaces::NodeTypeDescriptionsInterface::SharedPtr
> type_descriptions_map_;
which feels very specific to this backport. I think I'd go with BackportTypeDescriptionsInterface
, or something like that.
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.
Maybe the intention wasn't clear. This class could have more maps within it, controlled by the same access mutex, that create more "members" for the owning class' instances. Given that members would be created all at once, and removed all at once, there would be no partial construction or partial deletion of these "members", it makes sense to use the same mutex and manage all the maps at once. That was the intention here - this thing is "all extra backported members" - and maybe that ends up being only one from this backport, but if we do want to backport more member-based features to Iron we don't need to create any new classes or static members, this one does the whole job via new maps within it. I like it as a generic backport pattern that could be reused.
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.
The implementation could actually be a singular map to some "tuple" or struct of extra members, that is added and deleted atomically.
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, OK. Thanks for the explanation. In that case, I'm fine with the name as-is. I'll just suggest you put some of that explanation there into a comment (either here in the .hpp
or in the .cpp
, I don't care which).
Signed-off-by: Emerson Knapp <emerson.b.knapp@gmail.com>
Pulls: ros2/rcl#1082, #2236, ros2/system_tests#521 |
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've left only nitpicky stuff that we should fix before merging.
rclcpp/include/rclcpp/node.hpp
Outdated
@@ -1591,6 +1597,9 @@ class Node : public std::enable_shared_from_this<Node> | |||
const rclcpp::NodeOptions node_options_; | |||
const std::string sub_namespace_; | |||
const std::string effective_namespace_; | |||
|
|||
class BackportMemberMaps; |
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.
At the risk of bikeshedding, I think the name is a little too generic. That is, the class embeds a
std::unordered_map<
const Node *, rclcpp::node_interfaces::NodeTypeDescriptionsInterface::SharedPtr
> type_descriptions_map_;
which feels very specific to this backport. I think I'd go with BackportTypeDescriptionsInterface
, or something like that.
void add(Node * key) | ||
{ | ||
// Adding a new instance to the maps requires exclusive access | ||
std::unique_lock lock(map_access_mutex_); |
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.
Nit: #include <mutex>
at the top of the file for this.
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.
This is a really good eye you have for these - do you know of any include-what-you-use linters that could handle this so you don't have to?
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 is iwyu
: https://include-what-you-use.org/ . It's even packaged for Ubuntu under the same name. The major issue with it (from an automation standpoint) is that it relies on clang, so we could only conceivably run it in our clang CI jobs.
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'm surprised that cpplint.py
doesn't catch this, it used to catch things like this. Maybe its coverage is just not as good.
Signed-off-by: Emerson Knapp <emerson.b.knapp@gmail.com>
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.
One more minor thing to fix, then this will be good to go.
rclcpp/include/rclcpp/node.hpp
Outdated
@@ -1591,6 +1597,9 @@ class Node : public std::enable_shared_from_this<Node> | |||
const rclcpp::NodeOptions node_options_; | |||
const std::string sub_namespace_; | |||
const std::string effective_namespace_; | |||
|
|||
class BackportMemberMaps; |
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, OK. Thanks for the explanation. In that case, I'm fine with the name as-is. I'll just suggest you put some of that explanation there into a comment (either here in the .hpp
or in the .cpp
, I don't care which).
Signed-off-by: Emerson Knapp <emerson.b.knapp@gmail.com>
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.
This looks good to me.
@emersonknapp With this approved, I think that is everything needed for the Iron backport. I think I'd like to see one more CI run on all 5 of the PRs here. Assuming that is green, I'll go ahead and merge the group of them.
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.
lgtm from an ABI/API stability point of view
Pulls: ros2/rcl#1082, #2236, ros2/system_tests#521, ros2/rclpy#1140, ros2/ros2cli#839 |
…tTypeDescription service (backport ros2#2224) (ros2#2236) * Add new node interface TypeDescriptionsInterface to provide GetTypeDescription service (ros2#2224) * TypeDescriptions interface with readonly param configuration * Add parameter descriptor, to make read only * example of spinning in thread for get_type_description service * Add a basic test for the new interface * Fix tests with new parameter * Add comments about builtin parameters * Hide new member for ABI stability * Add typedescription interface smoke test Signed-off-by: Emerson Knapp <emerson.b.knapp@gmail.com> Signed-off-by: William Woodall <william@osrfoundation.org> Signed-off-by: Ignacio Vizzo <ignacio@dexory.com>
…tTypeDescription service (backport ros2#2224) (ros2#2236) * Add new node interface TypeDescriptionsInterface to provide GetTypeDescription service (ros2#2224) * TypeDescriptions interface with readonly param configuration * Add parameter descriptor, to make read only * example of spinning in thread for get_type_description service * Add a basic test for the new interface * Fix tests with new parameter * Add comments about builtin parameters * Hide new member for ABI stability * Add typedescription interface smoke test Signed-off-by: Emerson Knapp <emerson.b.knapp@gmail.com> Signed-off-by: William Woodall <william@osrfoundation.org>
…tTypeDescription service (backport ros2#2224) (ros2#2236) * Add new node interface TypeDescriptionsInterface to provide GetTypeDescription service (ros2#2224) * TypeDescriptions interface with readonly param configuration * Add parameter descriptor, to make read only * example of spinning in thread for get_type_description service * Add a basic test for the new interface * Fix tests with new parameter * Add comments about builtin parameters * Hide new member for ABI stability * Add typedescription interface smoke test Signed-off-by: Emerson Knapp <emerson.b.knapp@gmail.com> Signed-off-by: William Woodall <william@osrfoundation.org> Signed-off-by: Oren Bell <oren.bell@wustl.edu>
…tTypeDescription service (backport ros2#2224) (ros2#2236) * Add new node interface TypeDescriptionsInterface to provide GetTypeDescription service (ros2#2224) * TypeDescriptions interface with readonly param configuration * Add parameter descriptor, to make read only * example of spinning in thread for get_type_description service * Add a basic test for the new interface * Fix tests with new parameter * Add comments about builtin parameters * Hide new member for ABI stability * Add typedescription interface smoke test Signed-off-by: Emerson Knapp <emerson.b.knapp@gmail.com> Signed-off-by: William Woodall <william@osrfoundation.org>
backports #2224 to Iron
Depends on ros2/rcl#1082
Linked to ros2/system_tests#521