Gazebo | Ignition | Community
Ask Your Question
0

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
/gazebo/default/undo_redo
/gazebo/default/user_cmd_stats
/gazebo/generation_q87tgy8ltp26_world_12/atmosphere
/gazebo/generation_q87tgy8ltp26_world_12/diagnostics
<snip>
/gazebo/generation_q87tgy8ltp26_world_12/wind
/gazebo/generation_q87tgy8ltp26_world_12/world_control
/gazebo/generation_q87tgy8ltp26_world_12/world_stats
/gazebo/server/control
/gazebo/world/modify
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

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

Stats

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

Seen: 31 times

Last updated: Feb 15