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

Creating two nodes with same frame id, but different topics

asked 2017-04-23 12:58:02 -0500

frizzle gravatar image

updated 2017-04-26 12:14:48 -0500

Hi everyone,

I have quite a few bagfiles containing different messages which I want to display using rviz.
The problem is that I have two messages with the same message type and same frame id, but I want them to be displayed as two different nodes, which I want to create using a launch-file. They have different topics, though.
Does anyone know how to achieve that?

Thanks in advance!

Edit: Sorry for any unclarity. What I want to achieve is to get two nodes similar to this one:

<node name="tf_imu" pkg="static_transform_publisher" args="-1 0 3.5 3.14159 -1.5708 0 base_link imu 200" />

The thing I want to achieve is to get a different transformation for each of them, so the args should be slightly different. But both messages are of type "sensor_msgs/Imu".
The topics look like this:

  • /imu1/imu/imu
  • /imu2/imu/imu

And they both have the frame id "imu". Is there anything I can do to achieve that?

edit retag flag offensive close merge delete

Comments

What do you mean by "displayed as two different nodes"? If the data is already in separate topics, then playing the bag file will keep it in separate topics.

Geoff gravatar image Geoff  ( 2017-04-23 20:12:31 -0500 )edit

1 Answer

Sort by » oldest newest most voted
2

answered 2017-04-26 19:25:59 -0500

Geoff gravatar image

If you have two topics in a bag file that use the same frame_id, but you want them to have separate frame_ids, you can use the change_frame_id.py tool from the bag_tools package to change the frame_id on one of the nodes. You can install it with apt-get install ros-kinetic-bag-tools or similar.

In your situation, you could do this:

rosrun bag_tools change_frame_id.py -i current.bag -o new.bag -f imu2 -t "/imu2/imu/imu"

This would produce a new bag file in which the messages on the /imu2/imu/imu topic have the frame_id imu2. Then you can have a second static_transform_publisher in your launch file that publishes a transform from base_link to imu2:

<node name="tf_imu2" pkg="static_transform_publisher" args="1 0 3.5 3.14159 -1.5708 0 base_link imu2 200" />
edit flag offensive delete link more

Comments

Thanks for your suggestion! Unfortunately, I'm not able to modify the bag files, but this will surely help others.

frizzle gravatar image frizzle  ( 2017-04-28 11:11:54 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2017-04-23 12:55:32 -0500

Seen: 731 times

Last updated: Apr 26 '17