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

topic question

asked 2017-08-25 13:34:12 -0600

updated 2017-08-25 23:16:36 -0600

Ed Venator gravatar image

ubuntu 16.04 ROS kinetic

as per http://wiki.ros.org/ROS/Tutorials/Und... , i have listed my verbose details on topics in use rn:

~$ rostopic list -v

Published topics:
 * /turtle1/color_sensor [turtlesim/Color] 1 publisher
 * /turtle1/cmd_vel [geometry_msgs/Twist] 1 publisher
 * /rosout [rosgraph_msgs/Log] 4 publishers
 * /rosout_agg [rosgraph_msgs/Log] 1 publisher
 * /turtle1/pose [turtlesim/Pose] 1 publisher

Subscribed topics:
 * /turtle1/cmd_vel [geometry_msgs/Twist] 2 subscribers
 * /rosout [rosgraph_msgs/Log] 1 subscriber
 * /statistics [rosgraph_msgs/TopicStatistics] 1 subscriber

then I tried $ rostopic list -p to see the list of publishers.

/rosout
/rosout_agg
/turtle1/cmd_vel
/turtle1/color_sensor
/turtle1/pose
  1. I did not expect to see the names of topics here because I did not understand that the publishers and subscribers themselves are actually the topics. I would have thought that the pubs and subs would just be nodes. Can someone explain why this is?
  2. are all of these topics only topics or can a topic also be a node or a message?
  3. just to check my understanding, is this right? a topic recieves a message from a node and gives it to a different node? does it sometimes give it to a different topic like could it be a recursive path through many things or like a function in algebra where you may have one message and one topic goes to more than one node ?
edit retag flag offensive close merge delete

Comments

This question would be easier to read (and answer) if you use the Preformat Text (101010) button on the commands that you ran and the terminal output.

jayess gravatar image jayess  ( 2017-08-25 14:10:01 -0600 )edit
1

@binarybabe: have you read the Concepts page on the wiki? That should answer some of your questions. Also, I'll reiterate my advise from #q269540 to pick up a book or two about ROS.

gvdhoorn gravatar image gvdhoorn  ( 2017-08-25 15:34:29 -0600 )edit

rosout is a node and /rosout is also a topic. that clears a lot up for me actually. thank you

moonspacedancer gravatar image moonspacedancer  ( 2017-08-26 19:02:22 -0600 )edit

I'm not understanding this. Is this an answer to your question or a comment?

jayess gravatar image jayess  ( 2017-08-26 22:05:58 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-08-26 22:25:14 -0600

jayess gravatar image

updated 2017-08-26 22:28:23 -0600

Well, based on your answer (comment?) a node is not also a topic (if I understand you correctly). There is a node named /rosout and a topic with the name /rosout. If you run rostopic info /rosout you'll see that the node /rosout is not publishing to the topic /rosout:

Type: rosgraph_msgs/Log

Publishers: 
 * /turtlesim (http://jayess:55350/)

Subscribers: 
 * /rosout (http://jayess:38176/)

I'm not sure what node(s) you were running for your question so I am using the turtlesim_node here because it looks to be pretty similar.

With turtlesim_node running, if i run rostopic list -v I get the following output:

Published topics:
 * /turtle1/color_sensor [turtlesim/Color] 1 publisher
 * /rosout [rosgraph_msgs/Log] 1 publisher
 * /rosout_agg [rosgraph_msgs/Log] 1 publisher
 * /turtle1/pose [turtlesim/Pose] 1 publisher

Subscribed topics:
 * /turtle1/cmd_vel [geometry_msgs/Twist] 1 subscriber
 * /rosout [rosgraph_msgs/Log] 1 subscriber

This shows the names of the topics such as /turtle1/color_sensor, the message type turtlesim/Color, and how many publishers 1 publisher listed under the section labeled Published topics. It's similar for the subscribers.

Now, if I run rostopic list, I get the following output:

/rosout
/rosout_agg
/turtle1/cmd_vel
/turtle1/color_sensor
/turtle1/pose

and if I run rostopic list -p, I get the following output:

/rosout
/rosout_agg
/turtle1/color_sensor
/turtle1/pose

The difference between the two commands (as far as I know) is that rostopic list shows all topics and rostopic list -p shows only the topics that are currently being published. Notice with the last command that the /turtle1/cmd_vel isn't shown. This is because nothing is publishing to it. The turtlesim_node is subscribed to it, that's why it's listed with rostopic list. You can prove this by running rostopic info /turtle1/cmd_vel:

Type: geometry_msgs/Twist

Publishers: None

Subscribers: 
 * /turtlesim (http://jayess:55350/)

So, don't get confused when nodes and topics have the same name, they are completely different entities but can have the same name without affecting anything (except to sometimes confuse people). Like @gvdhoorn suggested, you should pick up some books on ROS (and read more of the wiki) to help clarify some of these concepts.

edit flag offensive delete link more

Comments

Thank you!! very in depth answer. I see now that the rosout comes as a node and as a topic and that's what was confusing me

moonspacedancer gravatar image moonspacedancer  ( 2017-08-28 14:22:57 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-08-25 13:34:12 -0600

Seen: 783 times

Last updated: Aug 26 '17