Gazebo | Ignition | Community
Ask Your Question

How to spawn multiple clone of model using msg::Factory?

asked 2018-11-13 07:12:13 -0500

AchmadFathoni gravatar image

updated 2018-11-13 10:33:07 -0500

I am using model spawner according this world plugin tutorial with option number three using msg::factory

  transport::NodePtr node(new transport::Node());
  transport::PublisherPtr factoryPub =
  msgs::Factory msg;


        ignition::math::Vector3d(1, -2, 0),
        ignition::math::Quaterniond(0, 0, 0)));


I use this option because it let me set the spawn position. My problem is I do not know how to spawn another clone with same SDF model file using this method, I tried call factoryPub->Publish(msg) again but it seem gazebo only spawn a model per SDF model file.

edit retag flag offensive close merge delete


Can you include the version of Gazebo you are using?

nkoenig gravatar imagenkoenig ( 2018-11-13 09:32:21 -0500 )edit

@nkoenig, already in the tag

AchmadFathoni gravatar imageAchmadFathoni ( 2018-11-13 10:33:09 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2018-11-14 09:18:55 -0500

nkoenig gravatar image

I think you'll need to change the name of the model. Or, you can upgrade to gazebo8 or gazebo9. Since gazebo8 the factory.proto has been modified to automatically rename models. Since you are on gazebo7, you'll have to modify the model name before sending the message.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2018-11-13 07:12:13 -0500

Seen: 577 times

Last updated: Nov 14 '18