#!/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()