Gazebo | Ignition | Community
Ask Your Question
0

Model spawning very slow

asked 2017-03-10 16:20:47 -0500

skm gravatar image

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=pl...) 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

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2017-03-13 14:18:25 -0500

Carlos Agüero gravatar image

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.

edit flag offensive delete link more

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).

skm gravatar imageskm ( 2017-03-14 11:15:37 -0500 )edit

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.

Carlos Agüero gravatar imageCarlos Agüero ( 2017-03-14 11:39:54 -0500 )edit

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...

skm gravatar imageskm ( 2017-03-16 15:39:26 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2017-03-10 16:20:47 -0500

Seen: 1,123 times

Last updated: Mar 13 '17