Publishing to '/tf' topic does not work

Typically: "How do I... ", "How can I... " questions
Post Reply
dvedova
Posts: 5
Joined: 03 Feb 2021, 03:16

Publishing to '/tf' topic does not work

Post by dvedova »

I am able to publish a message of type

Code: Select all

tf2_msgs/TFMessage
under the topic name

Code: Select all

/transforms
. However, when I attempt to publish the transforms under the topic name

Code: Select all

/tf
the messages fails to be published and the topic does not appear when I run

Code: Select all

rostopic list
.

fferri
Posts: 1224
Joined: 09 Sep 2013, 19:28

Re: Publishing to '/tf' topic does not work

Post by fferri »

Can't reproduce your issue.

On my machine I can see the '/tf' topic being advertised even before I create a publisher in CoppeliaSim. And publishing to the topic (e.g.: pub=simROS.advertise('/tf','tf2_msgs/TFMessage'); simROS.publish(pub,{transforms={}})) works as expected.

The plugin does nothing special to prevent that.

Anyways, I don't think one is supposed to send raw TFMessages.

The ROS TransformBroadcaster class exists for this purpose, and is exposed via the simROS.sendTransform(...) and simROS.sendTransforms(...) functions.

dvedova
Posts: 5
Joined: 03 Feb 2021, 03:16

Re: Publishing to '/tf' topic does not work

Post by dvedova »

I've been able to narrow down the issue. It seems when I first start a simulation while a roscore is running it is able to publish to /tf with no problem. However, when I shutdown the roscore and re-launch as well as restart the simulation, I am no longer able to publish to /tf. I wasn't expecting this behavior as I have been able to subcribe/publish to topics after restarting ROS and the simulation.

I followed these steps:
1) Launch roscore
2) Launch coppeliaSim
3) Open online_post.ttt
4) Run simulation
5) Check rostopic list ('/tf' should appear)
6) Stop simulation
7) Shutdown roscore
8) Go to step 1) and repeat. '/tf' now doesn't appear as a rostopic while all the other topics being published from the simulation do.

online_post.ttt can be downloaded from this link: https://drive.google.com/file/d/10GSGw1 ... sp=sharing

fferri
Posts: 1224
Joined: 09 Sep 2013, 19:28

Re: Publishing to '/tf' topic does not work

Post by fferri »

You can't shutdown roscore. It must be running when a ROS node starts and for the entire lifetime of the node, so the same applies to CoppeliaSim, which is a ROS node.

dvedova
Posts: 5
Joined: 03 Feb 2021, 03:16

Re: Publishing to '/tf' topic does not work

Post by dvedova »

Okay thank you!

Post Reply