diff --git a/rbs_simulation/launch/simulation.launch.py b/rbs_simulation/launch/simulation.launch.py index 8671a07..37423fb 100644 --- a/rbs_simulation/launch/simulation.launch.py +++ b/rbs_simulation/launch/simulation.launch.py @@ -4,7 +4,7 @@ from launch import LaunchDescription from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription from launch_ros.substitutions import FindPackageShare from launch.substitutions import Command, FindExecutable, LaunchConfiguration, PathJoinSubstitution -from launch.conditions import IfCondition +from launch.conditions import IfCondition, UnlessCondition from launch.launch_description_sources import PythonLaunchDescriptionSource from ament_index_python.packages import get_package_share_directory @@ -25,22 +25,34 @@ def generate_launch_description(): declared_arguments.append( DeclareLaunchArgument("env_manager", default_value="false", description="Launch env_manager?") ) + declared_arguments.append( + DeclareLaunchArgument("gazebo_gui", default_value="false", description="Launch env_manager?") + ) sim_gazebo = LaunchConfiguration("sim_gazebo") rbs_robot_type = LaunchConfiguration("rbs_robot_type") env_manager_cond = LaunchConfiguration("env_manager") - + gazebo_gui = LaunchConfiguration("gazebo_gui") # FIXME: To args when we'll have different files world_config_file = PathJoinSubstitution( [FindPackageShare("rbs_simulation"), "worlds", "mir.sdf"] ) # Gazebo nodes + + gazebo_server = IncludeLaunchDescription( + PythonLaunchDescriptionSource( + [os.path.join(get_package_share_directory('ros_gz_sim'), + 'launch', 'gz_sim.launch.py')]), + launch_arguments=[('ign_args', [' -r ',world_config_file, " -s"])], + condition=UnlessCondition(gazebo_gui)) + gazebo = IncludeLaunchDescription( PythonLaunchDescriptionSource( - [os.path.join(get_package_share_directory('ros_ign_gazebo'), - 'launch', 'ign_gazebo.launch.py')]), - launch_arguments=[('ign_args', [' -r ',world_config_file, " --physics-engine ignition-physics-dartsim-plugin --render-engine ogre2"])], - condition=IfCondition(sim_gazebo)) + [os.path.join(get_package_share_directory('ros_gz_sim'), + 'launch', 'gz_sim.launch.py')]), + launch_arguments=[('ign_args', [' -r ',world_config_file])], + condition=IfCondition(gazebo_gui)) + # Spawn robot gazebo_spawn_robot = Node(package='ros_ign_gazebo', executable='create', arguments=[ @@ -59,6 +71,7 @@ def generate_launch_description(): nodes_to_start = [ gazebo, + gazebo_server, gazebo_spawn_robot, env_manager ]