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

Publishing multiple data types in one ros topic in Arduino

asked 2016-04-18 13:18:12 -0500

pankaj patel gravatar image

Hi all, I followed this tutorial for rosserial in arduino link text But here in this tutorial I need to add different ros topics for every new data types like string, int ,float etc. What if I want to publish multiple data types in a single ros topic ? What should I do ?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-04-18 13:33:21 -0500

You can't publish multiple data types to a single topic. What you need to do is publish multiple topics from a single node.

edit flag offensive delete link more


Thanks Nicholas for replying, I am reading an arduino mega board by ros. I have string, integer and float data coming from arduino and I want to print all data in one terminal. But I can see only one type of data in one terminal by rostopic echo. How can I do this ? I am new to ROS.

pankaj patel gravatar image pankaj patel  ( 2016-04-19 03:43:40 -0500 )edit

You could make a custom message that holds a string, integer, and float. Populate that message type in your node and publish it.

Icehawk101 gravatar image Icehawk101  ( 2016-04-19 07:29:23 -0500 )edit

Hi Nicholas I made header file for string and integer data type as you said. Now I am having another issue I posted here :link text

pankaj patel gravatar image pankaj patel  ( 2016-04-20 06:26:10 -0500 )edit

Question Tools

1 follower


Asked: 2016-04-18 13:18:12 -0500

Seen: 1,927 times

Last updated: Apr 18 '16