auto move towards bug fixed

This commit is contained in:
abnerhexu
2026-01-25 19:28:29 +08:00
parent aab416c588
commit ab8bb2e220
3 changed files with 17 additions and 2 deletions

View File

@@ -740,7 +740,8 @@ def create_uav_tools(client: UAVAPIClient) -> list:
"z": final_target_z
})
return f"Finding a destination successfully (dist={current_distance}m)... Now use `auto_navigate_to({nav_payload})` to move the drone."
# return f"Finding a destination successfully (dist={current_distance}m)... Now use `auto_navigate_to({nav_payload})` to move the drone. This tool safely brings drone to the destination and detour obstacles. First try it with exactly input {nav_payload}, if it fails, then adjust the positions."
return auto_navigate_to_non_tool(nav_payload)
except Exception as e:
return f"Error executing auto_navigate_towards: {str(e)}"
@@ -848,7 +849,10 @@ def create_uav_tools(client: UAVAPIClient) -> list:
Example: {{"drone_id": "drone-001", "x": 100.0, "y": 50.0, "z": 20.0}}
"""
# ---------------------------------------------------------
result = auto_navigate_to_non_tool(input_json)
return result
def auto_navigate_to_non_tool(input_json: str) -> str:
try:
# 1. 解析参数
params = json.loads(input_json) if isinstance(input_json, str) else input_json
@@ -1230,6 +1234,7 @@ def create_uav_tools(client: UAVAPIClient) -> list:
if first_warning == 0:
print("Warning: Low battery but no charging stations found!")
first_warning = 1
return "Wait for a while and continue calling this function! return [TASK DONE] this time"
except Exception as e:
print(f"Error during charging process: {str(e)}")