feat(localization): integrate LIO ROS TF, replay and validated AMCL replacement
GCC 15.2 C++23 clean rebuild: zero warnings. All 11 xmake test suites pass. Independent 120 s Gazebo replay: ATE 0.005279 m / 0.191335 deg; 1 s RPE 0.005358 m / 0.099086 deg. Both startup entry points validate Nav2 activation, no AMCL, and a single map-to-odom publisher.
This commit is contained in:
1 parent
55e9456e4a
commit
b833e6f658
30 files changed
+1314
-329
No files matched your search
+15
-6
@@ -37,7 +37,6 @@ from tf2_ros import Buffer, TransformListener
|
||||
# 只报了 7 个节点的状态 —— 一眼看不出问题其实出在定位那一组。
|
||||
EXPECTED_ACTIVE = [
|
||||
'map_server',
|
||||
'amcl',
|
||||
'controller_server',
|
||||
'planner_server',
|
||||
'smoother_server',
|
||||
@@ -164,9 +163,14 @@ def main():
|
||||
return None, '调用超时'
|
||||
return fut.result().current_state, None
|
||||
|
||||
# Give DDS discovery a chance before choosing the expected localization branch.
|
||||
for _ in range(10):
|
||||
rclpy.spin_once(node, timeout_sec=0.1)
|
||||
names_now = set(node.get_node_names())
|
||||
expected_active = EXPECTED_ACTIVE + (['amcl'] if 'amcl' in names_now else [])
|
||||
# ---------- 1. 生命周期 ----------
|
||||
print('=== 1. 生命周期状态 ===')
|
||||
for name in EXPECTED_ACTIVE:
|
||||
for name in expected_active:
|
||||
st, err = active(name)
|
||||
if st is None:
|
||||
print(' %-20s ❌ %s' % (name, err))
|
||||
@@ -177,6 +181,12 @@ def main():
|
||||
print(' %-20s ⚠️ %s' % (name, st.label))
|
||||
problems.append(f'{name} 是 {st.label},不是 ACTIVE')
|
||||
|
||||
names_now = set(node.get_node_names())
|
||||
if 'field_localization' in names_now and 'amcl' in names_now:
|
||||
problems.append('LIO 与 AMCL 同时运行;检查 map->odom 发布者互斥')
|
||||
elif 'amcl' not in names_now and 'field_localization' not in names_now:
|
||||
problems.append('LIO / AMCL 定位器均未发现')
|
||||
|
||||
# ---------- 1.5 节点总览:定位"卡在谁身上" ----------
|
||||
# 光看生命周期状态不够 —— 如果某个节点**压根没起来**,
|
||||
# 上面只会说"服务不存在",看不出是谁没被编排。这里把家底列出来。
|
||||
@@ -193,14 +203,14 @@ def main():
|
||||
else:
|
||||
print(' 生命周期管理器: ❌ 一个都没有(Nav2 不会自己配置)')
|
||||
problems.append('没有 lifecycle_manager 在跑')
|
||||
missing = [n for n in EXPECTED_ACTIVE if n not in names]
|
||||
missing = [n for n in expected_active if n not in names]
|
||||
if missing:
|
||||
print(f' ⚠️ 期望存在但没起: {", ".join(missing)}')
|
||||
for n in missing:
|
||||
problems.append(f'{n} 没在跑')
|
||||
extra = [n for n in names
|
||||
if any(k in n for k in ('amcl', 'server', 'navigator', 'manager'))
|
||||
and n not in EXPECTED_ACTIVE and 'lifecycle_manager' not in n]
|
||||
and n not in expected_active and 'lifecycle_manager' not in n]
|
||||
if extra:
|
||||
print(f' 其他相关节点: {", ".join(extra)}')
|
||||
else:
|
||||
@@ -295,8 +305,7 @@ def main():
|
||||
print(' [TF] map -> base_link (%.3f, %.3f)' % tf_pos)
|
||||
print(' [偏差] %.3f m %s' % (dev, flag))
|
||||
if dev >= 0.05:
|
||||
note = ('现在定位是"作弊"的(静态 map->odom + 轮速里程计),'
|
||||
'偏差会随时间累积且不自愈')
|
||||
note = '定位与 Gazebo 独立真值存在偏差;检查定位状态与传感器时间同步'
|
||||
print(' %s' % note)
|
||||
problems.append('TF 位置与 Gazebo 真值差 %.2f m' % dev)
|
||||
|
||||
|
||||
Reference in new issue
Block a user