fix: change coordinate system of simulator and autopilot, reduce approximation error
This commit is contained in:
10
simulator.py
10
simulator.py
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user