What does the rospy.subscriber command do? [closed]

asked 2020-09-25 00:44:53 -0500

venkatesh gravatar image

updated 2020-09-29 05:10:36 -0500

mgruhler gravatar image

I cant able to understand what this code does. Explanation in wiki page is n ot clear to me. someone please help me understand what the below code is.

if __name__ == '__main__':
     rospy.init_node('turtle_tf_broadcaster')
     turtlename = rospy.get_param('~turtle')
     rospy.Subscriber('/%s/pose' % turtlename,
                      turtlesim.msg.Pose,
                      handle_turtle_pose,
                      turtlename)
      rospy.spin()
edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by mgruhler
close date 2020-09-30 01:17:25.104981

Comments

1

You need to clarify what exactly you do not understand. Also, it would help if you link to the wiki page you refer to. Is this a tutorial? Something specifc? Then we might be able to help...

mgruhler gravatar image mgruhler  ( 2020-09-25 04:54:29 -0500 )edit

http://wiki.ros.org/tf/Tutorials/Writ... this is a tf broadcaster tutorial. I don't understand the rospy.subscriber command. Thank you mgruhler

venkatesh gravatar image venkatesh  ( 2020-09-29 00:37:16 -0500 )edit

I edited your question title to somewhat reflect what you are having trouble with.

Subscribers are a very basic concept of ROS. If you are working through the tf tutorials, I guess you have read the ROS Getting Started section, especially the Concepts and followed the Beginner Tutorials. There is one specifically dealing with how to create a subscriber in python. There, everything is explained in detail.

When you've gone through those tutorials and still have questions, please come back and provide more details what you don't understand.

mgruhler gravatar image mgruhler  ( 2020-09-29 05:15:58 -0500 )edit

Thank you mgruhler

venkatesh gravatar image venkatesh  ( 2020-09-29 13:26:47 -0500 )edit

I marked the question as outdated as I think your last comment means you've actually solved your issues. If not, please feel free to reopen the question and provide the respective details (or, post a new, more comprehensive and detailed, question)

mgruhler gravatar image mgruhler  ( 2020-09-30 01:18:14 -0500 )edit