Skip to content

Commit

Permalink
Move RViz arg
Browse files Browse the repository at this point in the history
  • Loading branch information
rafal-gorecki committed Nov 7, 2024
1 parent b9420f5 commit a2a9ee9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
11 changes: 11 additions & 0 deletions husarion_ugv_gazebo/launch/simulation.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription
from launch.conditions import IfCondition
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch.substitutions import (
EnvironmentVariable,
Expand Down Expand Up @@ -45,6 +46,14 @@ def generate_launch_description():
description="Add namespace to all launched nodes.",
)

use_rviz = LaunchConfiguration("use_rviz")
declare_use_rviz_arg = DeclareLaunchArgument(
"use_rviz",
default_value="True",
description="Run RViz simultaneously.",
choices=["True", "true", "False", "false"],
)

namespaced_gz_gui = ReplaceString(
source_file=gz_gui,
replacements={"{namespace}": namespace},
Expand All @@ -69,6 +78,7 @@ def generate_launch_description():
]
)
),
condition=IfCondition(use_rviz),
)

simulate_robots = IncludeLaunchDescription(
Expand All @@ -86,6 +96,7 @@ def generate_launch_description():
actions = [
declare_gz_gui,
declare_namespace_arg,
declare_use_rviz_arg,
# Sets use_sim_time for all nodes started below (doesn't work for nodes started from ignition gazebo)
SetUseSimTime(True),
gz_sim,
Expand Down
11 changes: 0 additions & 11 deletions panther_description/launch/rviz.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
from launch.conditions import IfCondition
from launch.substitutions import (
EnvironmentVariable,
LaunchConfiguration,
Expand Down Expand Up @@ -47,14 +46,6 @@ def generate_launch_description():
description="RViz configuration file.",
)

use_rviz = LaunchConfiguration("use_rviz")
declare_use_rviz_arg = DeclareLaunchArgument(
"use_rviz",
default_value="True",
description="Run RViz simultaneously.",
choices=["True", "true", "False", "false"],
)

use_sim = LaunchConfiguration("use_sim")
declare_use_sim_arg = DeclareLaunchArgument(
"use_sim",
Expand All @@ -75,13 +66,11 @@ def generate_launch_description():
executable="rviz2",
namespace=namespace,
arguments=["-d", rviz_config],
condition=IfCondition(use_rviz),
)

actions = [
declare_namespace_arg,
declare_rviz_config_arg,
declare_use_rviz_arg,
declare_use_sim_arg,
SetParameter(name="use_sim_time", value=use_sim),
rviz_node,
Expand Down

0 comments on commit a2a9ee9

Please sign in to comment.