Nav2导航 heredoc pipe方式修复 + 重启脚本更新
nav2_navigator.py: 改用 subprocess.Popen + stdin heredoc 避免bash单引号转义 restart_agv.sh: 清理所有旧进程再重启(bringup → Nav2 → Flask) app.py: init_pose改用 heredoc 子进程脚本方式
This commit is contained in:
+2
-2
@@ -648,7 +648,7 @@ def api_mission_init_pose():
|
||||
script = "/tmp/ros2_init_pose.sh"
|
||||
lines = [
|
||||
"#!/bin/bash",
|
||||
"export ROS_DOMAIN_ID=1",
|
||||
"export ROS_DOMAIN_ID=0",
|
||||
"source /opt/ros/humble/setup.bash",
|
||||
"source ~/agv_pro_ros2/install/setup.bash",
|
||||
"python3 /tmp/publish_init_pose.py",
|
||||
@@ -659,7 +659,7 @@ def api_mission_init_pose():
|
||||
result = subprocess.run(
|
||||
[script],
|
||||
capture_output=True, text=True, timeout=12,
|
||||
env={**os.environ, "ROS_DOMAIN_ID": "1"}
|
||||
env={**os.environ, "ROS_DOMAIN_ID": "0"}
|
||||
)
|
||||
logger.info(f"init_pose: rc={result.returncode}")
|
||||
return jsonify({"ok": True, "message": "初始位置已设为 (0,0,0)"})
|
||||
|
||||
Reference in New Issue
Block a user