Figuring out installed ignition gazebo version inside launch file

asked 2022-11-04 05:44:26 -0500

ijnek gravatar image

updated 2022-11-04 05:44:40 -0500

I'm looking to support multiple ignition gazebo versions on a single branch, and I'd like to figure out which ignition gazebo version (ie. 'edifice', 'fortress', 'garden') is installed, to choose the appropriate gui configuration file as my configuration file is not compatible across multiple gazebo versions.

Is there a nice way to do something like the following from a ROS 2 python launch file?

if gz_version == 'edifice':
    config = 'gui-edifice.config'
else:
    config = 'gui-fortress.config'

gui_config_arg = DeclareLaunchArgument(
    name='gui_config',
    description='Path to the GUI config file to open.',
    default_value=PathJoinSubstitution(
        [FindPackageShare('my_robot'), 'configs', config]))
edit retag flag offensive close merge delete