Ask Your Question
0

Writing a Simple Subscriber

asked 2016-01-25 12:06:54 -0500

kmoy gravatar image

I went through the ROS tutorial for writing a simple publisher and subscriber with the '/chatter' topic, and I'm able to successfully subscribe to the 'chatter' topic and respond with the chatterCallback.

I wish to implement this simple subscriber with another existing ROS topic, called '/points', which is a PointCloud2 message. This topic shows up when I type 'rostopic list' and 'rostopic echo /points'. However, the subscriber will not respond when I change the topic from '/chatter' to '/points'.

I already modified the CMakeLists.txt and package.xml file to add the 'sensor_msgs' package as a build and run dependency. Is there something else I need to do?

edit retag flag offensive close merge delete

Comments

1

There likely are other things you need to do... If you are in C++, you'll need to include new files, change templates and callback signatures, and recompile your workspace. It would be helpful to see your code, and if it is C++, your CMakeLists.txt

jarvisschultz gravatar image jarvisschultz  ( 2016-01-25 17:28:40 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-01-26 02:49:12 -0500

Wolf gravatar image

As @jarvisschultz mentioned, you need to change the type also. A subscriber can only subscribe to messages of a specifc type. E. g. for C++ you need to bind your subcriber to a callback that can handle pointCloud2 msgs. An example for such callback including conversion to the native PCL type you need for accessing the data is given here:

http://answers.ros.org/question/13691...

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2016-01-25 12:06:54 -0500

Seen: 144 times

Last updated: Jan 26 '16