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

Can a node publish different types on one topic?

asked 2017-01-05 04:45:10 -0500

Edu gravatar image

updated 2017-01-05 09:26:39 -0500

NEngelhard gravatar image

I am new to ROS and just started studying. I am stuck with using custom message types. I would like to know is it possible to publish two different data type to single topic? Or do we need to publish separately?

edit retag flag offensive close merge delete

Comments

Hi, you can publish even more than two data types but it depends on what you want to send.

Akhilesh gravatar image Akhilesh  ( 2017-01-05 08:32:22 -0500 )edit

their is no need to publish two types of msgs from single topic, just make another publisher its easy, any number of msgs u can publish, but from single topic i'm hearing first time.

dinesh gravatar image dinesh  ( 2017-01-05 10:07:52 -0500 )edit

if you advertise a topic like node.advertise<camerainfo>("camera_info", 1); , so in CameraInfo class, there is more than one data types are available like uint32, string etc.

Akhilesh gravatar image Akhilesh  ( 2017-01-05 23:56:24 -0500 )edit

HI, did you find a solution?

Kenn gravatar image Kenn  ( 2017-07-17 03:19:18 -0500 )edit

Can you specify what exactly you want to publish? Or add some piece of code to understand the need.

Akhilesh gravatar image Akhilesh  ( 2017-07-18 09:16:41 -0500 )edit

1 Answer

Sort by » oldest newest most voted
5

answered 2017-01-05 06:27:15 -0500

Procópio gravatar image

No, you have to publish it separately. Why would you want to publish in the same topic? If you explain what you are trying to accomplish, maybe we can propose a solution.

edit flag offensive delete link more

Comments

Thank you !!! :)

Edu gravatar image Edu  ( 2017-01-05 07:09:13 -0500 )edit

Hi, I am trying to accomplish something similar, can you take a look at my question? Thanks.

Kenn gravatar image Kenn  ( 2017-07-17 03:18:30 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2017-01-05 04:45:10 -0500

Seen: 2,138 times

Last updated: Jan 05 '17