Changes to method for sending mavlink commands in pymavlink

Make the exception names more verbose.
Make it public.
This commit is contained in:
Oleg Kalachev
2026-08-29 17:52:14 +03:00
parent 5d670dcc69
commit a2dd70654c
2 changed files with 24 additions and 19 deletions
+5 -2
View File
@@ -46,5 +46,8 @@ def test():
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
print("=== Check command errors")
with raises(RuntimeError, match='MAV_RESULT_DENIED'):
flix.send_command(mavlink.MAV_CMD_DO_SET_MODE, [0, 99, 0, 0, 0, 0, 0]) # invalid mode
with raises(RuntimeError, match='MAV_RESULT_UNSUPPORTED'):
flix.send_command(mavlink.MAV_CMD_DO_PARACHUTE, [0, 0, 0, 0, 0, 0, 0]) # unsupported command