5 import launch_testing.actions
6 import launch_testing.asserts
8 from ament_index_python.packages
import get_package_share_directory
9 from launch_ros.actions
import Node, ComposableNodeContainer
10 from launch_ros.descriptions
import ComposableNode
11 from launch.actions
import ExecuteProcess, TimerAction
12 from launch.some_substitutions_type
import SomeSubstitutionsType
13 from launch.substitutions
import LaunchConfiguration, PathJoinSubstitution
14 from launch_param_builder
import ParameterBuilder
15 from moveit_configs_utils
import MoveItConfigsBuilder
21 .robot_description(file_path=
"config/panda.urdf.xacro")
27 "moveit_servo": ParameterBuilder(
"moveit_servo")
28 .yaml(
"config/pose_tracking_settings.yaml")
29 .yaml(
"config/panda_simulated_config_pose_tracking.yaml")
34 ros2_controllers_path = os.path.join(
37 "ros2_controllers.yaml",
39 ros2_control_node = Node(
40 package=
"controller_manager",
41 executable=
"ros2_control_node",
42 parameters=[moveit_config.robot_description, ros2_controllers_path],
46 joint_state_broadcaster_spawner = Node(
47 package=
"controller_manager",
50 "joint_state_broadcaster",
51 "--controller-manager-timeout",
53 "--controller-manager",
54 "/controller_manager",
58 panda_arm_controller_spawner = Node(
59 package=
"controller_manager",
61 arguments=[
"panda_arm_controller",
"-c",
"/controller_manager"],
65 test_container = ComposableNodeContainer(
66 name=
"test_pose_tracking_container",
68 package=
"rclcpp_components",
69 executable=
"component_container_mt",
70 composable_node_descriptions=[
72 package=
"robot_state_publisher",
73 plugin=
"robot_state_publisher::RobotStatePublisher",
74 name=
"robot_state_publisher",
75 parameters=[moveit_config.robot_description],
79 plugin=
"tf2_ros::StaticTransformBroadcasterNode",
80 name=
"static_tf2_broadcaster",
81 parameters=[{
"/child_frame_id":
"panda_link0",
"/frame_id":
"world"}],
87 pose_tracking_gtest = launch_ros.actions.Node(
88 executable=PathJoinSubstitution(
89 [LaunchConfiguration(
"test_binary_dir"), gtest_name]
92 moveit_config.to_dict(),
98 return launch.LaunchDescription(
100 launch.actions.DeclareLaunchArgument(
101 name=
"test_binary_dir",
102 description=
"Binary directory of package "
103 "containing test executables",
106 joint_state_broadcaster_spawner,
107 panda_arm_controller_spawner,
109 TimerAction(period=2.0, actions=[pose_tracking_gtest]),
110 launch_testing.actions.ReadyToTest(),
113 "test_container": test_container,
114 "servo_gtest": pose_tracking_gtest,
115 "ros2_control_node": ros2_control_node,
125 self.proc_info.assertWaitForShutdown(servo_gtest, timeout=4000.0)
128 @launch_testing.post_shutdown_test()
131 self, proc_info, test_container, servo_gtest, ros2_control_node
133 launch_testing.asserts.assertExitCodes(proc_info, process=servo_gtest)
def test_gtest_run_complete(self, servo_gtest)
def test_gtest_pass(self, proc_info, test_container, servo_gtest, ros2_control_node)
def get_package_share_directory(pkg_name)
def generate_servo_test_description(*args, SomeSubstitutionsType gtest_name)
def generate_test_description()