Spaces:
No application file
No application file
sam133
οΏ½ Restructure repo following successful MCP Hackathon pattern: Clean modular architecture with mcp_client.py, design_tools.py, and organized app.py
fe37569
| #!/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() |