5 from launch
import LaunchDescription
6 from launch.some_substitutions_type
import SomeSubstitutionsType
7 from launch.substitutions
import LaunchConfiguration, PathJoinSubstitution
8 from launch_ros.actions
import ComposableNodeContainer, Node
9 from launch_ros.descriptions
import ComposableNode
10 from ament_index_python.packages
import get_package_share_directory
11 from launch.actions
import ExecuteProcess, TimerAction
12 from moveit_configs_utils
import MoveItConfigsBuilder
13 from launch_param_builder
import ParameterBuilder
18 gtest_name: SomeSubstitutionsType,
19 start_position_path: SomeSubstitutionsType =
""
24 "moveit_servo": ParameterBuilder(
"moveit_servo")
25 .yaml(
"config/panda_simulated_config.yaml")
30 if start_position_path:
31 initial_positions_file = os.path.join(
32 os.path.dirname(__file__), start_position_path
34 robot_description_mappings = {
"initial_positions_file": initial_positions_file}
36 robot_description_mappings =
None
41 file_path=
"config/panda.urdf.xacro", mappings=robot_description_mappings
47 ros2_controllers_path = os.path.join(
50 "ros2_controllers.yaml",
52 ros2_control_node = Node(
53 package=
"controller_manager",
54 executable=
"ros2_control_node",
55 parameters=[moveit_config.robot_description, ros2_controllers_path],
59 joint_state_broadcaster_spawner = Node(
60 package=
"controller_manager",
63 "joint_state_broadcaster",
64 "--controller-manager-timeout",
66 "--controller-manager",
67 "/controller_manager",
71 panda_arm_controller_spawner = Node(
72 package=
"controller_manager",
74 arguments=[
"panda_arm_controller",
"-c",
"/controller_manager"],
78 test_container = ComposableNodeContainer(
79 name=
"test_servo_integration_container",
81 package=
"rclcpp_components",
82 executable=
"component_container_mt",
83 composable_node_descriptions=[
85 package=
"robot_state_publisher",
86 plugin=
"robot_state_publisher::RobotStatePublisher",
87 name=
"robot_state_publisher",
88 parameters=[moveit_config.robot_description],
92 plugin=
"tf2_ros::StaticTransformBroadcasterNode",
93 name=
"static_tf2_broadcaster",
94 parameters=[{
"/child_frame_id":
"panda_link0",
"/frame_id":
"world"}],
101 package=
"moveit_servo",
102 executable=
"servo_node_main",
106 moveit_config.robot_description,
107 moveit_config.robot_description_semantic,
108 moveit_config.joint_limits,
109 moveit_config.robot_description_kinematics,
137 servo_gtest = launch_ros.actions.Node(
138 executable=PathJoinSubstitution(
139 [LaunchConfiguration(
"test_binary_dir"), gtest_name]
141 parameters=[servo_params],
145 return launch.LaunchDescription(
147 launch.actions.DeclareLaunchArgument(
148 name=
"test_binary_dir",
149 description=
"Binary directory of package "
150 "containing test executables",
153 joint_state_broadcaster_spawner,
154 panda_arm_controller_spawner,
157 TimerAction(period=2.0, actions=[servo_gtest]),
158 launch_testing.actions.ReadyToTest(),
161 "servo_node": servo_node,
162 "test_container": test_container,
163 "servo_gtest": servo_gtest,
164 "ros2_control_node": ros2_control_node,
def get_package_share_directory(pkg_name)
def generate_servo_test_description(*args, SomeSubstitutionsType gtest_name, SomeSubstitutionsType start_position_path="")