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

I would not mess with boost::bind in this case and put the callback function in a class in order for passing the context to it. Example:

class MySubscriber
{
  std::string po_topic_name;
  ros::Subscriber po_sub;

  void write_enocean( const palgate_madynes_msg::EnOceanFrame& msg )
  {
    // use po_topic_name as you like ...
  }
public:

  MySubscriber( ros::NodeHandle ao_nh, std::string ao_topic ) :
    po_topic_name( ao_topic )
  {
    po_sub = ao_nh.subscribe( ao_topic,1000, &MySubscriber::write_enocean, this );
  }
};

Now you just have to create an Instance of MySubscriber for each of your topics...