0
$\begingroup$

Gazebo Answers logo

Hi all,

I'm implementing my own simulator using Gazebo, Ignition and ROS. Using gzserver, a world file and my models, im able to get everything rendered correctly by gzserver and control everything. Now, i implemented the visualization in my simulator, in Qt, although it has low fps, but that's still a problem to be solved. Now, i want to control all the aspects of the world that is being simulated by gzserver.

Looking at Gazebo's API i noticed the classes World and Model under gazebo::physics, that allow me to control and have access to all of the data from the simulation that i need, and, so far so good. I just don't get how to have access do the world (get the matching WorldPtr) that is being simulated by gzserver, to be able to use all the funcionalities provided by World class.

The documentation doesn't helped me either, as it is poorly documented and no examples are given ...

Thanks in advance !

Pedro Silva


Originally posted by wicked88 on Gazebo Answers with karma: 38 on 2016-08-14

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Gazebo Answers logo

I don't think there is a (trivial?) way to directly access WorldPtr from another process. Gazebo for example, runs two processes: gzserver, which holds the WorldPtr, and gzclient, which has no direct access to it. Instead, gzclient talks to gzserver via the transport layer.

If the current transport layer is not exposing enough for your use case, you could create a world plugin, or system plugin, which exposes the functionality you need for the GUI.

Let's say for example that you need CoM information for all models in the world. Your world plugin could publish that information on a new topic, and your GUI listens to it and displays the information accordingly.

That sounds like an awesome project, by the way :)


Originally posted by chapulina with karma: 7504 on 2016-08-15

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by wicked88 on 2016-08-16:
Hi again ! The World class offers so much, is almost impossible to miss it. I managed to think of a cheat for this, don't know if it is really retarded or not, but ... I thought of "why not publishing the world memory address (content of the WorldPtr) through a topic". I then read the topic, make a WorldPtr or a World * object, cast the address and voilá ! Haven't tried, need an opinion, from 1 to 10, how retarded is this.

Comment by wicked88 on 2016-08-16:
Also, i managed to control the simulation (pause, unpause, reset models, reset all, get times and so on ... ) using the transport layer as you suggested. Now, this cheat that i referred, might allow me to have a "God" like control over the simulation and the models, much easier to work than with the transport layer.

Comment by chapulina on 2016-08-18:
Gazebo wasn't designed to work like this, so there might be many risks involved. But it sounds like an interesting experiment :)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.