fix: change coordinate system of simulator and autopilot, reduce approximation error

This commit is contained in:
2025-10-07 18:25:09 +03:00
parent 520a333812
commit f0ac60c8ef
5 changed files with 272 additions and 113 deletions

View File

@@ -88,8 +88,8 @@ class Simulator:
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
dx = math.cos(math.pi / 2 + self.angle) * velocity
dy = math.sin(math.pi / 2 + self.angle) * velocity
print(" [Simulator] dx, dy:", [dx, dy])
self.update_trajectory(dx, dy)
action.move_by_offset(-dx, dy)
@@ -102,7 +102,7 @@ class Simulator:
im = Image.open(BytesIO(png))
# Применяем поворот как будто съемка с дрона
rotated_im = self.rotate_image_like_drone(im, math.pi / 2 - self.angle)
rotated_im = self.rotate_image_like_drone(im, -self.angle)
return rotated_im
def loop(self):
@@ -138,8 +138,8 @@ class Simulator:
action.click_and_hold()
self.angle += dangle
dx = math.cos(self.angle) * velocity
dy = math.sin(self.angle) * velocity
dx = math.cos(math.pi / 2 + self.angle) * velocity
dy = math.sin(math.pi / 2 + self.angle) * velocity
action.move_by_offset(-dx, dy)
action.release()
action.perform()