Skip to content

Commit 42c78a7

Browse files
committed
mission_item_protocol: improve diagnostics around mission_item_int handling
1 parent 44fe8ac commit 42c78a7

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

MAVProxy/modules/lib/mission_item_protocol.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010
import os
1111
import re
1212
import struct
13+
import sys
1314
import time
1415

16+
import pymavlink
1517
from pymavlink import mavutil
1618
from MAVProxy.modules.lib import mp_module
1719
from MAVProxy.modules.lib import mp_util
@@ -345,6 +347,10 @@ def wp_to_mission_item_int(self, wp):
345347
MISSION_ITEM_INT to give cm level accuracy
346348
'''
347349
if wp.get_type() == 'MISSION_ITEM_INT':
350+
if not isinstance(wp.x, int):
351+
print("BUG! wp.x is not integer")
352+
if not isinstance(wp.y, int):
353+
print("BUG! wp.y is not integer")
348354
return wp
349355
if self.has_location(wp.command):
350356
p5 = int(wp.x*1.0e7)
@@ -428,7 +434,12 @@ def process_waypoint_request(self, m, master):
428434
if wp.mission_type != self.mav_mission_type():
429435
print("Wrong mission type in (%s)" % str(wp))
430436

431-
self.master.mav.send(wp_send)
437+
try:
438+
self.master.mav.send(wp_send)
439+
except struct.error:
440+
# this is often "required argument is not an integer"
441+
mavutil.dump_message_verbose(sys.stderr, wp_send)
442+
raise
432443

433444
self.loading_waypoint_lasttime = time.time()
434445

0 commit comments

Comments
 (0)