ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

tf2 view_frames under namespace

asked 2022-07-31 22:50:08 -0500

Youssef_Lah gravatar image

updated 2022-07-31 22:51:34 -0500

Hi community,

env: ROS2 Galactic

how can I view the frames of a name-spaced simulation ? the command ros2 run tf2_tools view_frames does not work when I set a namespace.

image description


edit retag flag offensive close merge delete


I'm interested as well

igrak34 gravatar image igrak34  ( 2022-08-21 12:48:16 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2022-08-30 14:17:11 -0500

Youssef_Lah gravatar image

updated 2022-08-30 14:18:13 -0500

I've checked the package code and figure out that the command should be run like this:

ros2 run tf2_tools view_frames --ros-args -r __ns:=/robot1 -r /tf:=tf -r /tf_static:=tf_static

Where "robot1" is the targeted namespace.

edit flag offensive delete link more

answered 2022-08-30 05:29:09 -0500

Zeckurbo gravatar image

updated 2022-08-30 05:30:22 -0500

I have an answer, that is not nice, but works.

Go to /opt/ros/foxy/lib/python3.8/site-packages/tf2_ros/ and edit line 73 and 75 to your namespace. (Or search it via an IDE from /opt/ros/foxy/lib/tf2_tools/ :line 45)

self.tf_sub = node.create_subscription(
            TFMessage, 'namespace/tf', self.callback, qos,
        self.tf_static_sub = node.create_subscription(
            TFMessage, 'namespace/tf_static', self.static_callback, static_qos,

Hope it works in your distribution as well and helps.

edit flag offensive delete link more


Thanks @zechurbo, I've posted a cleaner solution.

Youssef_Lah gravatar image Youssef_Lah  ( 2022-08-30 14:18:07 -0500 )edit

Question Tools



Asked: 2022-07-31 22:50:08 -0500

Seen: 919 times

Last updated: Aug 30 '22