初始化:RMUL 2027 哨兵导航仿真工程

- Gazebo Sim (Jetty 10.6) + ROS 2 Lyrical + Nav2 全栈
- 整车模型:URDF/SDF + 减面网格(SolidWorks 装配体实测尺寸)
- 场地:RMUL 2027 官方包(2D 栅格地图 + 3D 场地模型),放在 field/
- sentry_nav C++ 包:self_filter 点云自滤 / patrol 航点巡逻
- 文档:README(含本机开发环境实测)、MID-360 接入说明

已排除:build/ install/ log/ 缓存目录,以及 115 MB 的原始高模
(仿真实际用的是 meshes/base.stl 减面版,约 25.7 万面)
This commit is contained in:
mzx committed 2026-11-14 21:18:04 +08:00
1 parent ed31ccc39f
commit f7412ec369
142 files changed
+58958 -2

No files matched your search

+42
View File
@@ -0,0 +1,42 @@
#!/usr/bin/env python3
"""诊断 Nav2:代价地图是否在更新、TF 是否完整、能否规划。"""
import time
import rclpy
from nav_msgs.msg import OccupancyGrid
from rclpy.node import Node
from tf2_ros import Buffer, TransformListener
rclpy.init()
node = Node('nav_diag')
buf = Buffer()
TransformListener(buf, node)
grids = {}
node.create_subscription(OccupancyGrid, '/global_costmap/costmap',
lambda m: grids.__setitem__('g', (time.time(), m)), 10)
node.create_subscription(OccupancyGrid, '/local_costmap/costmap',
lambda m: grids.__setitem__('l', (time.time(), m)), 10)
node.create_subscription(OccupancyGrid, '/map',
lambda m: grids.__setitem__('m', (time.time(), m)), 10)
t0 = time.time()
while time.time() - t0 < 12:
rclpy.spin_once(node, timeout_sec=0.2)
for key, name in (('m', '/map'), ('g', 'global_costmap'), ('l', 'local_costmap')):
if key in grids:
ts, g = grids[key]
print(f'{name:16} ✅ 收到 尺寸={g.info.width}x{g.info.height} 分辨率={g.info.resolution} 龄期={time.time()-ts:.1f}s')
else:
print(f'{name:16} ❌ 没收到(说明这一环没在发布/更新)')
for parent, child in (('map', 'odom'), ('odom', 'base_link'), ('base_link', 'lidar_link')):
try:
tr = buf.lookup_transform(parent, child, rclpy.time.Time())
p = tr.transform.translation
print(f'TF {parent:9} -> {child:10} ✅ ({p.x:+.2f}, {p.y:+.2f}, {p.z:+.2f})')
except Exception as exc: # noqa: BLE001
print(f'TF {parent:9} -> {child:10} ❌ {str(exc)[:60]}')
node.destroy_node()
rclpy.shutdown()