moveit2
The MoveIt Motion Planning Framework for ROS 2.
Loading...
Searching...
No Matches
test_rdf_integration.test.py
Go to the documentation of this file.
1from ament_index_python.packages import get_package_share_path
2from launch import LaunchDescription
3
4from launch_ros.actions import Node
5
6import launch_testing
7
8import unittest
9
10
12 rdf_path = get_package_share_path("moveit_ros_planning") / "rdf_loader"
13 test_data_path = rdf_path / "test" / "data"
14
15 kermit_urdf = open(test_data_path / "kermit.urdf").read()
16 kermit_srdf = open(test_data_path / "kermit.srdf").read()
17
18 boring_urdf_node = Node(
19 package="moveit_ros_planning",
20 executable="boring_string_publisher",
21 name="urdf_pub0",
22 parameters=[
23 {
24 "topic": "topic_description",
25 "content_path": str(test_data_path / "gonzo.urdf"),
26 }
27 ],
28 )
29 boring_srdf_node = Node(
30 package="moveit_ros_planning",
31 executable="boring_string_publisher",
32 name="srdf_pub0",
33 parameters=[
34 {
35 "topic": "topic_description_semantic",
36 "content_path": str(test_data_path / "gonzo.srdf"),
37 }
38 ],
39 )
40
41 integration_node = Node(
42 package="moveit_ros_planning",
43 executable="test_rdf_integration",
44 parameters=[
45 {
46 "robot_description": kermit_urdf,
47 "robot_description_semantic": kermit_srdf,
48 # The following timeouts are not strictly needed, but make the test run quicker
49 "DNE_timeout": 1.0,
50 "DNE_semantic_timeout": 1.0,
51 }
52 ],
53 )
54
55 return (
56 LaunchDescription(
57 [
58 integration_node,
59 boring_urdf_node,
60 boring_srdf_node,
61 launch_testing.actions.ReadyToTest(),
62 ]
63 ),
64 {"integration_node": integration_node},
65 )
66
67
68class TestGTestWaitForCompletion(unittest.TestCase):
69 # Waits for test to complete, then waits a bit to make sure result files are generated
70 def test_gtest_run_complete(self, proc_info, integration_node):
71 proc_info.assertWaitForShutdown(integration_node, timeout=4000.0)
72
73
74@launch_testing.post_shutdown_test()
75class TestGTestProcessPostShutdown(unittest.TestCase):
76 # Checks if the test has been completed with acceptable exit codes (successful codes)
77 def test_gtest_pass(self, proc_info, integration_node):
78 launch_testing.asserts.assertExitCodes(proc_info, process=integration_node)
test_gtest_run_complete(self, proc_info, integration_node)