Launch Gazebo Sim paused from a parameter in ROS2 launch file
Hi There !
Could be an easy question, but I can't figure it out.
I would like to use a launch file main_launch.launch.py to launch a Gazebo Sim simulation in the state paused or playing according to a parameter sim_paused which I would like to be a parameter(launch argument) of the main_launch.launch.py file.
I understand from the gzros2control_demo repo that I can choose to launch the gzsim.launch.py from rosgz_sim package with or without -r argument. The '-r' arg meaning that the simulation will be running.
Example how to call the gz_sim.launch.py with '-r' :
# Launch gazebo environment
IncludeLaunchDescription(
PythonLaunchDescriptionSource(
[os.path.join(get_package_share_directory('ros_gz_sim'),
'launch', 'gz_sim.launch.py')]),
launch_arguments=[('gz_args', [' -r -v 4 empty.sdf'])]),
But then, how can I use the incomming launch argument sim_paused to activate or not '-r' in gz_sim.launch.py ?
# Launch configuration variables
sim_paused= LaunchConfiguration('sim_paused')
declare_sim_paused = DeclareLaunchArgument(
'sim_paused',
default_value='False',
description='Whether to start Gazebo paused')
Asked by Luczia on 2022-12-09 16:53:15 UTC
Comments