Skip to content

Commit

Permalink
Fix roll in gimbal rotation #29
Browse files Browse the repository at this point in the history
  • Loading branch information
RexBerry committed Nov 15, 2024
1 parent 0301bd2 commit e64eec1
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions flight/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ async def mapping_move_to(
info: dict[str, CameraParameters] = {}

drone.gimbal.rotate(
-drone.attitude.pitch - 90, 0, heading # pitch is relative to the drone
-drone.attitude.pitch - 90,
-drone.attitude.roll,
heading, # pitch and roll are relative to the drone
)
await asyncio.sleep(1.0)

Expand Down Expand Up @@ -183,9 +185,7 @@ async def mapping_move_to(
next_interval_count: int = 1
while not goto_task.done():
# Keep gimbal pointed straight down
drone.gimbal.rotate(
-drone.attitude.pitch - 90, 0, heading # pitch is relative to the drone
)
drone.gimbal.rotate(-drone.attitude.pitch - 90, -drone.attitude.roll, heading)

position: dronekit.LocationGlobalRelative = drone.location.global_relative_frame

Expand All @@ -206,9 +206,7 @@ async def mapping_move_to(

await asyncio.sleep(0.25)

drone.gimbal.rotate(
-drone.attitude.pitch - 90, 0, heading # pitch is relative to the drone
)
drone.gimbal.rotate(-drone.attitude.pitch - 90, -drone.attitude.roll, heading)
await asyncio.sleep(1.0)

camera_parameters = await self._get_camera_parameters(drone)
Expand Down Expand Up @@ -271,7 +269,7 @@ async def odlc_move_to(
# Point the gimbal straight down
drone.gimbal.rotate(
-drone.gimbal.pitch - 90, # pitch is relative to the drone
drone.gimbal.roll,
-drone.gimbal.roll,
heading,
)

Expand Down

0 comments on commit e64eec1

Please sign in to comment.