姿态参数
This commit is contained in:
+3
-1
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user