Skip to content

Commit

Permalink
Merge pull request #537 from mavlink/pr-example-all-params
Browse files Browse the repository at this point in the history
examples: add example to fetch all params
  • Loading branch information
JonasVautherin authored Dec 22, 2022
2 parents e226fcd + 9f869a9 commit 3775c02
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions examples/all_params.py
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())

0 comments on commit 3775c02

Please sign in to comment.