重新将世界零点定义在了场地中心点,将哨兵的出生点改为红方出生点,车的速度改为1.5m/s,实现了哨兵导航到(0,0)点

This commit is contained in:
mzx committed 2026-11-19 21:55:40 +08:00
1 parent 0e4e4c6e18
commit 969763a9df
36 files changed
+983 -646

No files matched your search

+4 -4
View File
@@ -159,14 +159,15 @@ def main():
node.create_subscription(PointCloud2, '/scan/points_filtered',
waiter('scan/points_filtered'), SENSOR_QOS)
node.create_subscription(LaserScan, '/scan', waiter('scan'), SENSOR_QOS)
node.create_subscription(LaserScan, '/scan2d', waiter('scan2d'), SENSOR_QOS)
node.create_subscription(Odometry, '/odom', waiter('odom'), 10)
node.create_subscription(OccupancyGrid, '/map', waiter('map'), MAP_QOS)
deadline = time.time() + 8.0
while time.time() < deadline and len(seen) < 5:
while time.time() < deadline and len(seen) < 6:
rclpy.spin_once(node, timeout_sec=0.2)
for key in ('map', 'odom', 'scan', 'scan/points', 'scan/points_filtered'):
for key in ('map', 'odom', 'scan', 'scan/points', 'scan/points_filtered', 'scan2d'):
ok = key in seen
note = '(latched,订阅端 QoS 必须 TRANSIENT_LOCAL)' if key == 'map' else ''
print(' /%-22s %s %s' % (key, '✅ 有数据' if ok else '❌ 没收到', note))
@@ -225,8 +226,7 @@ def main():
else:
gx, gy = truth[0], truth[1]
print(' [真值] Gazebo 世界坐标 (%.3f, %.3f)' % (gx, gy))
print(' 场地坐标 (map) (%.3f, %.3f)' % (gx, gy))
print(' 中心零点 (field) (%.3f, %.3f)' % (gx - 6.0, gy - 4.0))
print(' 场地坐标 (map=field) (%.3f, %.3f)' % (gx, gy))
if tf_pos is None:
print(' [TF] map -> base_link 拿不到,无法比较')
else: