[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ros-users
Subject:    [ros-users] How to identify the subscriber or the topic name related to a callback
From:       markus.bader () tuwien ! ac ! at (Markus Bader)
Date:       2011-01-31 13:46:04
Message-ID: AANLkTimvopBiAuXPWoBaKWz6vr2NatU44eBj_eudq6Pz () mail ! gmail ! com
[Download RAW message or body]

Hello

I have multiple subscriber calling the same callback function. How can
I determinate within my callback function the related topic name?
getPublisherName gives me the related publisher but not the topic?


for (unsigned int i = 0; i < topics.size(); i++) {
        sub[i] = n_.subscribe(topics[i], 1000, &MyClass::callback, this);
}

void callback(const ros::MessageEvent<std_msgs::String const>& event)
{
  const std::string& publisher_name = event.getPublisherName();
  #Here comes the problem
  const std::string& topic_name = event.?????????();
}

Thanks
Markus

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic