Gazebo | Ignition | Community
Ask Your Question

Spawn multiple objects with plugin

asked 2020-11-27 01:12:05 -0600

dragobette gravatar image
<plugin name="camera_controller" filename="">

Hello. Having this in my camera model's SDF I am not able to spawn multiple objects because they will have the same topics. How can I solve this problem?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2020-11-27 05:17:43 -0600

nlamprian gravatar image

updated 2020-11-30 03:41:27 -0600

Give unique names to the plugins

<plugin name="camera_x" filename="">

as well as camera names



To spawn multiple instances of your model, you need to remove the robotNamespace parameter from the model. Then you can spawn unique models by adding a namespace to the spawn_model node:

<node name="spawn_urdf" pkg="gazebo_ros" type="spawn_model" args="-urdf -model $(arg robot_name) -param robot_description" ns="$(arg robot_name)" />

Alternatively, although not recommended, you can add an argument for the robot name in your urdf:

<xacro:arg name="robot_name" default="robot_0" />
<plugin name="camera_controller" filename="">
  <robotNamespace>$(arg robot_name)</robotNamespace>    

Then, you need to create individual urdf descriptions for each robot:

<param name="$(arg robot_name)/robot_description" command="rosrun xacro xacro /path/to/xacro/file robot_name:=$(arg robot_name)" />
<node name="spawn_urdf" pkg="gazebo_ros" type="spawn_model" args="-urdf -model $(arg robot_name) -param $(arg robot_name)/robot_description" />
edit flag offensive delete link more


i want to spawn the same model more than once

dragobette gravatar imagedragobette ( 2020-11-27 07:59:51 -0600 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2020-11-27 01:12:05 -0600

Seen: 34 times

Last updated: Nov 30 '20