From b756c8c3812ee0819a3a064e5647aecdfb74229a Mon Sep 17 00:00:00 2001 From: huxiaoyi-ovo Date: Mon, 31 Aug 2026 23:42:36 +0800 Subject: [PATCH 1/3] Handle failed LQR local path in RRT* steering --- PathPlanning/LQRRRTStar/lqr_rrt_star.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PathPlanning/LQRRRTStar/lqr_rrt_star.py b/PathPlanning/LQRRRTStar/lqr_rrt_star.py index 0ed08123ea..9cbbeb2b57 100644 --- a/PathPlanning/LQRRRTStar/lqr_rrt_star.py +++ b/PathPlanning/LQRRRTStar/lqr_rrt_star.py @@ -190,7 +190,7 @@ def steer(self, from_node, to_node): px, py, course_lens = self.sample_path(wx, wy, self.step_size) - if px is None: + if not px: return None newNode = copy.deepcopy(from_node) From 34cd25a9a5087ce01f5a08872194d713ba359b45 Mon Sep 17 00:00:00 2001 From: huxiaoyi-ovo Date: Mon, 31 Aug 2026 23:42:43 +0800 Subject: [PATCH 2/3] Add regression test for failed LQR local path --- tests/test_lqr_rrt_star.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/test_lqr_rrt_star.py b/tests/test_lqr_rrt_star.py index 444b4616b8..801cf2135b 100644 --- a/tests/test_lqr_rrt_star.py +++ b/tests/test_lqr_rrt_star.py @@ -10,5 +10,19 @@ def test1(): m.main(maxIter=5) +def test_steer_handles_failed_local_planner(): + planner = m.LQRRRTStar( + start=[0.0, 0.0], + goal=[1.0, 1.0], + obstacle_list=[], + rand_area=[-1.0, 1.0], + ) + planner.lqr_planner.lqr_planning = lambda *args, **kwargs: ([], []) + + result = planner.steer(planner.start, planner.end) + + assert result is None + + if __name__ == '__main__': conftest.run_this_test(__file__) From ec8e72aa2f4312f419347d752449c723aabaa76b Mon Sep 17 00:00:00 2001 From: huxiaoyi-ovo Date: Tue, 1 Sep 2026 01:23:57 +0800 Subject: [PATCH 3/3] Exercise real LQR failure in regression test --- tests/test_lqr_rrt_star.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_lqr_rrt_star.py b/tests/test_lqr_rrt_star.py index 801cf2135b..d053934589 100644 --- a/tests/test_lqr_rrt_star.py +++ b/tests/test_lqr_rrt_star.py @@ -17,7 +17,7 @@ def test_steer_handles_failed_local_planner(): obstacle_list=[], rand_area=[-1.0, 1.0], ) - planner.lqr_planner.lqr_planning = lambda *args, **kwargs: ([], []) + planner.lqr_planner.MAX_TIME = 0.0 result = planner.steer(planner.start, planner.end)