mirror of
https://github.com/okalachev/flix.git
synced 2026-06-28 05:56:44 +00:00
51cd5fc691
Add power subsystem. Add PWR_VOLT_PIN, PWR_VOLT_SCALE, PWR_VOLT_LPF_A parameters. Support BATTERY_STATUS mavlink messages streaming. Add pw cli command. Add voltage field to pyflix library. pyflix@0.12.
41 lines
1017 B
Python
Executable File
41 lines
1017 B
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
import math
|
|
from pyflix import Flix
|
|
|
|
print('=== Connect...')
|
|
flix = Flix()
|
|
|
|
print('Connected:', flix.connected)
|
|
print('Mode:', flix.mode)
|
|
print('Armed:', flix.armed)
|
|
print('Landed:', flix.landed)
|
|
print('Voltage:', flix.voltage, 'V')
|
|
print('Rates:', *[f'{math.degrees(r):.0f}°/s' for r in flix.rates])
|
|
print('Attitude:', *[f'{math.degrees(a):.0f}°' for a in flix.attitude_euler])
|
|
print('Motors:', flix.motors)
|
|
print('Acc', flix.acc)
|
|
print('Gyro', flix.gyro)
|
|
|
|
print('=== Execute commands...')
|
|
print('> time')
|
|
print(flix.cli('time'))
|
|
print('> imu')
|
|
print(flix.cli('imu'))
|
|
|
|
print('=== Get parameter...')
|
|
pitch_p = flix.get_param('CTL_P_P')
|
|
print('CTL_P_P = ', pitch_p)
|
|
|
|
print('=== Set parameter...')
|
|
flix.set_param('CTL_P_P', pitch_p)
|
|
|
|
print('=== Wait for gyro update...')
|
|
print('Gyro: ', flix.wait('gyro'))
|
|
|
|
print('=== Wait for HEARTBEAT message...')
|
|
print(flix.wait('mavlink.HEARTBEAT'))
|
|
|
|
print('=== When until landed = False (remove drone from the surface)')
|
|
flix.wait('landed', value=False)
|