Skip to content

Commit 253b1c8

Browse files
authored
Merge pull request #483 from mavlink/pr-hang-when-done
examples: exit gimbal script
2 parents f205b21 + cf6fac7 commit 253b1c8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

examples/gimbal.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ async def run():
1010
await drone.connect(system_address="udp://:14540")
1111

1212
# Start printing gimbal position updates
13-
asyncio.ensure_future(print_gimbal_position(drone))
13+
print_gimbal_position_task = asyncio.ensure_future(print_gimbal_position(drone))
1414

1515
print("Taking control of gimbal")
1616
await drone.gimbal.take_control(ControlMode.PRIMARY)
@@ -71,6 +71,8 @@ async def run():
7171
print("Release control of gimbal again")
7272
await drone.gimbal.release_control()
7373

74+
print_gimbal_position_task.cancel()
75+
7476

7577
async def print_gimbal_position(drone):
7678
# Report gimbal position updates asynchronously

0 commit comments

Comments
 (0)