bug fixed for start point sidderent from current point

This commit is contained in:
abnerhexu
2026-01-25 22:04:08 +08:00
parent ab8bb2e220
commit 37933eb22b
2 changed files with 70 additions and 25 deletions

View File

@@ -460,6 +460,8 @@ def create_uav_tools(client: UAVAPIClient) -> list:
return "Error: drone_id is required"
result = client.take_off(drone_id, altitude)
if result["status"] == "success":
result["message"] += f" Using `get_drone_status` to check if the drone\'s current position is start point. If not, fly to the start point first."
return json.dumps(result, indent=2)
except json.JSONDecodeError as e:
return f"Error parsing JSON input: {str(e)}. Expected format: {{\"drone_id\": \"drone-001\", \"altitude\": 15.0}}"
@@ -1248,8 +1250,10 @@ def create_uav_tools(client: UAVAPIClient) -> list:
if current_coverage >= required_coverage:
tool_states.explored_count = 0
return f"Success: Target explored with coverage {current_coverage:.2%} (Visited {tool_states.explored_count}/{total_points} grid points)"
return f"Finished path. Final coverage: {current_coverage:.2%}"
if math.isclose(current_coverage, 0.0):
return f"Finished path. Final coverage: {current_coverage:.2%}. Please try call this tool again to continue exploring."
else:
return f"Finished path. Final coverage: {current_coverage:.2%}. Wait for a while and continue calling this function! return [TASK DONE] this time"
# Return all tools