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

Is this possible somehow?

In general? No, I would say you can't. Not with any of the command line tools that are provided "as part of a standard ROS install".

If you know which nodes are publishing to those topics (note: topics are not "created", in fact, they do not really "exist" in a sense), you could:

  1. figure out the package that hosts the/those node(s)
  2. retrieve the source code of the package
  3. use something like grep to find occurences of the topic name in the code

But note though: due to remapping and dynamic topic name creation, there is no guarantee at all that you will be able to find the publishers this way. Especially with Python nodes, as Python is so flexible that many "crazy" things can be done at runtime making this sort of sleuthing rather difficult.

I see certain topics which I can't find anywhere inside the ROS package which is supposed to have created them.

nitpick: nodes can be publishers. Packages can't.

Also note that rostopic list shows you a topic name in three cases:

  1. topic is published to
  2. topic is subscribed to
  3. topic is both published and subscribed to

So it could be that a subscriber causes a topic to appear in rostopic list, and that subscriber could be "anywhere".

Is this possible somehow?

In general? general (and with "a single command")? No, I would say you can't. Not with any of the command line tools that are provided "as part of a standard ROS install".

If however you know which nodes are publishing or subscribing to those topics (note: topics are not "created", in fact, in some sense they do not really "exist" in a sense), even "exist"), you could:

  1. figure out the package that hosts the/those node(s)
  2. retrieve the source code of the package
  3. use something like grep to find occurences of the topic name in the code

But note though: due to remapping and dynamic topic name creation, there is no guarantee at all that you will be able to find the publishers this way. Especially with Python nodes, as Python is so flexible that many "crazy" things can be done at runtime making this sort of sleuthing rather difficult.

I see certain topics which I can't find anywhere inside the ROS package which is supposed to have created them.

nitpick: nodes can be publishers. Packages can't.

Also note that rostopic list shows you a topic name in three cases:

  1. topic is published to
  2. topic is subscribed to
  3. topic is both published and subscribed to

So it could be that a subscriber causes a topic to appear in rostopic list, and that subscriber could be "anywhere".

Is this possible somehow?

In general (and with "a single command")? No, I would say you can't. Not with any of the command line tools that are provided "as part of a standard ROS install".

If however you know which nodes are publishing or subscribing to those topics (note: topics are not "created", in fact, in some sense they do not really even "exist"), you could:

  1. figure out the package that hosts the/those node(s)
  2. retrieve the source code of the package
  3. use something like grep to find occurences of the topic name in the code

But note though: due to remapping and dynamic topic name creation, there is no guarantee at all that you will be able to find the publishers this way. Especially with Python nodes, as Python is so flexible that many "crazy" things can be done at runtime making this sort of sleuthing rather difficult.

I see certain topics which I can't find anywhere inside the ROS package which is supposed to have created them.

nitpick: nodes can be publishers. Packages can't.

Also note that rostopic list shows you a topic name in three cases:

  1. topic is published to
  2. topic is subscribed to
  3. topic is both published and subscribed to

So it could be that a subscriber causes a topic to appear in rostopic list, and that subscriber could be "anywhere".


Edit:

I'm trying to use this ROS package. After having launched the Pioneer 3AT, if I type rostopic list, I see a bunch of topics related to the Pioneer, but I can't find the place where they are being published from.

Looking at the repository you linked, two things stand out:

  1. this is not a package, but an entire workspace with one package (pioneer3at_simulation) and two git submodules pointing to other repositories (with even more packages)
  2. the main package pioneer3at_simulation provides a collection of .launch files (here) that together start (among other things): gazebo and something called teleop_joy.

Gazebo then is configured to load various .world files, urdf_spawner is then used to inject a model of a 3-AT, that loads multiple Gazebo plugins, etc, etc. I haven't checked the two repositories linked in via the git submodules, but I expect those to also either provide additional nodes and/or plugins.

Gazebo, the teleop nodes and all of the Gazebo plugins will both publish and subscribe to topics, and those will appear in rostopic list.

So in order to find "the file where a specific topic was created", you'd have to check the sources of all those packages.

Is this possible somehow?

In general (and with "a single command")? No, I would say you can't. Not with any of the command line tools that are provided "as part of a standard ROS install".

If however you know which nodes are publishing or subscribing to those topics (note: topics are not "created", in fact, in some sense they do not really even "exist"), you could:

  1. figure out the package that hosts the/those node(s)
  2. retrieve the source code of the package
  3. use something like grep to find occurences of the topic name in the code

But note though: due to remapping and dynamic topic name creation, there is no guarantee at all that you will be able to find the publishers this way. Especially with Python nodes, as Python is so flexible that many "crazy" things can be done at runtime making this sort of sleuthing rather difficult.

I see certain topics which I can't find anywhere inside the ROS package which is supposed to have created them.

nitpick: nodes can be publishers. Packages can't.

Also note that rostopic list shows you a topic name in three cases:

  1. topic is published to
  2. topic is subscribed to
  3. topic is both published and subscribed to

So it could be that a subscriber causes a topic to appear in rostopic list, and that subscriber could be "anywhere".


Edit:

I'm trying to use this ROS package. After having launched the Pioneer 3AT, if I type rostopic list, I see a bunch of topics related to the Pioneer, but I can't find the place where they are being published from.

Looking at the repository you linked, two things stand out:

  1. this is not a package, but an entire workspace with one package (pioneer3at_simulation) and two git submodules pointing to other repositories (with even more packages)
  2. the main package pioneer3at_simulation provides a collection of .launch files (here) that together start (among other things): gazebo and something called teleop_joy.

Gazebo then is configured to load various .world files, urdf_spawner is then used to inject a model of a 3-AT, that loads multiple Gazebo plugins, etc, etc. I haven't checked the two repositories linked in via the git submodules, but I expect those to also either provide additional nodes and/or plugins.

Gazebo, the teleop nodes and all of the Gazebo plugins will both publish and subscribe to topics, and those will appear in rostopic list.

So in order to find "the file where a specific topic was created", you'd have to check the sources of all those packages.


Edit2: I haven't checked, but there is a small chance that you could actually figure out where a topic is published or subscribed to without grepping through source code: the ROS log(s). It might be possible to print out the source line nr (when configured using ROSCONSOLE_FORMAT) and a sufficiently high logging level (DEBUG or even higher). If this works, I wouldn't recommend doing this in production systems though.

I would like to see the files (the source code) where they are being published from (or where they have been created). Is this possible somehow?

In general (and with "a single command")? No, I would say you can't. Not with any of the command line tools that are provided "as part of a standard ROS install".

If however you know which nodes are publishing or subscribing to those topics (note: topics are not "created", in fact, in some sense they do not really even "exist"), you could:

  1. figure out the package that hosts the/those node(s)
  2. retrieve the source code of the package
  3. use something like grep to find occurences of the topic name in the code

But note though: due to remapping and dynamic topic name creation, there is no guarantee at all that you will be able to find the publishers this way. Especially with Python nodes, as Python is so flexible that many "crazy" things can be done at runtime making this sort of sleuthing rather difficult.

I see certain topics which I can't find anywhere inside the ROS package which is supposed to have created them.

nitpick: nodes can be publishers. Packages can't.

Also note that rostopic list shows you a topic name in three cases:

  1. topic is published to
  2. topic is subscribed to
  3. topic is both published and subscribed to

So it could be that a subscriber causes a topic to appear in rostopic list, and that subscriber could be "anywhere".


Edit:

I'm trying to use this ROS package. After having launched the Pioneer 3AT, if I type rostopic list, I see a bunch of topics related to the Pioneer, but I can't find the place where they are being published from.

Looking at the repository you linked, two things stand out:

  1. this is not a package, but an entire workspace with one package (pioneer3at_simulation) and two git submodules pointing to other repositories (with even more packages)
  2. the main package pioneer3at_simulation provides a collection of .launch files (here) that together start (among other things): gazebo and something called teleop_joy.

Gazebo then is configured to load various .world files, urdf_spawner is then used to inject a model of a 3-AT, that loads multiple Gazebo plugins, etc, etc. I haven't checked the two repositories linked in via the git submodules, but I expect those to also either provide additional nodes and/or plugins.

Gazebo, the teleop nodes and all of the Gazebo plugins will both publish and subscribe to topics, and those will appear in rostopic list.

So in order to find "the file where a specific topic was created", you'd have to check the sources of all those packages.


Edit2: I haven't checked, but there is a small chance that you could actually figure out where a topic is published or subscribed to without grepping through source code: the ROS log(s). It might be possible to print out the source line nr (when configured using ROSCONSOLE_FORMAT) and a sufficiently high logging level (DEBUG or even higher). If this works, I wouldn't recommend doing this in production systems though.

I would like to see the files (the source code) where they are being published from (or where they have been created). Is this possible somehow?

In general (and with "a single command")? No, I would say you can't. Not with any of the command line tools that are provided "as part of a standard ROS install".

If however you know which nodes are publishing or subscribing to those topics (note: topics are not "created", in fact, in some sense they do not really even "exist"), you could:

  1. figure out the package that hosts the/those node(s)
  2. retrieve the source code of the package
  3. use something like grep to find occurences of the topic name in the code

But note though: due to remapping and dynamic topic name creation, there is no guarantee at all that you will be able to find the publishers this way. Especially with Python nodes, as Python is so flexible that many "crazy" things can be done at runtime making this sort of sleuthing rather difficult.

I see certain topics which I can't find anywhere inside the ROS package which is supposed to have created them.

nitpick: nodes can be publishers. Packages can't.

Also note that rostopic list shows you a topic name in three cases:

  1. topic is published to
  2. topic is subscribed to
  3. topic is both published and subscribed to

So it could be that a subscriber causes a topic to appear in rostopic list, and that subscriber could be "anywhere".


Edit:

I'm trying to use this ROS package. After having launched the Pioneer 3AT, if I type rostopic list, I see a bunch of topics related to the Pioneer, but I can't find the place where they are being published from.

Looking at the repository you linked, two things stand out:

  1. this is not a package, but an entire workspace with one package (pioneer3at_simulation) and two git submodules pointing to other repositories (with even more packages)
  2. the main package pioneer3at_simulation provides a collection of .launch files (here) that together start (among other things): gazebo and something called teleop_joy.

Gazebo then is configured to load various .world files, urdf_spawner is then used to inject a model of a 3-AT, that loads multiple Gazebo plugins, etc, etc. I haven't checked the two repositories linked in via the git submodules, but I expect those to also either provide additional nodes and/or plugins.

Gazebo, the teleop nodes and all of the Gazebo plugins will both publish and subscribe to topics, and those will appear in rostopic list.

So in order to find "the file where a specific topic was created", you'd have to check the sources of all those packages.


Edit2: I haven't checked, but there is a small chance that you could actually figure out where a topic is published or subscribed to without grepping through source code: the ROS log(s). It might be possible to print out the source line nr (when configured using ROSCONSOLE_FORMAT) and a sufficiently high logging level (DEBUG or even higher). If this works, I wouldn't recommend doing this in production systems though.


Edit 3:

For example, using rostopic list, I see the topic /pioneer3at/camera_down/image_raw. The only place inside that package where I find that topic is in the file rqt_gui_cameras.perspective

This is a good example of what I described in Edit 2: that topic name is not something you will find directly in the sources of any of those packages, as it's dynamically created inside a xacro macro (here) that loads a Gazebo camera plugin (here) which finally is instantiated here with the argument "down".

Taking all that together we end up with a Gazebo sensor that uses a Gazebo ROS Camera plugin, has the name camera_down and publishes on the topic /pioneer3at/camera_down/image_raw (as you can see here).

The complete string /pioneer3at/camera_down/image_raw doesn't appear in any of these sources, but if we take the dynamic behaviour of all the involved components into account we can figure it out.

Note that in this particular case grepping the output of xacro after converting the pioneer3at.urdf.xacro file with the proper arguments supplied would have resulted in at least parts of the topic name appearing in the .urdf file.

I would like to see the files (the source code) where they are being published from (or where they have been created). Is this possible somehow?

In general (and with "a single command")? No, I would say you can't. Not with any of the command line tools that are provided "as part of a standard ROS install".

If however you know which nodes are publishing or subscribing to those topics (note: topics are not "created", in fact, in some sense they do not really even "exist"), you could:

  1. figure out the package that hosts the/those node(s)
  2. retrieve the source code of the package
  3. use something like grep to find occurences of the topic name in the code

But note though: due to remapping and dynamic topic name creation, there is no guarantee at all that you will be able to find the publishers this way. Especially with Python nodes, as Python is so flexible that many "crazy" things can be done at runtime making this sort of sleuthing rather difficult.

I see certain topics which I can't find anywhere inside the ROS package which is supposed to have created them.

nitpick: nodes can be publishers. Packages can't.

Also note that rostopic list shows you a topic name in three cases:

  1. topic is published to
  2. topic is subscribed to
  3. topic is both published and subscribed to

So it could be that a subscriber causes a topic to appear in rostopic list, and that subscriber could be "anywhere".


Edit:

I'm trying to use this ROS package. After having launched the Pioneer 3AT, if I type rostopic list, I see a bunch of topics related to the Pioneer, but I can't find the place where they are being published from.

Looking at the repository you linked, two things stand out:

  1. this is not a package, but an entire workspace with one package (pioneer3at_simulation) and two git submodules pointing to other repositories (with even more packages)
  2. the main package pioneer3at_simulation provides a collection of .launch files (here) that together start (among other things): gazebo and something called teleop_joy.

Gazebo then is configured to load various .world files, urdf_spawner is then used to inject a model of a 3-AT, that loads multiple Gazebo plugins, etc, etc. I haven't checked the two repositories linked in via the git submodules, but I expect those to also either provide additional nodes and/or plugins.

Gazebo, the teleop nodes and all of the Gazebo plugins will both publish and subscribe to topics, and those will appear in rostopic list.

So in order to find "the file where a specific topic was created", you'd have to check the sources of all those packages.


Edit2: I haven't checked, but there is a small chance that you could actually figure out where a topic is published or subscribed to without grepping through source code: the ROS log(s). It might be possible to print out the source line nr (when configured using ROSCONSOLE_FORMAT) and a sufficiently high logging level (DEBUG or even higher). If this works, I wouldn't recommend doing this in production systems though.


Edit 3:

For example, using rostopic list, I see the topic /pioneer3at/camera_down/image_raw. The only place inside that package where I find that topic is in the file rqt_gui_cameras.perspective

This is a good example of what I described in Edit 2: my original answer: that topic name is not something you will find directly in the sources of any of those packages, as it's dynamically created inside a xacro macro (here) that loads a Gazebo camera plugin (here) which finally is instantiated here with the argument "down".

Taking all that together we end up with a Gazebo sensor that uses a Gazebo ROS Camera plugin, has the name camera_down and publishes on the topic /pioneer3at/camera_down/image_raw (as you can see here).

The complete string /pioneer3at/camera_down/image_raw doesn't appear in any of these sources, but if we take the dynamic behaviour of all the involved components into account we can figure it out.

Note that in this particular case grepping the output of xacro after converting the pioneer3at.urdf.xacro file with the proper arguments supplied would have resulted in at least parts of the topic name appearing in the .urdf file.

I would like to see the files (the source code) where they are being published from (or where they have been created). Is this possible somehow?

In general (and with "a single command")? No, I would say you can't. Not with any of the command line tools that are provided "as part of a standard ROS install".

If however you know which nodes are publishing or subscribing to those topics (note: topics are not "created", in fact, in some sense they do not really even "exist"), you could:

  1. figure out the package that hosts the/those node(s)
  2. retrieve the source code of the package
  3. use something like grep to find occurences of the topic name in the code

But note though: due to remapping and dynamic topic name creation, there is no guarantee at all that you will be able to find the publishers this way. Especially with Python nodes, as Python is so flexible that many "crazy" things can be done at runtime making this sort of sleuthing rather difficult.

I see certain topics which I can't find anywhere inside the ROS package which is supposed to have created them.

nitpick: nodes can be publishers. Packages can't.

Also note that rostopic list shows you a topic name in three cases:

  1. topic is published to
  2. topic is subscribed to
  3. topic is both published and subscribed to

So it could be that a subscriber causes a topic to appear in rostopic list, and that subscriber could be "anywhere".


Edit:

I'm trying to use this ROS package. After having launched the Pioneer 3AT, if I type rostopic list, I see a bunch of topics related to the Pioneer, but I can't find the place where they are being published from.

Looking at the repository you linked, two things stand out:

  1. this is not a package, but an entire workspace with one package (pioneer3at_simulation) and two git submodules pointing to other repositories (with even more packages)
  2. the main package pioneer3at_simulation provides a collection of .launch files (here) that together start (among other things): gazebo and something called teleop_joy.

Gazebo then is configured to load various .world files, urdf_spawner is then used to inject a model of a 3-AT, that loads multiple Gazebo plugins, etc, etc. I haven't checked the two repositories linked in via the git submodules, but I expect those to also either provide additional nodes and/or plugins.

Gazebo, the teleop nodes and all of the Gazebo plugins will both publish and subscribe to topics, and those will appear in rostopic list.

So in order to find "the file where a specific topic was created", you'd have to check the sources of all those packages.


Edit2: I haven't checked, but there is a small chance that you could actually figure out where a topic is published or subscribed to without grepping through source code: the ROS log(s). It might be possible to print out the source line nr (when configured using ROSCONSOLE_FORMAT) and a sufficiently high logging level (DEBUG or even higher). If this works, I wouldn't recommend doing this in production systems though.


Edit 3:

For example, using rostopic list, I see the topic /pioneer3at/camera_down/image_raw. The only place inside that package where I find that topic is in the file rqt_gui_cameras.perspective

This is a good example of what I described in my original answer: answer ("dynamic topic name creation"): that topic name is not something you will find directly in the sources of any of those packages, as it's dynamically created inside a xacro macro (here) that loads a Gazebo camera plugin (here) which finally is instantiated here with the argument "down".

Taking all that together we end up with a Gazebo sensor that uses a Gazebo ROS Camera plugin, has the name camera_down and publishes on the topic /pioneer3at/camera_down/image_raw (as you can see here).

The complete string /pioneer3at/camera_down/image_raw doesn't appear in any of these sources, but if we take the dynamic behaviour of all the involved components into account we can figure it out.

Note that in this particular case grepping the output of xacro after converting the pioneer3at.urdf.xacro file with the proper arguments supplied would have resulted in at least parts of the topic name appearing in the .urdf file.