-
Notifications
You must be signed in to change notification settings - Fork 222
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 #537 from mavlink/pr-example-all-params
examples: add example to fetch all params
- Loading branch information
Showing
1 changed file
with
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import asyncio | ||
from mavsdk import System | ||
|
||
async def run(): | ||
# Connect to the drone | ||
drone = System() | ||
await drone.connect(system_address="udp://:14540") | ||
|
||
# Get the list of parameters | ||
all_params = await drone.param.get_all_params() | ||
|
||
# Iterate through all int parameters | ||
for param in all_params.int_params: | ||
print(f"{param.name}: {param.value}") | ||
|
||
for param in all_params.float_params: | ||
print(f"{param.name}: {param.value}") | ||
|
||
# Run the asyncio loop | ||
asyncio.run(run()) |