import time # Solar module for simulation of world import objects.solar as solar # Modeling of the world from objects.board import Board STEP = 10 LOOP_DELAY = 0.005 # In seconds # Testing embedding the mirrors in the world board = Board() world = solar.World(board, tilt_deg=0) HEIGHT = 30 source = solar.Source(world, pos=(0, 50, 0)) target = solar.Target(world, pos=(0, 50, 0)) # Create mirrors in a 3x2 grid for x in range(2): for y in range(1): mirror = solar.Mirror(world, cluster_x=x, cluster_y=y) world.add_mirror(mirror) world.update_mirrors_from_source_target(source, target) def print_status(): for i, mirror in enumerate(world.mirrors): phi, theta = mirror.get_angles() print(f"Mirror {i} ({mirror.cluster_x}, {mirror.cluster_y}) angles -> phi: {phi:.2f}°, theta: {theta:.2f}°") a = 1 t = time.time() world.mirrors[0].phi.set_angle(180) world.mirrors[0].theta.set_angle(180) world.mirrors[1].phi.set_angle(0) world.mirrors[1].theta.set_angle(0) print_status() # Main try: while True: #source.move(0, 0, 0.5) #source.move(10 * math.sin(a * t), 10 * math.cos(a * t)) #print(source.pos) #print(target.pos) world.update_mirrors_from_source_target(source, target) print_status() time.sleep(LOOP_DELAY) t = time.time() except KeyboardInterrupt: pass