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

tf2 view_frames under namespace

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

Youssef_Lah gravatar image

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

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

Thanks

edit retag flag offensive close merge delete

Comments

I'm interested as well

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

2 Answers

Sort by ยป oldest newest most voted
3

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

Youssef_Lah gravatar image

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

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
1

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

Zeckurbo gravatar image

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

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

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

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

Hope it works in your distribution as well and helps.

edit flag offensive delete link more

Comments

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

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

Question Tools

3 followers

Stats

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

Seen: 1,527 times

Last updated: Aug 30 '22