姿态参数

This commit is contained in:
ywb
2026-05-19 21:41:14 +08:00
parent 2eb39fdbd5
commit f05d6ea059
2 changed files with 4 additions and 2 deletions
+3 -1
View File
@@ -418,6 +418,7 @@ def api_navigate_to():
data = request.json
goal_x = data.get("x")
goal_y = data.get("y")
goal_yaw = data.get("yaw") # 姿态参数,可选
if goal_x is None or goal_y is None:
return jsonify({"ok": False, "error": "缺少目标坐标 x, y"}), 400
@@ -428,7 +429,8 @@ def api_navigate_to():
if gs.navigator is None:
gs.navigator = Nav2Navigator()
# navigate_to_pose(x, y, yaw=None, timeout_sec=120, blocking=False)
ok = gs.navigator.navigate_to_pose(float(goal_x), float(goal_y), blocking=False)
yaw_arg = float(goal_yaw) if goal_yaw is not None else None
ok = gs.navigator.navigate_to_pose(float(goal_x), float(goal_y), yaw_arg, blocking=False)
if ok:
return jsonify({"ok": True, "message": "导航已启动"})
else:
+1 -1
View File
@@ -871,7 +871,7 @@ createApp({
try {
var res = await fetch(API + '/api/navigate/to', {
method: 'POST', headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ x: coords[0], y: coords[1] })
body: JSON.stringify({ x: coords[0], y: coords[1], yaw: coords[2] })
})
var data = await res.json()
if (data.ok) {