Robotics StackExchange | Archived questions

How to administrate (spawning and deleting) models synchronously and deterministically for testrun automation?

Hi,

i've got some questions regarding the simulation loop inside of Gazebo:

I think it might get clearer, if i outline and detail our application and sketch it in the context of question (Q1) and (Q2):

We are using Gazebo as a co-simulation master for controlling two connected simulations and combining the specific agents in one, common environment model for a co-simulation plattform: Two dedicated plugins, both of type WorldPlugin, establish their connection to a microscopic vehicle and a pedestrian crowd simulation. Both plugins build up the connection in their specific Load() function, receive the number of expected vehicles and pedestrians from both simulations and then requests Gazebo to instantiate the number of necessary models via InsertModelAsSDF() on the world ptrs of the plugins. Since the Load() function shall be non-blocking, a OnUpdate() function, which has been previously connected to the OnWorldUpdateBegin() event of the simulation loop, then checks at the very beginning if the available amount of models corresponds to the number of recently requested models. If so, the plugins and the simulation models are synchronized. This approach has two big disadvantages:

Also, we have a similar issue, when we want to use the gazebo transport system with publisher and subscriber before the simulation shall start with it's first step, such as .g. for the exchange of information, which is static over the runtime of a concrete Scenario and only needs to be exchanged once. It looks like that the publisher/subscriber principle of the plugins are inappropriate being used before the initial simulation step.

My third question (Q3) is also related to the issue mentioned above, that in order to reset a plugin, which administrates a set of models, it also needs to handle the instantiation and deletion of events very carefully in order to avoid race conditions: Such as removing a model in Reset(), while the OnUpdate() tries to move the model itself in the meantime.

Are there any experiences on such application of Gazebo?

With best regards and thanks in advance!

Asked by Illuminatur on 2018-12-09 18:58:16 UTC

Comments

Answers

  1. Your first question is difficult to understand. Are you looking for a function to block simulation update at a particular time? Are you experiencing a situation where gazebo hangs? Are you trying to block simulation based on an event?

  2. One approach is to send out a "birth" message on your own topic. You can also monitor the /pose/info topic, which will contain pose info on your model after the model is spawned.

  3. Since I can reproduce your test scenario the best answer I can give is maybe. What have you tried, where did it fail, and what steps can I follow to reproduce your problem?

  4. After construction of an entity, you should call Load to configure the entity. Init should follow Load. You will likely get unexpected results if you call Reset followed by Init. While there was intention to eventually support this use-case, we have never implemented the Init --> Reset --> Init pattern.

Asked by nkoenig on 2018-12-11 17:42:54 UTC

Comments

Hi, i just added my explanations to the original post. Are there any ideas how we could solve our issue?

Asked by Illuminatur on 2018-12-12 14:34:00 UTC

Hi,

since some time has passed, i wanted to ask, if there are some new insights?

Any help is really appreciated.

Regards and thanks a lot.

Asked by Illuminatur on 2019-01-29 23:37:09 UTC

Comments