From 0987355b8ba2b64f05cfb028ad71dd5a31c2cf66 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9C=BA=E6=A2=B0=E5=B0=8F=E9=B8=BD?=
<128568434+jixiexiaoge@users.noreply.github.com>
Date: Tue, 4 Mar 2025 14:17:01 +0800
Subject: [PATCH] apm
---
.../frogpilot/fleetmanager/fleet_manager.py | 51 +++++++++++++++++++
.../fleetmanager/templates/index.html | 1 +
.../fleetmanager/templates/layout.html | 3 ++
3 files changed, 55 insertions(+)
diff --git a/selfdrive/frogpilot/fleetmanager/fleet_manager.py b/selfdrive/frogpilot/fleetmanager/fleet_manager.py
index 52a07c3..a5aaa69 100644
--- a/selfdrive/frogpilot/fleetmanager/fleet_manager.py
+++ b/selfdrive/frogpilot/fleetmanager/fleet_manager.py
@@ -586,6 +586,57 @@ def carinfo():
traceback.print_exc()
return render_template("carinfo.html", car_info={"error": f"Error getting vehicle information: {str(e)}"})
+@app.route("/amap_addr", methods=["GET", "POST"])
+def amap_addr():
+ # 直接使用硬编码的 key
+ amap_key = "faf2f8ab406a8da1231ef7e10d501b65"
+ amap_key_2 = "fc2724b3c96a7f244b2211f05c5264be"
+
+ # 获取当前位置
+ try:
+ location = get_current_location() # 假设这个函数已存在
+ lat = location.get("lat", 31.2304) # 默认上海坐标
+ lon = location.get("lon", 121.4737)
+ except:
+ lat = 31.2304 # 默认上海坐标
+ lon = 121.4737
+
+ if request.method == "POST":
+ # 处理导航请求
+ lat = request.form.get("lat")
+ lon = request.form.get("lon")
+ save_type = request.form.get("save_type", "recent")
+ name = request.form.get("name", "")
+
+ # 保存目的地
+ save_destination(save_type, name, lat, lon) # 假设这个函数已存在
+
+ # 生成导航路线
+ generate_route(lat, lon) # 假设这个函数已存在
+
+ # 重定向到导航页面
+ return redirect("/prime")
+
+ # 获取保存的地址
+ home = get_saved_location("home") # 假设这个函数已存在
+ work = get_saved_location("work")
+ fav1 = get_saved_location("fav1")
+ fav2 = get_saved_location("fav2")
+ fav3 = get_saved_location("fav3")
+
+ return render_template(
+ "amap_addr_input.html",
+ amap_key=amap_key,
+ amap_key_2=amap_key_2,
+ lat=lat,
+ lon=lon,
+ home=home,
+ work=work,
+ fav1=fav1,
+ fav2=fav2,
+ fav3=fav3
+ )
+
def main():
try:
set_core_affinity([0, 1, 2, 3])
diff --git a/selfdrive/frogpilot/fleetmanager/templates/index.html b/selfdrive/frogpilot/fleetmanager/templates/index.html
index fdf93f1..76bf192 100644
--- a/selfdrive/frogpilot/fleetmanager/templates/index.html
+++ b/selfdrive/frogpilot/fleetmanager/templates/index.html
@@ -13,5 +13,6 @@
Access Preserved Footage
View Screen Recordings
Access Error Logs
+
高德地图导航
About Fleet Manager
{% endblock %}
diff --git a/selfdrive/frogpilot/fleetmanager/templates/layout.html b/selfdrive/frogpilot/fleetmanager/templates/layout.html
index 3a088dc..93fd505 100644
--- a/selfdrive/frogpilot/fleetmanager/templates/layout.html
+++ b/selfdrive/frogpilot/fleetmanager/templates/layout.html
@@ -67,6 +67,9 @@