why ros_enabled model plugin not working with a ros subscriber that recieves laser scans?

asked 2013-07-30 13:49:47 -0500

Zahra gravatar image


I have a world file with three ros enabled model plugins

the first one: a ros enabled gazebo model plugin (publisher)that publish laser scans to Ros which it works fine. And I added it to Hokuyo laser model.

The second one: ros enabled gazebo model plugin (subscriber),that receives those laser scans from that topic and it works as well.

The third plugin: subscribing to ROS nodes using string type of msgs that has callback functions and I added this plugin to an “elevator “ model.

The problem is with the third plugin which stops working once I add the subscriber plugin to the Hokuyo model

When I remove the laser scans subscriber from Hokuyo model and keeps the publisher, the third plugin works perfectly without problems.

Any ideas why this happening and what is the solution if there is any!

I tested the plugins using groovy once and fuerte as well , no difference. and I am using gazebo 1.8.6

Thanks in advance!

edit retag flag offensive close merge delete


Can you describe the "stops working" behavior of the third plugin? It sounds like something is blocking in one of you plugins. Try commenting out your code to a point where gazebo works. Then slowly add portions back in to find out what chunk is causing the problem.

nkoenig gravatar imagenkoenig ( 2013-07-30 18:59:06 -0500 )edit

Thanks for replying. When I publish over ROS topic with this command : rostopic pub -r 1 /gz/Elevator_controller std_msgs/String "Floor1" on the terminal I see these msgs: [ INFO] [1349938026.456682890]:Second Floor: [Floor1] but when I add the subscriber in the laser model the rostopic of the “elevator” stops publishing. I also have other string topics in the third plugin wont publish over ROS. am going to test the plugins in the way you mentioned.

Zahra gravatar imageZahra ( 2013-07-31 01:40:08 -0500 )edit

I havent changed anything in the plugins but I changed the order of the plugins in the world file and put the subscriber plugin after the third plugin (elevator ) has solved the problem .

Zahra gravatar imageZahra ( 2013-07-31 08:15:44 -0500 )edit

Hi, can you tell me how you subscribed to ROS topics from your plugins?? I am unable to get mine to work because I don't know how to initialize the subscriber in this situation. I did "sub= nh.subscribe("myTopic", 1000, pluginCallback);" but there are errors saying it cannot locate that plugin... although it definitely exists. It's in the same class as the function with this line of code.

an gravatar imagean ( 2014-09-18 14:57:21 -0500 )edit