mirror of
https://github.com/okalachev/flix.git
synced 2026-09-06 00:10:58 +00:00
Move mavlink commands handlers to a separated function
It's more convenient to handle error that way.
This commit is contained in:
+5
-2
@@ -2,10 +2,10 @@
|
||||
|
||||
# Script for testing pyflix and the simulation.
|
||||
|
||||
from pytest import approx
|
||||
from pytest import approx, raises
|
||||
from math import isnan, isfinite
|
||||
import time
|
||||
from pyflix import Flix
|
||||
from pyflix import Flix, mavlink
|
||||
|
||||
def test():
|
||||
print('=== Connect...')
|
||||
@@ -45,3 +45,6 @@ def test():
|
||||
flix.wait('mode', 'ACRO')
|
||||
flix.set_mode('AUTO')
|
||||
flix.wait('mode', 'AUTO')
|
||||
|
||||
raises(RuntimeError, lambda: flix._command_send(mavlink.MAV_CMD_DO_SET_MODE, [0, 99, 0, 0, 0, 0, 0])) # invalid mode
|
||||
raises(RuntimeError, lambda: flix._command_send(mavlink.MAV_CMD_DO_PARACHUTE, [0, 0, 0, 0, 0, 0, 0])) # unsupported command
|
||||
|
||||
Reference in New Issue
Block a user