ros2cli
ros2cli copied to clipboard
Add `ros2 service info` command
Adds a new info
verb to ros2 service
, which lists the nodes that advertise clients and servers for a given service. I found that I needed a tool like this to help introspect big collections of ROS nodes, especially since some problems are really difficult to diagnose without it (for example, two nodes having service servers with the same type and topic name).
The pattern of implementation is similar to ros2 action info
, and it produces similar output:
$ ros2 service info /my_service
Service: /my_service
Service clients: 1
/some_client_node
Service servers: 1
/some_server_node
I modified the tests for ros2service
to include a service client node in addition to the existing service server node. This required some changes to tests for other CLI tools since they have built-in assumptions about the number of nodes being run.
Signed-off-by: Joe Schornak [email protected]
@schornakj 👍 IMO, this option is worth to keep. i will have a look.
I'm seeing failures in the new unit tests when I run them locally that I think are caused by the output text getting mangled when it's parsed. Not sure how to resolve that right now, since these tests follow the same pattern as the other ones that deal with printed output.
FAIL: test_cli.TestROS2ServiceCLI.test_info[rmw_cyclonedds_cpp]
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Traceback (most recent call last):
File "/opt/ros/rolling/lib/python3.8/site-packages/launch_testing/markers.py", line 57, in _wrapper
return func(self, *args, **kwargs)
File "/home/jschornak/workspaces/ros2_cli_ws/src/ros2cli/ros2service/test/test_cli.py", line 230, in test_info
assert launch_testing.tools.expect_output(
AssertionError: assert False
+ where False = <function expect_output at 0x7f506d5c7a60>(expected_lines=['Service: /my_ns/echo', 'Service clients: 1', ' /my_ns/echo_client', 'Service servers: 1', ' /my_ns/echo_server'], text='Service: /my_ns/echo\nService clients: 1\n //m/y/_/n/secho_client\nService servers: 1\n //m/y/_/n/secho_server\n', strict=True)
+ where <function expect_output at 0x7f506d5c7a60> = <module 'launch_testing.tools' from '/opt/ros/rolling/lib/python3.8/site-packages/launch_testing/tools/__init__.py'>.expect_output
+ where <module 'launch_testing.tools' from '/opt/ros/rolling/lib/python3.8/site-packages/launch_testing/tools/__init__.py'> = launch_testing.tools
+ and 'Service: /my_ns/echo\nService clients: 1\n //m/y/_/n/secho_client\nService servers: 1\n //m/y/_/n/secho_server\n' = <launch_testing.tools.process.ProcessProxy object at 0x7f50689ec100>.output
@fujitatomoya Do you think it's possible for me to get this in before the feature freeze for Humble?
Right now, CI testing is failing for reasons that seem unrelated to the content of this PR, so I'm not sure how to approach resolving that.
@fujitatomoya Do you think it's possible for me to get this in before the feature freeze for Humble?
No, sorry. The feature freeze was already yesterday; we are now feature and API complete for Humble. That said, this is still valuable to get in (once freeze is lifted), and if it doesn't break API we can consider backporting it once Humble is released.
i think we can come back to this PR after https://github.com/ros2/ros2cli/pull/771 is merged.
i think we can come back to this PR after #771 is merged.
Yay, 771 is merged!
This is a great feature and would be very handy when connecting non-ROS DDS systems to ROS based systems. Introspection is great, especially with a -v
flag similar to ros2 topic -v
that shows the QOS settings.
I think we can close this PR, mostly has been done with https://github.com/ros2/ros2cli/pull/771.
@schornakj what do you think? if you have the support -v
option in mind, that requires rmw
changes as well.
https://github.com/ros2/ros2cli/issues/877 created to follow up ros2 service info -v
support for introspection.
Given the work that went into #771, and the follow-up in #877, I'm going to close this out. If you feel there is still value in some of the other work here, please feel free to open a new PR with those changes.