Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix slow loading of spawned model with plugins #3126

Merged
merged 8 commits into from
Oct 25, 2021

Conversation

scpeters
Copy link
Member

As reported in #3125, since #3121 was recently merged I have noticed a problem with some models that are slow to load. Specifically, if a model is spawned that contains a sensor plugin that is slow to load, it is possible that model plugins will fail to load, with the following error message:

[Err] [Model.cc:1061] Sensors failed to initialize when loading model[...] via the factory mechanism. Plugins for the model will not be loaded.

I believe this is caused by this logic in Model::LoadPlugins that skips loading of model plugins if the sensors take longer than 5 seconds to initialize, which includes the time required to load sensor plugins. I have increased this timeout to 50 seconds in 2589d13, though I am open to suggestions for how to make this a configurable parameter.

I have added a regression test that loads a world file along with two test plugins to reproduce the failure. The world has a WorldSpawnModelPlugin that spawns a model that has a single box with a camera sensor using the SlowLoadingSensorPlugin and the InitialVelocityPlugin as a model plugin. The box should be given an initial velocity after loading.

Since gazebosim#3121 was merged, some problems have been observed
with loading model plugins if a model contains sensor
plugins that are slow to load. This introduces two
test plugins and a test world to demonstrate the problem.

Signed-off-by: Steve Peters <scpeters@openrobotics.org>
Signed-off-by: Steve Peters <scpeters@openrobotics.org>
Increase the timeout from 5 seconds to 50 seconds.

Signed-off-by: Steve Peters <scpeters@openrobotics.org>
Signed-off-by: Steve Peters <scpeters@openrobotics.org>
Signed-off-by: Steve Peters <scpeters@openrobotics.org>
Signed-off-by: Steve Peters <scpeters@openrobotics.org>
@scpeters scpeters requested a review from iche033 October 22, 2021 02:30
@scpeters scpeters changed the title Slow loading model spawn Fix slow loading of spawned model with plugins Oct 22, 2021
@scpeters
Copy link
Member Author

I am open to suggestions for how to make this a configurable parameter.

I suppose we could add an SDFormat world parameter?

Rather than increase the timeout to a larger fixed value,
this adds an SDFormat parameter to the world element
in the ignition xml namespace. It restores the default
timeout of 5 seconds and sets a timeout of 30 seconds
in the test world.

Signed-off-by: Steve Peters <scpeters@openrobotics.org>
@scpeters
Copy link
Member Author

I am open to suggestions for how to make this a configurable parameter.

I've added an SDFormat parameter in the ignition xml namespace in 35fb921 and restored the default timeout to 5 seconds

Copy link

@jacobperron jacobperron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes LGTM.

I would consider increasing the default timeout if you think users are more likely to run into the issue after updating Gazebo.

Signed-off-by: Steve Peters <scpeters@openrobotics.org>
@scpeters scpeters merged commit d60cef0 into gazebosim:gazebo11 Oct 25, 2021
@scpeters scpeters deleted the slow_loading_model_spawn branch October 25, 2021 22:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants