Skip to content

Commit

Permalink
Add initial positions file argument to launch file (#83)
Browse files Browse the repository at this point in the history
This allows setting the initial positions of the robot joints.
  • Loading branch information
urfeex authored Feb 4, 2025
1 parent b916bfb commit 1c13ce0
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions ur_simulation_gazebo/launch/ur_sim_control.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,10 @@ def launch_setup(context, *args, **kwargs):
# General arguments
runtime_config_package = LaunchConfiguration("runtime_config_package")
controllers_file = LaunchConfiguration("controllers_file")
initial_positions_file = LaunchConfiguration("initial_positions_file")
description_package = LaunchConfiguration("description_package")
description_file = LaunchConfiguration("description_file")
description_file = LaunchConfiguration("description_file")
prefix = LaunchConfiguration("prefix")
start_joint_controller = LaunchConfiguration("start_joint_controller")
initial_joint_controller = LaunchConfiguration("initial_joint_controller")
Expand All @@ -65,6 +67,10 @@ def launch_setup(context, *args, **kwargs):
[FindPackageShare(runtime_config_package), "config", controllers_file]
)

initial_positions_file_abs = PathJoinSubstitution(
[FindPackageShare(runtime_config_package), "config", initial_positions_file]
)

rviz_config_file = PathJoinSubstitution(
[FindPackageShare(description_package), "rviz", "view_robot.rviz"]
)
Expand Down Expand Up @@ -99,6 +105,9 @@ def launch_setup(context, *args, **kwargs):
" ",
"simulation_controllers:=",
initial_joint_controllers,
" ",
"initial_positions_file:=",
initial_positions_file_abs,
]
)
robot_description = {"robot_description": robot_description_content}
Expand Down Expand Up @@ -228,6 +237,19 @@ def generate_launch_description():
description="YAML file with the controllers configuration.",
)
)
declared_arguments.append(
DeclareLaunchArgument(
"initial_positions_file",
default_value=PathJoinSubstitution(
[
FindPackageShare("ur_description"),
"config",
"initial_positions.yaml",
]
),
description="YAML file (absolute path) with the robot's initial joint positions.",
)
)
declared_arguments.append(
DeclareLaunchArgument(
"description_package",
Expand Down

0 comments on commit 1c13ce0

Please sign in to comment.