Skip to content

Commit cc4e3ba

Browse files
Felix Exner (fexner)VinDp
andauthored
Use absolute paths for configurable files (#160)
This allows re-using the launchfiles from this package in the context of other packages without having to replicate all the files loaded by this package's launchfiles. Co-authored-by: Vincenzo Di Pentima <[email protected]>
1 parent 671254b commit cc4e3ba

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

launch/view_ur.launch.py

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -66,20 +66,22 @@ def generate_launch_description():
6666
description="k-position factor in the safety controller.",
6767
)
6868
)
69-
# General arguments
7069
declared_arguments.append(
7170
DeclareLaunchArgument(
72-
"description_package",
73-
default_value="ur_description",
74-
description="Description package with robot URDF/XACRO files. Usually the argument "
75-
"is not set, it enables use of a custom description.",
71+
"description_file",
72+
default_value=PathJoinSubstitution(
73+
[FindPackageShare("ur_description"), "urdf", "ur.urdf.xacro"]
74+
),
75+
description="URDF/XACRO description file (absolute path) with the robot.",
7676
)
7777
)
7878
declared_arguments.append(
7979
DeclareLaunchArgument(
80-
"description_file",
81-
default_value="ur.urdf.xacro",
82-
description="URDF/XACRO description file with the robot.",
80+
"rviz_config_file",
81+
default_value=PathJoinSubstitution(
82+
[FindPackageShare("ur_description"), "rviz", "view_robot.rviz"]
83+
),
84+
description="RViz config file (absolute path) to use when launching rviz.",
8385
)
8486
)
8587
declared_arguments.append(
@@ -97,16 +99,15 @@ def generate_launch_description():
9799
safety_limits = LaunchConfiguration("safety_limits")
98100
safety_pos_margin = LaunchConfiguration("safety_pos_margin")
99101
safety_k_position = LaunchConfiguration("safety_k_position")
100-
# General arguments
101-
description_package = LaunchConfiguration("description_package")
102102
description_file = LaunchConfiguration("description_file")
103103
tf_prefix = LaunchConfiguration("tf_prefix")
104+
rviz_config_file = LaunchConfiguration("rviz_config_file")
104105

105106
robot_description_content = Command(
106107
[
107108
PathJoinSubstitution([FindExecutable(name="xacro")]),
108109
" ",
109-
PathJoinSubstitution([FindPackageShare(description_package), "urdf", description_file]),
110+
description_file,
110111
" ",
111112
"safety_limits:=",
112113
safety_limits,
@@ -129,10 +130,6 @@ def generate_launch_description():
129130
)
130131
robot_description = {"robot_description": robot_description_content}
131132

132-
rviz_config_file = PathJoinSubstitution(
133-
[FindPackageShare(description_package), "rviz", "view_robot.rviz"]
134-
)
135-
136133
joint_state_publisher_node = Node(
137134
package="joint_state_publisher_gui",
138135
executable="joint_state_publisher_gui",

0 commit comments

Comments
 (0)