Skip to content

Commit 1c13ce0

Browse files
authored
Add initial positions file argument to launch file (#83)
This allows setting the initial positions of the robot joints.
1 parent b916bfb commit 1c13ce0

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

ur_simulation_gazebo/launch/ur_sim_control.launch.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,10 @@ def launch_setup(context, *args, **kwargs):
5353
# General arguments
5454
runtime_config_package = LaunchConfiguration("runtime_config_package")
5555
controllers_file = LaunchConfiguration("controllers_file")
56+
initial_positions_file = LaunchConfiguration("initial_positions_file")
5657
description_package = LaunchConfiguration("description_package")
5758
description_file = LaunchConfiguration("description_file")
59+
description_file = LaunchConfiguration("description_file")
5860
prefix = LaunchConfiguration("prefix")
5961
start_joint_controller = LaunchConfiguration("start_joint_controller")
6062
initial_joint_controller = LaunchConfiguration("initial_joint_controller")
@@ -65,6 +67,10 @@ def launch_setup(context, *args, **kwargs):
6567
[FindPackageShare(runtime_config_package), "config", controllers_file]
6668
)
6769

70+
initial_positions_file_abs = PathJoinSubstitution(
71+
[FindPackageShare(runtime_config_package), "config", initial_positions_file]
72+
)
73+
6874
rviz_config_file = PathJoinSubstitution(
6975
[FindPackageShare(description_package), "rviz", "view_robot.rviz"]
7076
)
@@ -99,6 +105,9 @@ def launch_setup(context, *args, **kwargs):
99105
" ",
100106
"simulation_controllers:=",
101107
initial_joint_controllers,
108+
" ",
109+
"initial_positions_file:=",
110+
initial_positions_file_abs,
102111
]
103112
)
104113
robot_description = {"robot_description": robot_description_content}
@@ -228,6 +237,19 @@ def generate_launch_description():
228237
description="YAML file with the controllers configuration.",
229238
)
230239
)
240+
declared_arguments.append(
241+
DeclareLaunchArgument(
242+
"initial_positions_file",
243+
default_value=PathJoinSubstitution(
244+
[
245+
FindPackageShare("ur_description"),
246+
"config",
247+
"initial_positions.yaml",
248+
]
249+
),
250+
description="YAML file (absolute path) with the robot's initial joint positions.",
251+
)
252+
)
231253
declared_arguments.append(
232254
DeclareLaunchArgument(
233255
"description_package",

0 commit comments

Comments
 (0)