Open lguyot opened 9 years ago
Is anyone working on this issue? Creation of this new service in gazebo _/gazebo/spawn_sdflight would be very helpful to spawn a light and to distinguish from existing services (spawn_urdf_model, spawn_sdf_model, spawn_gazebo_model) which serve different purposes
Can you give me an example of a current service call you use to do this so I can look into it?
Actually looks like this was added in #511. It should no longer have this issue in kinetic and later.
Spawning a light by means of the service /gazebo/spawn_sdf_model takes always 10 seconds.
The reason is the following: GazeboRosApiPlugin::spawnSDFModel calls in turn GazeboRosApiPlugin::spawnAndConform which makes the following verification:
Since world_->GetModel(model_name) is always false for a light (unless some model bears the same name as the light!), we exit the while loop only after timeout, i.e. 10 seconds after entering it.
The fix would be something like this (close to what is already done in gazebo/test/ServerFixture.cc):
The isLight variable above would be an extra argument of the GazeboRosApiPlugin::spawnAndConform method indicating that a light should be spawned. With the above snippet, we assume that a new service, say /gazebo/spawn_sdf_light, is created and it triggers a new method, say GazeboRosApiPlugin::spawnSDFLight which in turn calls GazeboRosApiPlugin::spawnAndConform with its new argument or a custom method that checks light spawning properly.