Creating two nodes with same frame id, but different topics
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?
Asked by frizzle on 2017-04-23 12:55:32 UTC
Answers
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" />
Asked by Geoff on 2017-04-26 19:25:59 UTC
Comments
Thanks for your suggestion! Unfortunately, I'm not able to modify the bag files, but this will surely help others.
Asked by frizzle on 2017-04-28 11:11:54 UTC
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.
Asked by Geoff on 2017-04-23 20:12:31 UTC