Skip to content

Commit 4a509af

Browse files
committed
ci: update 3d reconstruction test timing and QoS
1 parent ee49b81 commit 4a509af

1 file changed

Lines changed: 25 additions & 9 deletions

File tree

test/test_3d_reconstruction.py

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def setUpClass(cls):
5151
cls.node = rclpy.create_node("test_node")
5252

5353
# wait for topics to be setup
54-
time.sleep(30)
54+
time.sleep(10)
5555

5656
@classmethod
5757
def tearDownClass(cls):
@@ -68,6 +68,14 @@ def tearDownClass(cls):
6868
def test_camera_topics(self, proc_output):
6969
"""Test that camera topics are publishing msgs."""
7070

71+
# Set appropriate QoS for sensor data
72+
sensor_qos = rclpy.qos.QoSProfile(
73+
reliability=rclpy.qos.ReliabilityPolicy.BEST_EFFORT,
74+
durability=rclpy.qos.DurabilityPolicy.VOLATILE,
75+
history=rclpy.qos.HistoryPolicy.KEEP_LAST,
76+
depth=10,
77+
)
78+
7179
msgs_left = []
7280
msgs_right = []
7381

@@ -76,18 +84,18 @@ def test_camera_topics(self, proc_output):
7684
CameraInfo,
7785
"/cam_turtlebot_left/camera_info",
7886
lambda msg: msgs_left.append(msg),
79-
10,
87+
qos_profile=sensor_qos,
8088
)
8189

8290
sub_right = self.__class__.node.create_subscription(
8391
CameraInfo,
8492
"/cam_turtlebot_right/camera_info",
8593
lambda msg: msgs_right.append(msg),
86-
10,
94+
qos_profile=sensor_qos,
8795
)
8896

89-
# Wait for messages (up to 5 seconds)
90-
for _ in range(50): # 50 x 0.1 seconds = 5 seconds
97+
# Wait for messages (up to 10 seconds)
98+
for _ in range(100): # 100 x 0.1 seconds = 10 seconds
9199
rclpy.spin_once(self.__class__.node, timeout_sec=0.1)
92100
if msgs_left and msgs_right:
93101
break
@@ -105,6 +113,14 @@ def test_camera_topics(self, proc_output):
105113
def test_camera_images(self, proc_output):
106114
"""Test that camera images are published."""
107115

116+
# Set appropriate QoS for sensor data
117+
sensor_qos = rclpy.qos.QoSProfile(
118+
reliability=rclpy.qos.ReliabilityPolicy.BEST_EFFORT,
119+
durability=rclpy.qos.DurabilityPolicy.VOLATILE,
120+
history=rclpy.qos.HistoryPolicy.KEEP_LAST,
121+
depth=10,
122+
)
123+
108124
# Check actual message receipt
109125
msgs_left = []
110126
msgs_right = []
@@ -114,18 +130,18 @@ def test_camera_images(self, proc_output):
114130
Image,
115131
"/cam_turtlebot_left/image_raw",
116132
lambda msg: msgs_left.append(msg),
117-
10,
133+
qos_profile=sensor_qos,
118134
)
119135

120136
sub_right = self.__class__.node.create_subscription(
121137
Image,
122138
"/cam_turtlebot_right/image_raw",
123139
lambda msg: msgs_right.append(msg),
124-
10,
140+
qos_profile=sensor_qos,
125141
)
126142

127-
# Wait for messages (up to 5 seconds)
128-
for _ in range(50): # 50 x 0.1 seconds =
143+
# Wait for messages (up to 10 seconds)
144+
for _ in range(100): # 100 x 0.1 seconds = 10 seconds
129145
rclpy.spin_once(self.__class__.node, timeout_sec=0.1)
130146
if msgs_left and msgs_right:
131147
break

0 commit comments

Comments
 (0)