Multiple models with a Gazebo plugin

asked 2015-02-08 04:26:06 -0600

Vale gravatar image

updated 2015-02-08 07:30:51 -0600

Hello everyone,

I have a problem and I don't know how to fix it. I have an sdf file which includes multiple models within it, such as:

<include>
  <uri>model://CubeBot</uri>
  <name>cubebot_1</name>
  <pose>0 0.117 0 -1.57 -1.57 0</pose>    
</include>

<include>
  <uri>model://CubeBot</uri>
  <name>cubebot_2</name>
  <pose>0 0.117 0 -1.57 -1.57 0</pose>    
</include>

and each CubeBot model has a plugin to control it. I control their positions by using a ROS topic which communicates with Gazebo (stand-alone version). I use an array in the plugin in Gazebo to receive different reference positions from ROS, but it doesn't work. In fact when I command a CubeBot to move, (and only it), then even the other CubeBot moves, and I don't want it. Is it possible to fix this problem? I use Gazebo 2.2 and ROS indigo. Thanks a lot.

PS : plugin has been attached C:\fakepath\plugin_cubebot.cc

And these are sdf models: cubebot model C:\fakepath\model.sdf and manipulator model C:\fakepath\model.sdf

edit retag flag offensive close merge delete

Comments

Probably both robots are listening to the same topic

AndreiHaidu gravatar imageAndreiHaidu ( 2015-02-08 06:05:55 -0600 )edit

Even if I use different topics, only one topic works, but both cubes move. And I don't know why.

Vale gravatar imageVale ( 2015-02-08 06:32:20 -0600 )edit

could you update the question with the plugin you are using?

AndreiHaidu gravatar imageAndreiHaidu ( 2015-02-08 06:49:19 -0600 )edit

I have attached the plugin I am using. I receive messages on different ROS topics. If you have questions, just ask. Thank you.

Vale gravatar imageVale ( 2015-02-08 07:11:08 -0600 )edit

i didn't have time to read the code in detail, but does this return different values? std::cout &lt;&lt; stiffness_topic &lt;&lt; "\t" &lt;&lt; position_topic &lt;&lt; "\n";

AndreiHaidu gravatar imageAndreiHaidu ( 2015-02-08 07:54:21 -0600 )edit

Yes, stiffness and position are two different values. And for cubebot 1 I have stiffness1, position1 (topics for cubebot1), and stiffness2 , position2 for cubebot 2. But this method doesn't work. Do you have any ideas?

Vale gravatar imageVale ( 2015-02-08 07:59:11 -0600 )edit

Can you confirm that each model receives the correct message?

nkoenig gravatar imagenkoenig ( 2015-02-11 11:54:36 -0600 )edit

I have fixed this problem in this way:

Vale gravatar imageVale ( 2015-02-17 03:16:46 -0600 )edit