From ea4d592ea39d53e6ff330c93728e6fec35255b5c Mon Sep 17 00:00:00 2001 From: ywb <347742090@qq.com> Date: Sun, 17 May 2026 10:15:43 +0800 Subject: [PATCH] fix: nav2_navigator _get_current_pose uses /amcl_pose (was /odom which is always 0,0) --- agv_app/utils/nav2_navigator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/agv_app/utils/nav2_navigator.py b/agv_app/utils/nav2_navigator.py index 558c78e..4b3309c 100644 --- a/agv_app/utils/nav2_navigator.py +++ b/agv_app/utils/nav2_navigator.py @@ -121,7 +121,7 @@ class Nav2Navigator: def _get_current_pose(self) -> List[float]: """从 /odom 获取当前位置 [x, y, yaw]""" try: - rc, out, err = _run_ros2_bash("timeout 3 ros2 topic echo /odom --once 2>/dev/null", timeout=4) + rc, out, err = _run_ros2_bash("timeout 3 ros2 topic echo /amcl_pose --once 2>/dev/null", timeout=4) if rc == 0 and out: import re, yaml clean = re.sub(r'\x1b\[[0-9;]*[a-zA-Z]', '', out)