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

Support non-absolute topic names. #57

Merged
merged 4 commits into from
Oct 3, 2017
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion ros2topic/ros2topic/verb/echo.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
import sys

import rclpy
from rclpy.expand_topic_name import expand_topic_name
from rclpy.qos import qos_profile_sensor_data
from rclpy.validate_full_topic_name import validate_full_topic_name
from ros2cli.node.direct import DirectNode
from ros2topic.api import get_topic_names_and_types
from ros2topic.api import TopicNameCompleter
Expand Down Expand Up @@ -97,8 +99,10 @@ def represent_ordereddict(dumper, data):
def subscriber(node, topic_name, message_type, callback):
if message_type is None:
topic_names_and_types = get_topic_names_and_types(node=node)
expanded_name = expand_topic_name(topic_name, node.get_name(), node.get_namespace())
validate_full_topic_name(expanded_name, is_service=False)
Copy link
Member

Choose a reason for hiding this comment

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

Nit: False being the default you shouldn't need to have to pass the is_service keyword

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call. Will fix that before merging.

for n, t in topic_names_and_types:
if n == topic_name:
if n == expanded_name:
if len(t) > 1:
raise RuntimeError(
"Cannot echo topic '%s', as it contains more than one type: [%s]" %
Expand Down