|
7 | 7 | import launch_pytest |
8 | 8 | import launch_testing |
9 | 9 | from launch_pytest.tools import process as process_tools |
| 10 | +from launch_ros.actions import Node |
10 | 11 |
|
11 | 12 | import pytest |
12 | 13 | from artefacts_toolkit.chart import make_chart |
@@ -36,20 +37,6 @@ def rosbag_data(): |
36 | 37 | + ["-o", rosbag_filepath, "--storage", "mcap"] |
37 | 38 | ) |
38 | 39 |
|
39 | | - test_talker_node_cmd = [ |
40 | | - "ros2", |
41 | | - "topic", |
42 | | - "pub", |
43 | | - "-r", |
44 | | - "1", |
45 | | - "--once", |
46 | | - "--wait-matching-subscriptions", |
47 | | - "0", |
48 | | - "/test_talker", |
49 | | - "std_msgs/msg/String", |
50 | | - "--", |
51 | | - "\"{data: 'Recording...'}\"", |
52 | | - ] |
53 | 40 | print(f"Recording to {rosbag_filepath} with command: {' '.join(rosbag_cmd)}") |
54 | 41 | return launch.actions.ExecuteProcess( |
55 | 42 | name="rosbag2", |
@@ -117,16 +104,32 @@ def odometry_node(): |
117 | 104 | ) |
118 | 105 |
|
119 | 106 |
|
| 107 | +@pytest.fixture(scope="module") |
| 108 | +def gz_bridge_node(): |
| 109 | + """Bridge extra gazebo topics to ros2.""" |
| 110 | + return Node( |
| 111 | + package="ros_gz_bridge", |
| 112 | + executable="parameter_bridge", |
| 113 | + arguments=[ |
| 114 | + "/sky_cam@sensor_msgs/msg/Image@ignition.msgs.Image", |
| 115 | + ], |
| 116 | + output="screen", |
| 117 | + ) |
| 118 | + |
| 119 | + |
120 | 120 | # This function specifies the processes to be run for our test. |
121 | 121 | @launch_pytest.fixture( |
122 | 122 | scope="module" |
123 | 123 | ) # Set the scope so the processes are not killed after each test |
124 | | -def launch_description(navigation_stack, rosbag_recording, odometry_node): |
| 124 | +def launch_description( |
| 125 | + navigation_stack, rosbag_recording, odometry_node, gz_bridge_node |
| 126 | +): |
125 | 127 | return launch.LaunchDescription( |
126 | 128 | [ |
127 | 129 | navigation_stack, |
128 | 130 | rosbag_recording["bag_recorder"], |
129 | 131 | odometry_node, |
| 132 | + gz_bridge_node, |
130 | 133 | # Tell launch when to start the test |
131 | 134 | # If no ReadyToTest action is added, one will be appended automatically. |
132 | 135 | launch_pytest.actions.ReadyToTest(), |
|
0 commit comments