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

Revision history [back]

click to hide/show revision 1
initial version

However i encounter problems as i am unsure if a topic can publish both string and integer on node C.

It is totally possible to do that, you just have to specify the right type of message for the topic. From the standard ros messages (std_msgs) you have either std_msgs::Int16 or std_msgs::String but not both, so you just have to define a custom message (see here the wiki about custom messages).

You can even avoid using the standard ros messages as they use a additional field data, your message would simply be :

int your_integer
string your_string

However i encounter problems as i am unsure if a topic can publish both string and integer on node C.

It is totally possible to do that, you just have to specify the right type of message for the topic. From the standard ros messages (std_msgs) you have either std_msgs::Int16 or std_msgs::String but not both, so you just have to define a custom message (see here the wiki about custom messages).

You can even avoid using the standard ros messages as they use a an additional field data, your message would simply be :

int your_integer
string your_string