feat: add drawing trajectory

This commit is contained in:
2025-04-15 12:32:56 +03:00
parent a43e56cef3
commit e606b841a9
4 changed files with 77 additions and 19 deletions

22
main.py
View File

@@ -7,6 +7,8 @@ import selenium
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from random_pilot import RandomPilot
options = webdriver.ChromeOptions()
options.add_experimental_option("detach", True)
driver = webdriver.Chrome(options)
@@ -29,26 +31,8 @@ action.click(driver.find_element(By.CLASS_NAME, '_key_satellite'))
action.pause(0.2)
action.perform()
class RandomPilot():
angle: float
def __init__(self):
self.dangle = 0
self.angle = random.random() * math.pi * 2
self.velocity = 50
def step(self) -> tuple[float, float]:
# Поворот угла траектории
self.dangle += (random.random() - 0.5) * 0.1
self.dangle = max(min(self.dangle, 0.2), -0.2)
self.angle += self.dangle
dx = math.cos(self.angle) * self.velocity
dy = math.sin(self.angle) * self.velocity
return dx, dy
randomPilot = RandomPilot()
randomPilot = RandomPilot(100)
while True:
# Сдвиг камеры