diff --git a/dronekit/__init__.py b/dronekit/__init__.py index a11b9eb50..ad0baa045 100644 --- a/dronekit/__init__.py +++ b/dronekit/__init__.py @@ -45,6 +45,7 @@ import types import threading import math +import struct import copy import collections from pymavlink.dialects.v10 import ardupilotmega @@ -2433,7 +2434,8 @@ def set(self, name, value, retries=3, wait_ready=False): # instead just wait until the value itself was changed name = name.upper() - value = float(value) + # convert to single precision floating point number (the type used by low level mavlink messages) + value = float(struct.unpack('f', struct.pack('f', value))[0]) success = False remaining = retries while True: