Skip to content

ros2 topic echo should use the daemon to look up type names #488

@clalancette

Description

@clalancette

Bug report

When trying to run ros2 topic echo /foo for a topic that already exists, sometimes it prints:

Could not determine the type for the passed topic

This happens because ros2 topic echo creates a node, then has to wait for discovery to happen. On some DDS implementations where discovery is slower, it can timeout waiting for the discovery. What we should do instead is utilize the ros2 daemon and ask it for the type of the topic. If the daemon knows the type of the topic, it can return it immediately. If it isn't running, then we should probably start the daemon. And if it is running, but doesn't know the type of the topic, echo can then wait to discover it.

Required Info:

  • Operating System:
    • Any
  • Installation type:
    • From source
  • Version or commit hash:
  • DDS implementation:
    • Any, though it happens more on RTI Connext which has slower discovery
  • Client library (if applicable):
    • rclpy

Steps to reproduce issue

Terminal 1:

ros2 run demo_nodes_cpp talker

Terminal 2 (this has to be done very quickly after Terminal 1 to show the issue):

ros2 topic echo /chatter

Expected behavior

The topic type is fetched (invisibly), and topic echo starts echoing the topic.

Actual behavior

Sometimes an error is shown:

Could not determine the type for the passed topic

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions