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

Consistent node naming #158

Merged
merged 8 commits into from
Jan 29, 2019
Merged

Consistent node naming #158

merged 8 commits into from
Jan 29, 2019

Conversation

AAlon
Copy link
Contributor

@AAlon AAlon commented Nov 16, 2018

Summary

This is part of the improvements suggested here mainly intended for CLI tools' usability with security.

  • All ros2cli nodes will start with prefix ros2cli_node.

Related changes

Refer to

https://discourse.ros.org/t/ros2-security-cli-tools/6647/
ros2/sros2#69

@tfoote tfoote added the in review Waiting for review (Kanban column) label Nov 16, 2018
Copy link
Member

@ruffsl ruffsl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure a extending ROS2 CLI node names with a new longer hard coded prefix would be best, given that the length of our namespaces is finite from the restrictions in DDS. Like I mentioned elsewhere, exposing them as parameterizable arguments might be more flexible:
ros2/rosbag2#60 (comment)

@@ -35,7 +33,7 @@ def timer_callback():

node_name_suffix = getattr(
args, 'node_name_suffix', '_%d' % os.getpid())
self.node = rclpy.create_node(HIDDEN_NODE_PREFIX + 'ros2cli_node' + node_name_suffix)
self.node = rclpy.create_node(CLI_NODE_NAME_PREFIX + node_name_suffix)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't this remove this node's status as 'hidden'?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's the intention. Some CLI nodes are hidden while others are not, and I haven't found a good reason for this discrepancy. Moreover, ROS1 CLI nodes all start up as visible. Since this hiding is just a CLI-level feature (rendered irrelevant by supplying the -a flag) I don't feel strongly either way but I feel like it should be consistent (either all hidden or all visible).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel all CLI tools used for debugging or status checking should be hidden by default and minimally intrusive, to avoid everyone else's workstations debugging the same platform/network from cluttering the shared data bus of everyone else, e.g. increasing the signal to noise ratio of parameters/topics/participant namespaces as more developers/cli-tools share the same network rather than solely from the number of robots. This is just my opinion from working on robotic competitions and hackathons during crowded events such as RoboCup, or shared research labs.

What CLI do you currently find to be inconsistent in being hidden?
Perhaps is worth fixing them as well to be hidden?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ros2 topic echo is hidden while ros2 topic pub is not. I can change all of them to be hidden, that's fine, as long as it's consistent :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated: 5d2d22d

# See the License for the specific language governing permissions and
# limitations under the License.
# TODO(mikaelarguedas) revisit this once it's specified
HIDDEN_NODE_PREFIX = '_'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 in consolidating the declaration of HIDDEN_NODE_PREFIX

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Imo the consolidation should not happen here in ros2cli (I assume that is why you kept the TODO comment) but go into rclpy. Similar to HIDDEN_TOPIC_PREFIX.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe ros2/rclpy#259 addresses this comment

@AAlon
Copy link
Contributor Author

AAlon commented Nov 19, 2018

I'm not sure a extending ROS2 CLI node names with a new longer hard coded prefix would be best, given that the length of our namespaces is finite from the restrictions in DDS. Like I mentioned elsewhere, exposing them as parameterizable arguments might be more flexible:
ros2/rosbag2#60 (comment)

  • Some CLI nodes already starts with the ros2cli_node prefix, this is only about making it consistent across all CLI nodes.
  • Yes, we should allow the user to supply node and ns name. However, this is outside the scope of this change, which deals with making the default naming consistent. Most usage will be with the default names.
  • Since this applies only to the default naming (rather than user-supplied), correct me if I'm wrong but there should be no issues with name length. We know the expected length: "ros2cli_node_<requester/publisher/etc>[_<process-id>]". Can change the ros2cli_node to ros2cli if it's still a concern.

@AAlon
Copy link
Contributor Author

AAlon commented Dec 10, 2018

Ping @ruffsl ^^

@ruffsl
Copy link
Member

ruffsl commented Dec 12, 2018

@AAlon , Could you rebase wrt current master?
There are some other commits in here that make sorting out the diff harder.

@AAlon
Copy link
Contributor Author

AAlon commented Dec 12, 2018

@AAlon , Could you rebase wrt current master?
There are some other commits in here that make sorting out the diff harder.

Done.

@ruffsl
Copy link
Member

ruffsl commented Dec 13, 2018

Can change the ros2cli_node to ros2cli if it's still a concern.

I think that's a good idea, and would be my last nitpick.

@clalancette clalancette self-requested a review December 20, 2018 18:18
@AAlon
Copy link
Contributor Author

AAlon commented Jan 8, 2019

Are we ready to merge this? the rosbag build in ros2/rosbag2#60 wouldn't succeed unless it has ros2cli with this change.

# See the License for the specific language governing permissions and
# limitations under the License.
# TODO(mikaelarguedas) revisit this once it's specified
HIDDEN_NODE_PREFIX = '_'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Imo the consolidation should not happen here in ros2cli (I assume that is why you kept the TODO comment) but go into rclpy. Similar to HIDDEN_TOPIC_PREFIX.

# limitations under the License.
# TODO(mikaelarguedas) revisit this once it's specified
HIDDEN_NODE_PREFIX = '_'
CLI_NODE_NAME_PREFIX = HIDDEN_NODE_PREFIX + 'ros2cli'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nipick: why use CLI_ as the prefix for this variable? I would suggest either ROS2CLI_NODE_NAME_PREFIX (to match the package name) or just NODE_NAME_PREFIX (since the symbol is defined in the namespace of ros2cli).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Imo the consolidation should not happen here in ros2cli (I assume that is why you kept the TODO comment) but go into rclpy. Similar to HIDDEN_TOPIC_PREFIX.

Ok, I can expose it from rclpy/node.py. I kept the comment because I was moving the same piece of code to a different place, and wasn't sure what he meant by once it's specified :)

Copy link
Contributor Author

@AAlon AAlon Jan 8, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, thinking some more, I'm not so sure about it.
I can make the change if you still think that's the way to go, but this feature is strictly at the ROS CLI level; the node is not inherently 'hidden' in any way. It's simply an interpretation given by the CLI based on a prefix. I would think exposing a variable named HIDDEN_NODE_PREFIX from rclpy might be confusing and incorrectly imply that there's an actual 'hidden node feature' implemented in ROS.

Thoughts?

Nipick: why use CLI_ as the prefix for this variable? I would suggest either ROS2CLI_NODE_NAME_PREFIX (to match the package name) or just NODE_NAME_PREFIX (since the symbol is defined in the namespace of ros2cli).

Sure, I can change that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would argue that the very same semanstic applies to HIDDEN_TOPIC_PREFIX and that is exposed by rclpy in order to establish a common understanding of what by convention is being considered "hidden".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would argue that the very same semanstic applies to HIDDEN_TOPIC_PREFIX and that is exposed by rclpy in order to establish a common understanding of what by convention is being considered "hidden".

Yep, and I'd say HIDDEN_TOPIC_PREFIX could've been defined in ros2cli as well. I don't feel strongly though; made the changes and updated the PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say HIDDEN_TOPIC_PREFIX could've been defined in ros2cli as well.

If the underscore prefix is supposed to be a generally agreed upon convention it isn't sufficient to define it in ros2cli. E.g. what if rviz want to show a drop down list of topics and ignore hidden ones? ros2cli isn't accessible for that. So it needs to be defined in the client library across all languages.

In the future the actual definition could be pushed down into a constant defined in a .msg / .idl file.

@AAlon
Copy link
Contributor Author

AAlon commented Jan 11, 2019

Corresponding rclpy change: ros2/rclpy#259

Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
@clalancette
Copy link
Contributor

It looks like all of the previous comments were fixed. The automated CI is going to fail here because ros2/rclpy#259 isn't in Crystal; that's fine. The code looks good to me, so I'm going to launch CI on it; assuming that is green, I'll approve.

@AAlon We just started requiring DCO on commits on this repository, so if you can rebase and add the Signed-off-by for all of the commits (and squash them while you are at it), we can then get this in. Thanks.

@clalancette
Copy link
Contributor

clalancette commented Jan 25, 2019

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@dirk-thomas
Copy link
Member

We just started requiring DCO on commits on this repository, so if you can rebase and add the Signed-off-by for all of the commits (and squash them while you are at it), we can then get this in. Thanks.

We don't enforce the DCO check yet. So no need to update this PR which was opened long before.

@cottsay
Copy link
Member

cottsay commented Jan 28, 2019

It looks like the CI jobs came back green, @clalancette. If there are no objections, I think this is ready to merge (without DCO sign-off).

@clalancette clalancette merged commit 9186400 into ros2:master Jan 29, 2019
@clalancette clalancette removed the in review Waiting for review (Kanban column) label Jan 29, 2019
esteve pushed a commit to esteve/ros2cli that referenced this pull request Dec 16, 2022
fix deprecation warning related to collections.abc
esteve pushed a commit to esteve/ros2cli that referenced this pull request Dec 16, 2022
…ame scope (ros2#158)

Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants