diff --git a/selfdrive/frogpilot/fleetmanager/fleet_manager.py b/selfdrive/frogpilot/fleetmanager/fleet_manager.py index 62a7426..2e18cb8 100644 --- a/selfdrive/frogpilot/fleetmanager/fleet_manager.py +++ b/selfdrive/frogpilot/fleetmanager/fleet_manager.py @@ -281,6 +281,16 @@ def amap_addr_input(): amap_key, amap_key_2 = fleet.get_amap_key() return render_template("amap_addr_input.html", lon=lon, lat=lat, amap_key=amap_key, amap_key_2=amap_key_2) +@app.route("/tmap_addr_input", methods=['GET', 'POST']) +def tmap_addr_input(): + if request.method == 'POST': + postvars = request.form.to_dict() + fleet.nav_confirmed(postvars) + return redirect(url_for('tmap_addr_input')) + else: + lon, lat = fleet.get_last_lon_lat() + return render_template("tmap_addr_input.html", lon=lon, lat=lat) + @app.route("/CurrentStep.json", methods=['GET']) def find_CurrentStep(): directory = "/data/openpilot/selfdrive/manager/" @@ -336,6 +346,34 @@ def store_toggle_values_route(): except Exception as e: return jsonify({"error": "Failed to update values", "details": str(e)}), 400 +@app.route("/get_nav_status", methods=['GET']) +def get_nav_status(): + nav_active = fleet.get_nav_active() + return jsonify({ + "active": nav_active + }) + +@app.route("/get_system_status", methods=['GET']) +def get_system_status(): + nav_active = fleet.get_nav_active() + gps_status = fleet.get_gps_status() + network_status = fleet.check_network_status() + + return jsonify({ + "nav_status": { + "active": nav_active, + "state": "导航中" if nav_active else "待机" + }, + "gps_status": { + "active": gps_status["active"], + "signal": gps_status["signal"] + }, + "network_status": { + "connected": network_status["connected"], + "type": network_status["type"] + } + }) + def main(): try: set_core_affinity([0, 1, 2, 3]) diff --git a/selfdrive/frogpilot/fleetmanager/helpers.py b/selfdrive/frogpilot/fleetmanager/helpers.py index cfe6798..884f67e 100644 --- a/selfdrive/frogpilot/fleetmanager/helpers.py +++ b/selfdrive/frogpilot/fleetmanager/helpers.py @@ -221,9 +221,10 @@ def ffplay_mp4_wrap_process_builder(file_name): ) def get_nav_active(): - if params.get("NavDestination", encoding='utf8') is not None: - return True - else: + try: + with open('/data/params/d/NavDestination', 'r') as f: + return f.read().strip() != "" + except: return False def get_public_token(): @@ -244,20 +245,29 @@ def get_amap_key(): return (token.strip() if token is not None else None, token2.strip() if token2 is not None else None) def get_SearchInput(): - SearchInput = params.get_int("SearchInput") - return SearchInput + try: + with open('/data/params/d/SearchInput', 'r') as f: + return int(f.read()) + except: + return 0 def get_PrimeType(): - PrimeType = params.get_int("PrimeType") - return PrimeType + try: + with open('/data/params/d/PrimeType', 'r') as f: + return int(f.read()) + except: + return 0 def get_last_lon_lat(): - last_pos = params.get("LastGPSPosition") - if last_pos: - l = json.loads(last_pos) - else: - return 0.0, 0.0 - return l["longitude"], l["latitude"] + try: + with open('/data/params/d/LastGPSPosition', 'r') as f: + content = f.read().strip() + if content: + lat, lon = map(float, content.split(",")) + return lon, lat + except: + pass + return 116.397128, 39.916527 # 默认北京天安门坐标 def get_locations(): data = params.get("ApiCache_NavDestinations", encoding='utf-8') @@ -463,3 +473,30 @@ def store_toggle_values(updated_values): params_memory.put_bool("FrogPilotTogglesUpdated", True) time.sleep(1) params_memory.put_bool("FrogPilotTogglesUpdated", False) + +def get_gps_status(): + try: + # 读取GPS状态 + with open('/data/params/d/LastGPSPosition', 'r') as f: + content = f.read().strip() + if not content: + return {"active": False, "signal": "无信号"} + return { + "active": True, + "signal": "正常" + } + except: + return {"active": False, "signal": "未知"} + +def check_network_status(): + try: + # 检查网络连接 + result = subprocess.run(['ping', '-c', '1', '-W', '1', '8.8.8.8'], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + return { + "connected": result.returncode == 0, + "type": "已连接" if result.returncode == 0 else "未连接" + } + except: + return {"connected": False, "type": "未知"} diff --git a/selfdrive/frogpilot/fleetmanager/templates/index.html b/selfdrive/frogpilot/fleetmanager/templates/index.html index 7d33bcd..b470301 100644 --- a/selfdrive/frogpilot/fleetmanager/templates/index.html +++ b/selfdrive/frogpilot/fleetmanager/templates/index.html @@ -1,16 +1,146 @@ {% extends "layout.html" %} {% block title %} - Home + Fleet Manager 主页 {% endblock %} {% block main %} -
-

Fleet Manager

-
- View Dashcam Footage
-
Access Preserved Footage
-
View Screen Recordings
-
Access Error Logs
-
About Fleet Manager
+ + + + + + +
+

Fleet Manager

+ + +
+

导航服务

+ +
+ + +
+

视频和日志

+ +
+ + +
+

系统状态

+
+
+
+

导航状态

+ +
+
+
+
+

GPS信号

+
+ 检测中 +
+
+
+
+
+

网络状态

+
+ 检测中 +
+
+
+
+
+
+ + {% endblock %} diff --git a/selfdrive/frogpilot/fleetmanager/templates/tmap_addr_input.html b/selfdrive/frogpilot/fleetmanager/templates/tmap_addr_input.html new file mode 100644 index 0000000..9a49aea --- /dev/null +++ b/selfdrive/frogpilot/fleetmanager/templates/tmap_addr_input.html @@ -0,0 +1,680 @@ +{% extends "layout.html" %} + +{% block title %} + 腾讯地图导航 +{% endblock %} + +{% block main %} + + + + 地点搜索与导航 + + + + + + + + + + +
+
+ + + + + +{% endblock %} \ No newline at end of file