feat: add drawing trajectory
This commit is contained in:
22
main.py
22
main.py
@@ -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:
|
||||
# Сдвиг камеры
|
||||
|
||||
Reference in New Issue
Block a user