0
$\begingroup$

Rosanswers logo

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?


Originally posted by Edu on ROS Answers with karma: 11 on 2017-01-05

Post score: 1


Original comments

Comment by Akhilesh on 2017-01-05:
Hi, you can publish even more than two data types but it depends on what you want to send.

Comment by dinesh on 2017-01-05:
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.

Comment by Akhilesh on 2017-01-06:
if you advertise a topic like node.advertise("camera_info", 1); , so in CameraInfo class, there is more than one data types are available like uint32, string etc.

Comment by Kenn on 2017-07-17:
HI, did you find a solution?

Comment by Akhilesh on 2017-07-18:
Can you specify what exactly you want to publish? Or add some piece of code to understand the need.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by Procópio with karma: 4402 on 2017-01-05

This answer was ACCEPTED on the original site

Post score: 5


Original comments

Comment by Edu on 2017-01-05:
Thank you !!! :)

Comment by Kenn on 2017-07-17:
Hi, I am trying to accomplish something similar, can you take a look at my question? Thanks.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.