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

transform is broken with relative topics in namespaces #95

Open
bmartin427 opened this issue Dec 13, 2023 · 6 comments
Open

transform is broken with relative topics in namespaces #95

bmartin427 opened this issue Dec 13, 2023 · 6 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@bmartin427
Copy link

Description

The transform tool fails to properly resolve the names of topics specified as relative to a non-root namespace.

Expected Behavior

Tool runs, subscribes to /my_namespace/chatter and emits /my_namespace/xformed.

Actual Behavior

Tool stalls with:

WARNING: topic [/my_namespacechatter] does not appear to be published yet

To Reproduce

  1. ros2 run demo_nodes_cpp talker --ros-args -r __ns:=/my_namespace
  2. ros2 run topic_tools transform chatter xformed std_msgs/String "std_msgs.msg.String(data=m.data[-1])" --import std_msgs --wait-for-start --ros-args -r __ns:=/my_namespace

System (please complete the following information)

  • OS: Ubuntu Jammy
  • ROS 2 Distro: Iron

Additional context

@bmartin427 bmartin427 added the bug Something isn't working label Dec 13, 2023
@bmartin427
Copy link
Author

Update: it seems that relay_field also has this same problem.

@christophebedard
Copy link
Member

Does it work if you do ros2 run topic_tools transform /chatter #... instead?

@bmartin427
Copy link
Author

It works if I use /my_namespace/chatter as the input topic, or /chatter works if I move the talker out of the namespace, yes.

@christophebedard
Copy link
Member

Thanks for confirming. We're using rclcpp::GenericSubscription for all topic_tools nodes instead of the usual rclcpp::Subscription, so there might be an issue there.

@christophebedard christophebedard added the help wanted Extra attention is needed label Dec 13, 2023
@bmartin427
Copy link
Author

It looks to me like these lines won't work correctly if the namespace doesn't end in '/':
https://github.com/ros-tooling/topic_tools/blob/iron/topic_tools/topic_tools/transform.py#L75-L77

Appending '/' to the __ns:= remapping causes other unrelated explosions though.

@christophebedard
Copy link
Member

Oops sorry, I completely missed that transform is one of the Python nodes.

I thought that topic name resolution was something that's usually left to the client library implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants