Agent2Robot / backup /run_trial.py
sam133
οΏ½ Restructure repo following successful MCP Hackathon pattern: Clean modular architecture with mcp_client.py, design_tools.py, and organized app.py
fe37569
raw
history blame
3.75 kB
#!/usr/bin/env python3
"""
Trial script for testing the enhanced orchestrator with multiple iterations
"""
import main_orchestrator_enhanced
import json
import os
from datetime import datetime
def run_trial():
print("πŸš€ Starting Enhanced Orchestrator Trial...")
print("=" * 60)
# Test with robot first
print("\nπŸ€– Testing Robot Design (up to 5 iterations)...")
try:
success, final_specs = main_orchestrator_enhanced.console_design_vehicle_for_obstacle(
vehicle_type='robot',
user_task_description='Design a robot that can pass the 5cm high obstacle'
)
print(f"\nβœ… Robot trial completed!")
print(f"Success: {success}")
print(f"Final specs: {final_specs}")
# Check if JSON file was created
json_files = [f for f in os.listdir('.') if f.startswith('best_robot_design_') and f.endswith('.json')]
if json_files:
latest_json = max(json_files, key=os.path.getctime)
print(f"\nπŸ“„ Best design saved to: {latest_json}")
# Show summary of best design
with open(latest_json, 'r') as f:
best_design = json.load(f)
print(f"\nπŸ† BEST ROBOT DESIGN SUMMARY:")
print(f" β€’ Final Position: {best_design['performance_results']['final_robot_x_position']:.3f}m")
print(f" β€’ Success: {best_design['performance_results']['overall_success']}")
print(f" β€’ Wheel Type: {best_design['robot_specifications']['wheel_type']}")
print(f" β€’ Body Clearance: {best_design['robot_specifications']['body_clearance_cm']}cm")
print(f" β€’ Material: {best_design['robot_specifications']['main_material']}")
except Exception as e:
print(f"❌ Robot trial failed: {e}")
import traceback
traceback.print_exc()
print("\n" + "=" * 60)
# Test with drone
print("\n🚁 Testing Drone Design (up to 5 iterations)...")
try:
success, final_specs = main_orchestrator_enhanced.console_design_vehicle_for_obstacle(
vehicle_type='drone',
user_task_description='Design a drone that can pass the 5cm high obstacle'
)
print(f"\nβœ… Drone trial completed!")
print(f"Success: {success}")
print(f"Final specs: {final_specs}")
# Check if JSON file was created
json_files = [f for f in os.listdir('.') if f.startswith('best_drone_design_') and f.endswith('.json')]
if json_files:
latest_json = max(json_files, key=os.path.getctime)
print(f"\nπŸ“„ Best design saved to: {latest_json}")
# Show summary of best design
with open(latest_json, 'r') as f:
best_design = json.load(f)
print(f"\nπŸ† BEST DRONE DESIGN SUMMARY:")
print(f" β€’ Final Position: {best_design['performance_results']['final_robot_x_position']:.3f}m")
print(f" β€’ Success: {best_design['performance_results']['overall_success']}")
print(f" β€’ Propeller Size: {best_design['drone_specifications']['propeller_size']}")
print(f" β€’ Flight Height: {best_design['drone_specifications']['flight_height_cm']}cm")
print(f" β€’ Material: {best_design['drone_specifications']['main_material']}")
except Exception as e:
print(f"❌ Drone trial failed: {e}")
import traceback
traceback.print_exc()
print("\n🎯 Trial completed! Check the generated JSON files and GIF files for detailed results.")
if __name__ == "__main__":
run_trial()