Spaces:
No application file
No application file
File size: 3,745 Bytes
2fbee2e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
#!/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() |