Robotics StackExchange | Archived questions

Model spawning very slow

Hi,

I've created a World Plugin with some algorithms that generate models out of camera data automatically. The models are specified in SDF syntax. The model generation is handled by multiple threads and models with 30-70 joints and bodies can be created in ~150-300ms.

But spawning the created SDF model to the world by using one of the three methods of the World Plugin tutorial (http://gazebosim.org/tutorials?tut=plugins_world) is very slow. Often it takes 1-3 seconds until the entire model is completely visible and usable in the world.

From my understanding all three mentioned methods of the World Plugin tutorial use a client server connection, so this is probably the reasion for the slow spawning process. Is there a way to accelerate the spawning procedure? Or can SDF models be added to the world by using some other, faster method? Maybe one without a connection to some node?

Any help is highly appreciated, as a faster model generation would be really helpful for me!

Thank you very much, skm

Asked by skm on 2017-03-10 17:20:47 UTC

Comments

Answers

If you look into the gazebo::physics::World class, you'll see that the messages sent by InsertModelFile() or InsertModelSDF() are consumed by ProcessFactoryMsgs(). In particular, the function LoadModel is used for spawning the model into the scene. You can try calling directly this function in your code. You'll probably have to execute model->Init() and model->LoadPlugins() (if your model contains plugins) too.

Asked by Carlos Agüero on 2017-03-13 14:18:25 UTC

Comments

Thanks for the replay. But "LoadModel()" is a private method, so i can't call it. Besides that, the method does also use some "publish" methods internally (see source code), so the publish/subscriber technique might be the performance bottleneck indeed (when spawning complex models to the scene).

Asked by skm on 2017-03-14 11:15:37 UTC

True, I didn't realize is a private method. I cannot think of any other alternative way off the top of my head, but probably is worth to compile the code changing the class accessor from private to protected just to see if it makes any difference in terms of performance. I'd suggest to create an issue for it and if you could provide some profiling information and a reproducible use case would be even better.

Asked by Carlos Agüero on 2017-03-14 11:39:54 UTC

Ok I´ll compile Gazebo from Sources when I have time to do so. But I think it will not help, because LoadModel() calls some Publish() methods internally. The Publish/Subscriber system makes a lot of sense in the context of robotics, so I don't think opening an issue would be overall helpful. Its annoying that the spawning of complex models is so slow, but changing some basic fundamentals for that, I'm not sure...

Asked by skm on 2017-03-16 15:39:26 UTC