Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions robotnik_gazebo_ignition/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ ros2 launch robotnik_gazebo_ignition spawn_world.launch.py world:=empty

Available worlds are located in the `worlds` folder of this package. You can replace `empty` with the name of any other world file (without the `.world` extension) to launch a different world.

Also, you can enable or disable the Gazebo GUI by setting the `gui:=true` or `gui:=false` parameter. By default, the GUI is enabled.

## Spawn Robot

Use the launch file to insert a robot into the Gazebo (Ignition) world.
Expand Down
16 changes: 13 additions & 3 deletions robotnik_gazebo_ignition/launch/spawn_world.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@
import os
from launch import LaunchDescription
from launch.actions import GroupAction, IncludeLaunchDescription
from launch.substitutions import LaunchConfiguration, Command, FindExecutable
from launch_ros.actions import Node, PushRosNamespace
from launch.substitutions import LaunchConfiguration
from launch_ros.actions import Node
from launch_ros.substitutions import FindPackageShare
from launch_ros.descriptions import ParameterValue
from launch.conditions import IfCondition
from launch.substitutions import PythonExpression
from robotnik_common.launch import ExtendedArgument, AddArgumentParser
from launch.launch_description_sources import PythonLaunchDescriptionSource

Expand All @@ -55,6 +56,13 @@ def generate_launch_description():
)
add_to_launcher.add_arg(arg)

arg = ExtendedArgument(
name='gui',
description='Set to true to enable gazebo gui, headless mode (default: true)',
default_value='true',
)
add_to_launcher.add_arg(arg)

params = add_to_launcher.process_arg()

gazebo_ignition_launch_group = GroupAction(
Expand Down Expand Up @@ -96,6 +104,8 @@ def generate_launch_description():
],
'on_exit_shutdown':'true'
}.items(),
# gui is in (true, 1, yes, on) (case insensitive)
condition = IfCondition(PythonExpression(["'", params['gui'], "'.strip().lower() in ('true','1','yes','on')"])),
),
Node(
package="ros_gz_bridge",
Expand Down