fix: nav2_navigator _get_current_pose uses /amcl_pose (was /odom which is always 0,0)
This commit is contained in:
@@ -121,7 +121,7 @@ class Nav2Navigator:
|
|||||||
def _get_current_pose(self) -> List[float]:
|
def _get_current_pose(self) -> List[float]:
|
||||||
"""从 /odom 获取当前位置 [x, y, yaw]"""
|
"""从 /odom 获取当前位置 [x, y, yaw]"""
|
||||||
try:
|
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:
|
if rc == 0 and out:
|
||||||
import re, yaml
|
import re, yaml
|
||||||
clean = re.sub(r'\x1b\[[0-9;]*[a-zA-Z]', '', out)
|
clean = re.sub(r'\x1b\[[0-9;]*[a-zA-Z]', '', out)
|
||||||
|
|||||||
Reference in New Issue
Block a user