Formatting

This commit is contained in:
2026-01-15 18:36:56 +01:00
parent ac73cfcf5e
commit e6ce15aee9
7 changed files with 43 additions and 40 deletions

View File

@@ -1,3 +1,4 @@
from helpers import print_status
import time
from objects.generic import Source, Target
@@ -6,42 +7,21 @@ from objects.mirror import Mirror
from objects.board import Board
# Solar module for simulation of world
STEP = 10
LOOP_DELAY = 0.005 # In seconds
# Testing embedding the mirrors in the world
board = Board()
world = World(board, tilt_deg=0)
HEIGHT = 30
source = Source(world, pos=(0, 50, 0))
target = Target(world, pos=(0, 50, 0))
# Create mirrors in a 3x2 grid
# Create mirrors in a grid
for x in range(2):
for y in range(1):
mirror = 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].motor_theta.set_angle(180)
world.mirrors[0].motor_phi.set_angle(180)
world.mirrors[1].motor_phi.set_angle(0)
world.mirrors[1].motor_theta.set_angle(0)
print_status()
# Main
try:
while True:
@@ -51,11 +31,9 @@ try:
#print(target.pos)
world.update_mirrors_from_source_target(source, target)
print_status()
print_status(world)
time.sleep(LOOP_DELAY)
t = time.time()
except KeyboardInterrupt:
pass