-
Notifications
You must be signed in to change notification settings - Fork 164
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
Conversation
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 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)
ros2cli/ros2cli/node/direct.py
Outdated
@@ -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) |
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.
Wouldn't this remove this node's status as 'hidden'?
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.
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).
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 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?
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.
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 :)
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.
Updated: 5d2d22d
ros2cli/ros2cli/node/__init__.py
Outdated
# 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 = '_' |
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.
+1 in consolidating the declaration of HIDDEN_NODE_PREFIX
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.
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
.
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 believe ros2/rclpy#259 addresses this comment
|
Ping @ruffsl ^^ |
@AAlon , Could you rebase wrt current master? |
Done. |
I think that's a good idea, and would be my last nitpick. |
Are we ready to merge this? the rosbag build in ros2/rosbag2#60 wouldn't succeed unless it has ros2cli with this change. |
ros2cli/ros2cli/node/__init__.py
Outdated
# 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 = '_' |
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.
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
.
ros2cli/ros2cli/node/__init__.py
Outdated
# limitations under the License. | ||
# TODO(mikaelarguedas) revisit this once it's specified | ||
HIDDEN_NODE_PREFIX = '_' | ||
CLI_NODE_NAME_PREFIX = HIDDEN_NODE_PREFIX + 'ros2cli' |
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.
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
).
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.
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
:)
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.
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 eitherROS2CLI_NODE_NAME_PREFIX
(to match the package name) or justNODE_NAME_PREFIX
(since the symbol is defined in the namespace ofros2cli
).
Sure, I can change 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.
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".
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 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.
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 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.
…CLI nodes with a consistent prefix.
…stent node naming for ros2cli.
…X -> NODE_NAME_PREFIX.
Corresponding |
Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
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 |
We don't enforce the DCO check yet. So no need to update this PR which was opened long before. |
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). |
fix deprecation warning related to collections.abc
…ame scope (ros2#158) Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
Summary
This is part of the improvements suggested here mainly intended for CLI tools' usability with security.
ros2cli_node
.Related changes
Refer to
https://discourse.ros.org/t/ros2-security-cli-tools/6647/
ros2/sros2#69