This commit is contained in:
2026-08-05 18:17:25 +08:00
parent 61796dfa9f
commit b52cee9e39
34 changed files with 866 additions and 309 deletions
+15 -4
View File
@@ -16,21 +16,32 @@ sleep 3
echo
echo "[e2e] === 验证 topic ==="
echo "[e2e] --- topic list ---"
ros2 topic list --no-daemon | head -10
ros2 topic list 2>/dev/null
echo
echo "[e2e] --- topic hz /chatter (3s) ---"
timeout 3 ros2 topic hz /chatter --no-daemon 2>&1 | tail -5 || true
# 用 stdbuf 强制行缓冲,避免 docker exec 捕获不到输出
stdbuf -oL -eL timeout 3 ros2 topic hz /chatter 2>&1 | tail -5 || true
echo
echo "[e2e] --- topic info /chatter -v ---"
ros2 topic info /chatter -v --no-daemon | head -20
# 关键:不要 | head -N,会触发 BrokenPipe 让 ros2 崩
# 用 ros2 自带 --no-arr 之外的参数,或者重定向后再过滤
ros2 topic info /chatter -v 2>/dev/null | awk 'NR<=20' || true
echo
echo "[e2e] --- node list ---"
ros2 node list --no-daemon
ros2 node list 2>/dev/null
echo
echo "[e2e] 关停 launch..."
kill -INT "${LAUNCH_PID}" 2>/dev/null || true
pkill -f "ros2 launch bringup" 2>/dev/null || true
# ❗ ros2 launch fork 出的 chatter_* 子进程会 reparent 到 PID 1(孤儿),
# SIGINT 给 launch 不会传递给它们,必须显式 pkill
pkill -INT -f chatter_publisher 2>/dev/null || true
pkill -INT -f chatter_subscriber 2>/dev/null || true
pkill -INT -f chatter_publisher_cpp 2>/dev/null || true
pkill -INT -f chatter_subscriber_cpp 2>/dev/null || true
sleep 1
pkill -9 -f chatter 2>/dev/null || true
wait "${LAUNCH_PID}" 2>/dev/null || true
echo
echo "[e2e] ✅ DONE. 详细日志: cat /tmp/e2e_launch.log"