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

[ros2topic] 'The passed message type is invalid' #235

Closed
jacobperron opened this issue May 14, 2019 · 2 comments · Fixed by #237
Closed

[ros2topic] 'The passed message type is invalid' #235

jacobperron opened this issue May 14, 2019 · 2 comments · Fixed by #237
Assignees
Labels
bug Something isn't working

Comments

@jacobperron
Copy link
Member

Bug report

Required Info:

  • Operating System:
    • Ubuntu 18.04 (and presumably all other platforms)
  • Installation type:
    • source
  • Version or commit hash:
  • DDS implementation:
    • Fast-RTPS
  • Client library (if applicable):
    • rclpy

Steps to reproduce issue

Start publishing to a topic:

ros2 topic pub /chatter std_msgs/Empty

Try using the verbs bw, hz, and delay. E.g.

ros2 topic bw /chatter

Expected behavior

The tools work (e.g. echo bandwidth for bw).

Actual behavior

All tools log the message "The passed message type is invalid" and exit.

Additional information

It's likely this is a bug introduced by ros2/ros2#677.

@jacobperron jacobperron added the bug Something isn't working label May 14, 2019
@cottsay
Copy link
Member

cottsay commented May 15, 2019

I'm using this slightly hacky change to work around this issue for now:

--- a/ros2topic/ros2topic/api/__init__.py
+++ b/ros2topic/ros2topic/api/__init__.py
@@ -57,9 +57,11 @@ class TopicNameCompleter:
 def import_message_type(topic_name, message_type):
     # TODO(dirk-thomas) this logic should come from a rosidl related package
     try:
-        package_name, message_name = message_type.split('/', 2)
+        package_name, message_name = message_type.split('/', 1)
         if not package_name or not message_name:
             raise ValueError()
+        if message_name.startswith('msg/'):
+            message_name = message_name[4:]
     except ValueError:
         raise RuntimeError('The passed message type is invalid')

I think the maxsplit value should always have been 1, even before the regression.

@jacobperron
Copy link
Member Author

Thanks. Yeah, I think maxplit should have been one.

jacobperron added a commit that referenced this issue May 15, 2019
Fixes #235.
Now the 'bw', 'hz', and 'delay' verbs work again.

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
@jacobperron jacobperron added in progress Actively being worked on (Kanban column) in review Waiting for review (Kanban column) and removed in progress Actively being worked on (Kanban column) labels May 15, 2019
jacobperron added a commit that referenced this issue May 15, 2019
Fixes #235.
Now the 'bw', 'hz', and 'delay' verbs work again.

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
@jacobperron jacobperron removed the in review Waiting for review (Kanban column) label May 15, 2019
esteve pushed a commit to esteve/ros2cli that referenced this issue Dec 16, 2022
Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants