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

best way to create a topic

asked 2013-08-14 03:00:26 -0500

hvn gravatar image

Hi,

I have 2 nodes that need 1-way communication of an array of floating point values, so I want node 1 to publish to a topic (e.g. ref), and node 2 to subscribe to that topic. I've searched on how to create a node with topic, but the tutorial only shows a message topic. Now I've tried 2 approaches: using a yaml file and using a launch file according to working examples, but so far neither creates a new topic. So the question is: how do I best create a new topic for 2 existing nodes ?

Thanks

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
3

answered 2013-08-14 04:02:51 -0500

thebyohazard gravatar image

updated 2013-08-15 02:37:18 -0500

felix k gravatar image

I'm not sure you understand the concept of topics and messages quite correctly. It might help you to go through the main tutorials again, in particular UnderstandingTopics and WritingPublisherSubscriber(c++).

Messages are always broadcast on topics. To create a topic, one node needs to advertise that they will broadcast messages on that topic. Then another node subscribes to that topic and receives all messages broadcast on that topic.

edit flag offensive delete link more

Comments

Further, the message type that you are likely interested in using will be one of the multiarray datatypes in the http://www.ros.org/wiki/std_msgs/

SL Remy gravatar image SL Remy  ( 2013-08-15 06:40:20 -0500 )edit

TY @tbh and @trinighost. I did understand but just a minor misconception. The multiarray type did the trick.

hvn gravatar image hvn  ( 2013-08-15 08:23:01 -0500 )edit
0

answered 2018-08-15 06:24:00 -0500

ameni gravatar image

HI, I'm using a roboteq magsensor, and I want to read data from.

so I'm going to use Roboteq Linux API to interface one the sensor form a C++ ROS node through CANbus . The problem is I didn't come to know how to work: it's only one node that's gonna read from the sensor , how to use topic in this situation ?

edit flag offensive delete link more
0

answered 2013-08-14 03:49:23 -0500

dornhege gravatar image

I think you got something confused, but I don't know what. The publisher and subscriber tutorials describe exactly the use case that you want.

yaml or launch files are not needed, just the two nodes.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2013-08-14 03:00:26 -0500

Seen: 3,879 times

Last updated: Nov 24 '13