Skip to content

Commit 9f869a9

Browse files
committed
examples: add example to fetch all params
Signed-off-by: Julian Oes <[email protected]>
1 parent 677a295 commit 9f869a9

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

examples/all_params.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env python3
2+
3+
import asyncio
4+
from mavsdk import System
5+
6+
async def run():
7+
# Connect to the drone
8+
drone = System()
9+
await drone.connect(system_address="udp://:14540")
10+
11+
# Get the list of parameters
12+
all_params = await drone.param.get_all_params()
13+
14+
# Iterate through all int parameters
15+
for param in all_params.int_params:
16+
print(f"{param.name}: {param.value}")
17+
18+
for param in all_params.float_params:
19+
print(f"{param.name}: {param.value}")
20+
21+
# Run the asyncio loop
22+
asyncio.run(run())

0 commit comments

Comments
 (0)