mirror of https://github.com/ArduPilot/ardupilot
pysim: ensure Vector3() uses floats
This commit is contained in:
parent
599cea21bb
commit
c084a72723
|
@ -29,19 +29,19 @@ class Vector3:
|
||||||
'''a vector'''
|
'''a vector'''
|
||||||
def __init__(self, x=None, y=None, z=None):
|
def __init__(self, x=None, y=None, z=None):
|
||||||
if x != None and y != None and z != None:
|
if x != None and y != None and z != None:
|
||||||
self.x = x
|
self.x = float(x)
|
||||||
self.y = y
|
self.y = float(y)
|
||||||
self.z = z
|
self.z = float(z)
|
||||||
elif x != None and len(x) == 3:
|
elif x != None and len(x) == 3:
|
||||||
self.x = x[0]
|
self.x = float(x[0])
|
||||||
self.y = x[1]
|
self.y = float(x[1])
|
||||||
self.z = x[2]
|
self.z = float(x[2])
|
||||||
elif x != None:
|
elif x != None:
|
||||||
raise ValueError('bad initialiser')
|
raise ValueError('bad initialiser')
|
||||||
else:
|
else:
|
||||||
self.x = 0
|
self.x = float(0)
|
||||||
self.y = 0
|
self.y = float(0)
|
||||||
self.z = 0
|
self.z = float(0)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return 'Vector3(%.2f, %.2f, %.2f)' % (self.x,
|
return 'Vector3(%.2f, %.2f, %.2f)' % (self.x,
|
||||||
|
|
Loading…
Reference in New Issue