@@ -109,7 +109,7 @@ def test_goal_pose(
109109 timeout (int): The timeout in seconds.
110110
111111 Raises:
112- AssertionError : When a timeout occurs.
112+ TimeoutError : When a timeout occurs.
113113 """
114114 # 1) Obtain current pose in map frame:
115115 tf_buffer = Buffer ()
@@ -124,7 +124,7 @@ def test_goal_pose(
124124 "map" , f"{ namespace_vehicle } /base_link" , Time ()
125125 )
126126 if time .time () - start_time > timeout :
127- raise AssertionError ( "Timeout while waiting for current pose." )
127+ raise TimeoutError ( )
128128
129129 # 2) Publish goal pose 1 meter in front of current position:
130130 goal_pose = PoseStamped ()
@@ -151,8 +151,8 @@ def test_goal_pose(
151151 current_pose .transform .translation .x - goal_pose .pose .position .x
152152 )
153153 if time .time () - start_time > timeout :
154- raise AssertionError (
155- f"Timeout. Distance is { distance } while tolerance is { navigation_distance_tolerance } ."
154+ raise TimeoutError (
155+ f"Distance is { distance } while tolerance is { navigation_distance_tolerance } ."
156156 )
157157
158158 # 4) Stop navigation, since the goal can be reached before the navigation is finished due to tolerance:
@@ -172,7 +172,7 @@ def test_gps_navigation(
172172 timeout (int): The timeout in seconds.
173173
174174 Raises:
175- AssertionError : When a timeout occurs.
175+ TimeoutError : When a timeout occurs.
176176 """
177177 # 1) Obtain current GPS location:
178178 current_nav_sat = NavSatFix ()
@@ -189,7 +189,7 @@ def callback(msg: NavSatFix) -> None:
189189 while current_nav_sat == NavSatFix ():
190190 rclpy .spin_once (test_node , timeout_sec = 0 )
191191 if time .time () - start_time > timeout :
192- raise AssertionError ("Timeout while waiting for current GPS location." )
192+ raise TimeoutError ("Timeout while waiting for current GPS location." )
193193
194194 # 2) Publish goal GPS location 1e-5 degrees north of current location:
195195 goal_nav_sat = copy .deepcopy (current_nav_sat )
@@ -211,8 +211,8 @@ def callback(msg: NavSatFix) -> None:
211211 rclpy .spin_once (test_node , timeout_sec = 0 )
212212 distance = abs (current_nav_sat .latitude - goal_nav_sat .latitude )
213213 if time .time () - start_time > timeout :
214- raise AssertionError (
215- f"Timeout. Distance is { distance } while tolerance is { navigation_degree_tolerance } ."
214+ raise TimeoutError (
215+ f"Distance is { distance } while tolerance is { navigation_degree_tolerance } ."
216216 )
217217
218218 # 4) Stop navigation, since the goal can be reached before the navigation is finished due to tolerance:
0 commit comments