[ros-users] How to identify the subscriber or the topic name related to a callback
Ken Conley
kwc at willowgarage.com
Wed Feb 9 18:24:14 UTC 2011
http://www.ros.org/wiki/rospy/Overview/Publishers%20and%20Subscribers#Connection_Information
On Wed, Feb 9, 2011 at 10:21 AM, Bhaskara Marthi
<bhaskara at willowgarage.com> wrote:
> I have a similar use case in Python. Does rospy provide a way to get this
> information?
> - Bhaskara
>
> On Fri, Feb 4, 2011 at 11:05 AM, Jeremy Leibs <leibs at willowgarage.com>
> wrote:
>>
>> On Fri, Feb 4, 2011 at 7:51 AM, Brian Gerkey <gerkey at willowgarage.com>
>> wrote:
>> > On Fri, Feb 4, 2011 at 12:56 AM, Markus Bader
>> > <markus.bader at tuwien.ac.at> wrote:
>> >> I tried using the connection header but for some reasons the topic
>> >> field "topic" does not exist!
>> >> I have: callerid, latching, md5sum, message_definition, type.
>> >
>> > I don't know whether "topic" is supposed be in there, but either way,
>> > the other technique that I described earlier (passing the topic in as
>> > an extra argument to the callback) will work for you.
>> >
>>
>> You're right. According to http://www.ros.org/wiki/ROS/TCPROS
>>
>> The topic is only part of the connection_header that the subscriber
>> sends. Sorry for the confusion. On a side-note it feels like it
>> would be nice to have access to that information in the data structure
>> though.
>>
>> > brian.
>> >
>> >> Currently I am using the Ubuntu 10.04 with the default package
>> >> installation
>> >>
>> >> ros::M_string connection_header = event.getConnectionHeader();
>> >> for ( ros::M_string::iterator it=connection_header.begin() ; it !=
>> >> connection_header.end(); it++ )
>> >> std::cout << it->first << " => " << it->second << std::endl;
>> >>
>> >> That code shows me ----------->
>> >>
>> >> callerid => /camera0/image_proc
>> >> latching => 0
>> >> md5sum => 1b5cf7f984c229b6141ceb3a955aa18f
>> >> message_definition => # This message defines meta information for a
>> >> camera. It should be in ...........
>> >> type => sensor_msgs/CameraInfo
>> >>
>> >> Any hints?
>> >>
>> >> Greetings
>> >> Markus
>> >> _______________________________________________
>> >> ros-users mailing list
>> >> ros-users at code.ros.org
>> >> https://code.ros.org/mailman/listinfo/ros-users
>> >>
>> > _______________________________________________
>> > ros-users mailing list
>> > ros-users at code.ros.org
>> > https://code.ros.org/mailman/listinfo/ros-users
>> >
>> _______________________________________________
>> ros-users mailing list
>> ros-users at code.ros.org
>> https://code.ros.org/mailman/listinfo/ros-users
>
>
>
> --
> Bhaskara Marthi
> Research Scientist
> Willow Garage Inc.
> 650-475-2856
>
> _______________________________________________
> ros-users mailing list
> ros-users at code.ros.org
> https://code.ros.org/mailman/listinfo/ros-users
>
>
More information about the ros-users
mailing list