Gazebo | Ignition | Community
Ask Your Question
0

Access to a world from GUI system plugin for gzclient

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

Boris gravatar image

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

gzclient -g libgazebo_plugin.so

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 [Physics.cc:71] 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?

Thanks

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

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

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

Comments

Great! Thanks!

Boris gravatar imageBoris ( 2013-05-14 05:38:14 -0500 )edit

Question Tools

Stats

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

Seen: 7,666 times

Last updated: May 13 '13