Gazebo | Ignition | Community
Ask Your Question

Programmatically get name of the loaded world without a plugin?

asked 2021-01-12 12:36:31 -0500

SamG gravatar image

updated 2021-01-19 11:16:59 -0500

Is it possible to programmatically get the name of the world that gzserver has loaded without a plugin?

gz CLI doesn't seem to help, and gz topic assume you know the name of the world:

$:~/git/aws-robomaker-sample-application-helloworld/simulation_ws$ gz topic --list
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2021-02-15 02:28:42 -0500

ahcorde gravatar image

Hi SamG,

one idea it's to parse the output of gz topic -l. The world name is in the topic name:

  • /gazebo/<world name>/atmosphere

In your example:

  • /gazebo/generation_q87tgy8ltp26_world_12/atmosphere -> generation_q87tgy8ltp26_world_12
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2021-01-12 12:36:31 -0500

Seen: 49 times

Last updated: Feb 15 '21