I can see some gazebo topics, but not all of them...

asked 2016-12-22 15:43:42 -0600

GlenH gravatar image

updated 2016-12-22 17:39:55 -0600

I'm writing a matlab interface to gazebo. I have code that, when run from the command line, sees all of the gazebo topics I'm expecting, eg

gazebo::transport::get_master_uri(_master_host, _master_port);
std::cout << "Host: " << _master_host << "\tport: " << _master_port <<"\n";

topics_list = gazebo::transport::getAdvertisedTopics("");
for(std::list<std::string>::iterator topic=topics_list.begin(); topic!=topics_list.end(); topic++) {
    std::cout << (*topic) << "\n";

gives the expected result, which is around fifty different topics. But that same code, when copied into a mex file (a specialized C++ plugin format for Matlab), and executed as a Matlab plugin, only returns a subset of the topics:

Host: localhost port: 11345

Topics that do not show up include


I'm kind of at a loss. Is there anything special about these particular topics that would cause partially functioning code, or code that was being executed in a strange environment or with misconfigured environmental variables, to see them but not others?

edit retag flag offensive close merge delete


Can you add the topics which are missing to your question? (at least a few of them)

chapulina gravatar imagechapulina ( 2016-12-22 15:48:55 -0600 )edit

None of the topics created by my robot plugin show up, eg /gazebo/default/my_robot/joint_cmd But there are others that don't show up either, including: /gazebo/default/user_camera/joy_pose /gazebo/default/user_camera/joy_twist /gazebo/default/ground_plane/link/wrench /gazebo/default/gzclient_camera/cmd /gazebo/default/skeleton_pose/info /gazebo/default/sky /gazebo/default/light /gazebo/default/model/modify

GlenH gravatar imageGlenH ( 2016-12-22 17:20:23 -0600 )edit

Mysterious... When you check on the command line with `gz topic -l`, do all of them show?

chapulina gravatar imagechapulina ( 2016-12-22 17:41:58 -0600 )edit

Yep. Every last one of them. I can also issue a "system" command inside Matlab, which issues a shell command, eg system('\usr\local\bin\gz topic -l') and that *also* returns all of the topics.

GlenH gravatar imageGlenH ( 2016-12-22 17:44:22 -0600 )edit

One potentially pertinent fact: Matlab links against a bunch of the same libraries gazebo does, including boost and protobuf. But Matlab's versions are typically a couple of versions older than gazebo's. When building my MEX file I have tried both dynamically linking to dylibs and statically linking to .a files. Neither one seems to make any difference, but it's possible that I'm not seeing a dependency somewhere.

GlenH gravatar imageGlenH ( 2016-12-22 17:48:13 -0600 )edit