I am using world plugin as model spawner with this code snippet
for(auto object:objects){
ROS_INFO("Spawn %s", object.name.c_str());
msg.set_sdf_filename("model://"+object.name);
msgs::Set(
msg.mutable_pose(),
ignition::math::Pose3d(
ignition::math::Vector3d(object.point.x, object.point.y, 0),
ignition::math::Quaterniond(0, 0, object.yaw)
)
);
factoryPub->Publish(msg);
}
The trouble is when I try to spawn multiple models by cloning same sdf file, Gazebo only spawn one object per one SDF model even there are multiple `object` element with same SDF model but different coordinate inside `objects` vector such as
for(int i = 0; i < 4; ++i){
objects.push_back(
object_t(
"furniture", i, i, 0.0
)
);
}
Is there any way to spawn multiple clone with c++? Msg factory method is preferrable
↧