Skip to content

Commit

Permalink
Replace IfElseSubstitution with IfCondition UnlessCondition (#44)
Browse files Browse the repository at this point in the history
This fixes a regression introduced in 858a542
  • Loading branch information
irisxu02 authored Jul 8, 2024
1 parent 858a542 commit 01ccb2f
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions ur_simulation_gz/launch/ur_sim_control.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
FindExecutable,
LaunchConfiguration,
PathJoinSubstitution,
IfElseSubstitution,
)
from launch_ros.actions import Node
from launch_ros.substitutions import FindPackageShare
Expand Down Expand Up @@ -168,18 +167,24 @@ def launch_setup(context, *args, **kwargs):
"true",
],
)
gz_launch_description_with_gui = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
[FindPackageShare("ros_gz_sim"), "/launch/gz_sim.launch.py"]
),
launch_arguments={
"gz_args": ["-r", "-v", "4", world_file]
}.items(),
condition=IfCondition(gazebo_gui)
)

gz_launch_description = IncludeLaunchDescription(
gz_launch_description_without_gui = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
[FindPackageShare("ros_gz_sim"), "/launch/gz_sim.launch.py"]
),
launch_arguments={
"gz_args": IfElseSubstitution(
gazebo_gui,
if_value=[" -r -v 4 ", world_file],
else_value=[" -s -r -v 4 ", world_file],
)
"gz_args": ["-s", "-r", "-v", "4", world_file]
}.items(),
condition=UnlessCondition(gazebo_gui)
)

nodes_to_start = [
Expand All @@ -189,7 +194,8 @@ def launch_setup(context, *args, **kwargs):
initial_joint_controller_spawner_stopped,
initial_joint_controller_spawner_started,
gz_spawn_entity,
gz_launch_description,
gz_launch_description_with_gui,
gz_launch_description_without_gui,
]

return nodes_to_start
Expand Down

0 comments on commit 01ccb2f

Please sign in to comment.