diff --git a/agv_app/app.py b/agv_app/app.py index a8728fd..7b4b2a3 100644 --- a/agv_app/app.py +++ b/agv_app/app.py @@ -747,10 +747,10 @@ def api_mission_config_set(): gs.mission_config["cols"] = cols gs.mission_config["grid"] = grid gs.mission_config["arm_initial_pose"] = arm_initial_pose - # 清除超出网格边界的 positions(只保留 front/back 且 row { this.mapMsg = '' }, 3000) + }, async clearPoint() { if (!this.editingPoint) return const { pointRow, col } = this.editingPoint @@ -581,6 +600,20 @@ createApp({ } } catch (e) { alert('读取角度失败: ' + e.message) } }, + async applyArmInitialPose() { + if (!this.armConnected) { alert('机械臂未连接'); return } + if (!confirm('确认应用初始姿态到机械臂?')) return + try { + const res = await fetch(API + '/api/arm/set_angles', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ angles: this.armInitialPose, speed: 500 }) + }) + const data = await res.json() + if (data.ok) alert('✅ 机械臂已移动到初始姿态') + else alert('❌ 应用失败: ' + (data.error || '')) + } catch (e) { alert('应用失败: ' + e.message) } + }, async loadAllMachines() { try { const res = await fetch(API + '/api/mission/machines') diff --git a/agv_app/templates/setting.html b/agv_app/templates/setting.html index 907f3f5..58e1d21 100644 --- a/agv_app/templates/setting.html +++ b/agv_app/templates/setting.html @@ -12,7 +12,7 @@ @@ -268,6 +268,7 @@ + @@ -362,6 +363,7 @@
+
@@ -582,6 +584,6 @@ - + diff --git a/agv_app/utils/config.py b/agv_app/utils/config.py index 631f823..505e1b7 100644 --- a/agv_app/utils/config.py +++ b/agv_app/utils/config.py @@ -16,7 +16,7 @@ AGV_CONFIG = { # ========== 机械臂 TCP 客户端 ========== ARM_CONFIG = { - "host": "192.168.50.74", + "host": "192.168.50.89", "port": 5002, "timeout": 8, "retry_times": 3, @@ -39,7 +39,7 @@ CAMERA_CONFIG = { # ========== 机械臂摄像头流 ========== ARM_CAMERA_CONFIG = { - "url": "http://192.168.50.74:5003/api/camera/preview", + "url": "http://192.168.50.89:5003/api/camera/preview", } # ========== HTTP 上传 ========== diff --git a/agv_app/utils/mission_executor.py b/agv_app/utils/mission_executor.py index 1c410fa..6e3c99a 100644 --- a/agv_app/utils/mission_executor.py +++ b/agv_app/utils/mission_executor.py @@ -26,7 +26,7 @@ import numpy as np logger = logging.getLogger(__name__) ROS2_SETUP_CMD = "source /opt/ros/humble/setup.bash && source ~/agv_pro_ros2/install/setup.bash" -ARM_CAMERA_SNAPSHOT = "http://192.168.50.74:5003/api/camera/snapshot" +ARM_CAMERA_SNAPSHOT = "http://192.168.50.89:5003/api/camera/snapshot" PHOTOS_DIR = "/home/elephant/photos" # 二维码扫描重试参数