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

Enhanced ros2 topic info to display node name, node namespace, topic type and qos profile of the publishers and subscribers. #385

Merged
merged 10 commits into from
Feb 27, 2020

Conversation

jaisontj
Copy link
Contributor

@jaisontj jaisontj commented Oct 24, 2019

NOTE: DO NOT MERGE until rmw #186, rmw_implementation #72, rcl #511 and rclpy #454 are merged.

This PR makes the necessary changes to implement this feature request. Once all the dependent PRs are merged, the ros2cli layer can now use the node.get_publishers_info_by_topic and node.get_subscriptions_info_by_topic functions to enhance the output of ros2 topic info <topic_name> as follows:

$ ros2 topic info rosout

Topic              : rosout

Publisher count    : 2

Node Name: _NODE_NAME_UNKNOWN_
Node Namespace: _NODE_NAMESPACE_UNKNOWN_
Topic Type: rcl_interfaces::msg::dds_::Log_
QoS Profile:
  Reliability: RMW_QOS_POLICY_RELIABILITY_RELIABLE
  Durability: RMW_QOS_POLICY_DURABILITY_VOLATILE
  Lifespan: 2147483651294967295 nanoseconds
  Deadline: 2147483651294967295 nanoseconds
  Liveliness: RMW_QOS_POLICY_LIVELINESS_AUTOMATIC
  Liveliness Lease Duration: 2147483651294967295 nanoseconds

Node Name: listener
Node Namespace: /
Topic Type: rcl_interfaces::msg::dds_::Log_
QoS Profile:
  Reliability: RMW_QOS_POLICY_RELIABILITY_RELIABLE
  Durability: RMW_QOS_POLICY_DURABILITY_VOLATILE
  Lifespan: 2147483651294967295 nanoseconds
  Deadline: 2147483651294967295 nanoseconds
  Liveliness: RMW_QOS_POLICY_LIVELINESS_AUTOMATIC
  Liveliness Lease Duration: 2147483651294967295 nanoseconds

Subscription count : 0

Related to issues in aws-roadmap #86

@jaisontj jaisontj force-pushed the jaisontj/enhance_ros2_topic_info branch from 76a106f to dde5dea Compare October 29, 2019 20:28
@jaisontj
Copy link
Contributor Author

@ivanpauno

Copy link

@dabonnie dabonnie left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@ivanpauno ivanpauno left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Member

@ivanpauno ivanpauno left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@hidmic hidmic left a comment

Choose a reason for hiding this comment

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

I think this is the first time we expose the RMW message type name. I can see value in providing such information, but this is not how we usually refer to topic types i.e. we use std_msgs/msg/String, not std_msgs::msg::dds_::String_. @dirk-thomas @jacobperron do you recall if we provide an API somewhere to carry out the conversion?

@@ -25,6 +51,10 @@ def add_arguments(self, parser, cli_name):
arg = parser.add_argument(
'topic_name',
help="Name of the ROS topic to get info (e.g. '/chatter')")
parser.add_argument(
'--verbose', '-v', action='store_true',
help='Prints detailed information like the Node Name, Node Namespace, Topic Type, '
Copy link
Contributor

Choose a reason for hiding this comment

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

@jaisontj @mm318 consider:

Suggested change
help='Prints detailed information like the Node Name, Node Namespace, Topic Type, '
help='Prints detailed information like the node name, node namespace, topic type, '

instead

Copy link
Member

Choose a reason for hiding this comment

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

Done.

except NotImplementedError as e:
logger.warning(str(e))
except Exception as e:
logger.error(str(e))
Copy link
Contributor

Choose a reason for hiding this comment

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

@jaisontj @mm318 consider:

  • Not catching all but only the ones you'd expect.
  • Not using the logging module but returning the error string from InfoVerb.main instead.

Copy link
Member

Choose a reason for hiding this comment

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

Done.

if (args.verbose):
print_topic_info(topic_name, node.get_publishers_info_by_topic)
print('\nSubscription count : %d' % node.count_subscribers(topic_name))
if (args.verbose):
Copy link
Contributor

Choose a reason for hiding this comment

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

@jaisontj @mm318 parenthesis are not needed.

Copy link
Member

Choose a reason for hiding this comment

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

Removed the parenthesis.

print('Publisher count: %d' % node.count_publishers(topic_name))
print('Subscriber count: %d' % node.count_subscribers(topic_name))
print('\nPublisher count : %d' % node.count_publishers(topic_name))
if (args.verbose):
Copy link
Contributor

Choose a reason for hiding this comment

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

@jaisontj @mm318 parenthesis are not needed.

Copy link
Member

Choose a reason for hiding this comment

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

Removed the parenthesis.

@@ -40,5 +70,10 @@ def main(self, *, args):
return "Unknown topic '%s'" % topic_name
type_str = topic_types[0] if len(topic_types) == 1 else topic_types
print('Type: %s' % type_str)
print('Publisher count: %d' % node.count_publishers(topic_name))
print('Subscriber count: %d' % node.count_subscribers(topic_name))
print('\nPublisher count : %d' % node.count_publishers(topic_name))
Copy link
Member

Choose a reason for hiding this comment

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

nitpick: it looks odd to me with the added whitespace before the colon, especially when Type: does not have the same alignment. IMO, it looks fine without the added whitespace.

Copy link
Member

Choose a reason for hiding this comment

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

Removed the whitespace.

@jacobperron
Copy link
Member

do you recall if we provide an API somewhere to carry out the conversion?

Not off the top of my head. I wonder if the displayed type in verbose mode will confuse users, since it is language-specific and rmw-implementation specific. We're also displaying the ROS type (e.g. std_msgs/msg/String). Maybe we should change the label of the verbose type to something like "RMW type"?

@ivanpauno
Copy link
Member

I think this is the first time we expose the RMW message type name. I can see value in providing such information, but this is not how we usually refer to topic types i.e. we use std_msgs/msg/String, not std_msgs::msg::dds_::String_.

If std_msgs::msg::dds_::String_ is appearing, it's because something is wrong in the rmw_fastrtps PR (more specifically, the type wasn't demangled).

Copy link
Contributor

@hidmic hidmic left a comment

Choose a reason for hiding this comment

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

Also, I've just realized this has no associated test.

@mm318
Copy link
Member

mm318 commented Dec 19, 2019

The mangled type name is being discussed and addressed in ros2/rmw_fastrtps#336.

I'll add some tests to this pull request.

Thanks.

@mm318 mm318 force-pushed the jaisontj/enhance_ros2_topic_info branch from f035b9f to ebdbb10 Compare December 31, 2019 03:51
@mm318
Copy link
Member

mm318 commented Dec 31, 2019

Hi @hidmic, I have fixed and added some tests regarding the verbose mode of ros2 topic info.

Copy link
Contributor

@hidmic hidmic left a comment

Choose a reason for hiding this comment

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

LGTM!

ros2topic/ros2topic/verb/info.py Outdated Show resolved Hide resolved
ros2topic/ros2topic/verb/info.py Outdated Show resolved Hide resolved
ros2topic/ros2topic/verb/info.py Show resolved Hide resolved
@mm318
Copy link
Member

mm318 commented Feb 14, 2020

Is it okay to merge this as well now that ros2/rclcpp#960 and ros2/rclpy#454 are merged, @hidmic, @ivanpauno, @wjwwood?

@wjwwood
Copy link
Member

wjwwood commented Feb 14, 2020

Let me re-review it, and it will need CI after that I think.

@mm318
Copy link
Member

mm318 commented Feb 14, 2020

Oh okay, I was under the impression that the CI run at ros2/rclpy#454 (comment) already included ros2cli.

@wjwwood
Copy link
Member

wjwwood commented Feb 14, 2020

That's possible, though I didn't assume that. Any ways it would be good to double check after I review. Could be --packages-up-to ros2topic, so it would be somewhat quick.

Copy link
Member

@wjwwood wjwwood left a comment

Choose a reason for hiding this comment

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

lgtm

ros2topic/ros2topic/verb/info.py Show resolved Hide resolved
ros2topic/ros2topic/verb/info.py Outdated Show resolved Hide resolved
Signed-off-by: Miaofei <miaofei@amazon.com>
Signed-off-by: Miaofei <miaofei@amazon.com>
Signed-off-by: Miaofei <miaofei@amazon.com>
Signed-off-by: Miaofei <miaofei@amazon.com>
Signed-off-by: Miaofei <miaofei@amazon.com>
@mm318 mm318 force-pushed the jaisontj/enhance_ros2_topic_info branch from baed2dc to 4c6eaec Compare February 14, 2020 22:56
@wjwwood
Copy link
Member

wjwwood commented Feb 14, 2020

Here's Linux CI, since CI is really backed up right now on Windows:

Build Status

@wjwwood
Copy link
Member

wjwwood commented Feb 15, 2020

Not sure what the issue was CI failed, and the tests ran for like an hour before failing...

@mm318
Copy link
Member

mm318 commented Feb 15, 2020

I find that the ros2topic unit tests are flaky and take a long time to run. Can you run CI again to see if the same failures occur?

@ivanpauno
Copy link
Member

I see a bunch of:

[ros2topic-cli-80] Failed to get information by topic for publishers: function not supported by RMW_IMPLEMENTATION
[ERROR] [ros2topic-cli-80]: process has died [pid 10299, exit code 1, cmd 'ros2 topic info -v /chatter'].

That's because the function is not implemented in rmw_connext yet.
It has already been merged in rmw_cyclonedds, so I would rather implement it for connext before merging this. @mm318 Can you add that implementation?

@mm318
Copy link
Member

mm318 commented Feb 17, 2020

I don't understand why it's an issue causing the test to fail for rmw_connext_cpp but not for rmw_opensplice_cpp?

@ivanpauno
Copy link
Member

ivanpauno commented Feb 17, 2020

I don't understand why it's an issue causing the test to fail for rmw_connext_cpp but not for rmw_opensplice_cpp?

Because that CI job didn't include opensplice.
Also, support for OpenSplice was recently removed (https://discourse.ros.org/t/opensplice-move-to-eclipse-cyclone-dds-in-ros-2/12370/7, ros2/ros2#865, ros2/ci#380), so I wouldn't worry about implementing the feature there.

@mm318
Copy link
Member

mm318 commented Feb 18, 2020

Does this comment still apply for the rmw_connext_cpp implementation?

@ivanpauno
Copy link
Member

Does this comment still apply for the rmw_connext_cpp implementation?

I think that not having an implementation in rmw_connext blocks this PR.
My comment was because implementing ros2/rmw_fastrtps#312 (comment) in rmw_connext will solve the issue, as all the graph logic was moved to a common package. Though that will be done before Foxy release, it's still waiting.
Considering that not having an implementation in rmw_connext blocks this PR and that all the other supported rmw implementations had already implemented the feature, I suggest doing rmw_connext implementation now rather than wait to the other refactor.

@zmichaels11
Copy link

zmichaels11 commented Feb 24, 2020

@ros2/aws-oncall - please run this CI job
Gist: https://gist.github.com/prajakta-gokhale/3bfd17646ef9b816edbab230f73df9d2
BUILD args: --packages-up-to ros2topic
TEST args: --packages-select rmw_connext_shared_cpp rclpy ros2topic
Job: ci_launcher

@dirk-thomas
Copy link
Member

--packages-select ros2cli

This won't test ros2topic at all.

@zmichaels11
Copy link

@mm318 please fill in @ros2/aws-oncall with what build args and test args should be used.
I'll update my comment to match afterwards.

@prajakta-gokhale
Copy link

prajakta-gokhale commented Feb 24, 2020

Gist: https://gist.githubusercontent.com/prajakta-gokhale/3bfd17646ef9b816edbab230f73df9d2/raw/30b621cdf64821ec62dc94d4853aafce08e5e7af/ros2.repos
Build args: --packages-up-to ros2topic
Test args: --packages-select rmw_connext_shared_cpp rclpy ros2topic

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

Rebuilding Windows:

  • Windows Build Status
  • Windows-container Build Status

@ivanpauno
Copy link
Member

ivanpauno commented Feb 26, 2020

Also including rcl rmw_connext_cpp tests:

  • macOS Build Status
  • Windows Build Status

@ivanpauno
Copy link
Member

@ivanpauno
Copy link
Member

ivanpauno commented Feb 27, 2020

Another run, including the enabled rcl tests:

  • Linux Build Status

@mm318 I see that ros2topic tests are failing in macOS and Windows, though that's happening in CI too.
I will try to investigate what's the problem before merging.

@ivanpauno
Copy link
Member

@mm318 I see that ros2topic tests are failing in macOS and Windows, though that's happening in CI too.

The faileres are definetly unrelated, I'm merging!

@ivanpauno ivanpauno merged commit c3bf21d into ros2:master Feb 27, 2020
@thomas-moulard thomas-moulard mentioned this pull request Mar 4, 2020
3 tasks
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.

None yet

10 participants