feat: add chunks to autopilot, test for estimation
This commit is contained in:
17
simulator.py
17
simulator.py
@@ -43,7 +43,10 @@ class Simulator:
|
||||
# Получаем размеры изображения
|
||||
width, height = image.size
|
||||
square_size = min(width, height)
|
||||
cropped_image = image.crop((0, 0, square_size, square_size))
|
||||
off_x = (width - square_size) / 2
|
||||
off_y = (height - square_size) / 2
|
||||
|
||||
cropped_image = image.crop((off_x, off_y, off_x + square_size, off_y + square_size))
|
||||
cropped_image = cropped_image.rotate(angle / math.pi * 180, expand=True)
|
||||
|
||||
# Определяем размер концентрического квадрата (80% от минимальной стороны)
|
||||
@@ -83,16 +86,24 @@ class Simulator:
|
||||
action.click_and_hold()
|
||||
|
||||
self.angle += dangle
|
||||
print(f" [Simulator] angle: {self.angle / math.pi * 180:.1f}°")
|
||||
velocity = max(velocity, 10)
|
||||
dx = math.cos(self.angle) * velocity
|
||||
dy = math.sin(self.angle) * velocity
|
||||
print(" [Simulator] dx, dy:", [dx, dy])
|
||||
self.update_trajectory(dx, dy)
|
||||
action.move_by_offset(-dx, dy)
|
||||
action.release()
|
||||
action.perform()
|
||||
print(f" [Simulator] Position: {self.current_x}, {self.current_y}")
|
||||
|
||||
def get_photo(self) -> Image:
|
||||
def get_photo(self) -> Image.Image:
|
||||
png = self.yandexMap.driver.get_screenshot_as_png()
|
||||
im = Image.open(BytesIO(png))
|
||||
return im
|
||||
|
||||
# Применяем поворот как будто съемка с дрона
|
||||
rotated_im = self.rotate_image_like_drone(im, math.pi / 2 - self.angle)
|
||||
return rotated_im
|
||||
|
||||
def loop(self):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user