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

Revision history [back]

click to hide/show revision 1
initial version

Hi there,

Can you please describe your use-case in more detail? I'm not quite getting what you're trying to do. A minimal example should do. Subscribing to a topic and publishing a message is covered in the tutorials here: http://wiki.ros.org/ROS/Tutorials

That said two useful packages come to my mind, that may interest you:

http://wiki.ros.org/topic_tools

http://wiki.ros.org/message_filters

Hi there,

Can you please describe your use-case in more detail? I'm not quite getting what you're trying to do. A minimal example should do. Subscribing to a topic and publishing a message is covered in the tutorials here: http://wiki.ros.org/ROS/Tutorials

That said two useful packages come to my mind, that may interest you:

http://wiki.ros.org/topic_tools

http://wiki.ros.org/message_filters


(edit after comment)

Just to clarify, you want to subscribe to the topic waypoint and store every message received, eg geometry_msg/PoseStamped in an array. After some condition, be it 10 messages received, you would like to do someting.

In this use-case one can design a class. initialise the subscriber, array, counter, ... at the constructor and add the callback as class method. At the callback you add the messages to the array and check if your condition is met. A few things here:

  • pass the ros::NodeHandle via the constructor of your class
  • unregister your subscriber to avoid receiving new messages and therefore triggering the callback