Gazebo | Ignition | Community
Ask Your Question

Access to a world from GUI system plugin for gzclient

asked 2013-05-13 07:35:58 -0600

Boris gravatar image

I have a GUI system plugin that is loaded by gzclient in the following manner:

gzclient -g

After gzclient starts I can see my world with simulation running. However I am unable to get access to that world from the plugin - physics::get_world() generates exception:

Error [] Unable to find world by name in physics::get_world[default]

Here how it is invoked:

void Init() {
  this->world_name_ = gui::get_world(); // returns "default"
  this->world_ = physics::get_world(this->world_name_);

physics::get_world() without arguments gives error "no worlds".

Any thoughts?

P.S. I actually just need to get simulation time (world_->GetSimTime()), so maybe there is another way?


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-05-13 23:36:54 -0600

scpeters gravatar image

Physics is done in the server, so the client has to subscribe to a published topic to get information about worlds and entities. You can use anything you see in gztopic list. The ~/world/stats topic may be useful to you, though it is only published at 5 Hz. You could write a world plugin on the server side to publish time more frequently so that you could get it in a system plugin from the client.

edit flag offensive delete link more


Great! Thanks!

Boris gravatar imageBoris ( 2013-05-14 05:38:14 -0600 )edit
Login/Signup to Answer

Question Tools


Asked: 2013-05-13 07:35:58 -0600

Seen: 7,597 times

Last updated: May 13 '13