First time here? Check out the FAQ!


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 Jan 5 '17

Edu gravatar image

updated Jan 5 '17

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?

Preview: (hide)

Comments

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

Akhilesh gravatar image Akhilesh  ( Jan 5 '17 )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  ( Jan 5 '17 )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  ( Jan 6 '17 )edit

HI, did you find a solution?

Kenn gravatar image Kenn  ( Jul 17 '17 )edit

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

Akhilesh gravatar image Akhilesh  ( Jul 18 '17 )edit

1 Answer

Sort by » oldest newest most voted
5

answered Jan 5 '17

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.

Preview: (hide)

Comments

Thank you !!! :)

Edu gravatar image Edu  ( Jan 5 '17 )edit

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

Kenn gravatar image Kenn  ( Jul 17 '17 )edit

Question Tools

1 follower

Stats

Asked: Jan 5 '17

Seen: 2,321 times

Last updated: Jan 05 '17