-
Notifications
You must be signed in to change notification settings - Fork 221
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #545 from akkawimo/winch_plugin
Winch and Gripper plugins
- Loading branch information
Showing
4 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import asyncio | ||
from mavsdk import System | ||
|
||
|
||
async def run(): | ||
drone = System() | ||
await drone.connect(system_address="udp://:14540") | ||
|
||
print("Waiting for drone to connect...") | ||
async for state in drone.core.connection_state(): | ||
if state.is_connected: | ||
print(f"-- Connected to drone!") | ||
break | ||
|
||
print(f"-- Gripper Grab") | ||
await drone.gripper.grab(instance=1) | ||
|
||
await asyncio.sleep(1) | ||
|
||
print(f"-- Gripper Release") | ||
await drone.gripper.release(instance=1) | ||
|
||
while True: | ||
print("Staying connected, press Ctrl-C to exit") | ||
await asyncio.sleep(1) | ||
|
||
|
||
if __name__ == "__main__": | ||
# Run the asyncio loop | ||
asyncio.run(run()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import asyncio | ||
from mavsdk import System | ||
|
||
|
||
async def run(): | ||
drone = System() | ||
await drone.connect(system_address="udp://:14540") | ||
|
||
print("Waiting for drone to connect...") | ||
async for state in drone.core.connection_state(): | ||
if state.is_connected: | ||
print(f"-- Connected to drone!") | ||
break | ||
|
||
print(f"-- Winch action: load payload") | ||
await drone.winch.load_payload(instance=1) | ||
|
||
while True: | ||
print("Staying connected, press Ctrl-C to exit") | ||
await asyncio.sleep(1) | ||
|
||
|
||
if __name__ == "__main__": | ||
# Run the asyncio loop | ||
asyncio.run(run()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters