Programmatically get name of the loaded world without a plugin?
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
Asked by SamG on 2021-01-12 13:36:31 UTC
Answers
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
Asked by ahcorde on 2021-02-15 03:28:42 UTC
Comments